0103d5be96
These are data columns that store runtime configuration of build needed to execute it on runner and within pipeline. The definition of this data is that once used, and when no longer needed (due to retry capability) they can be freely removed. They use `jsonb` on PostgreSQL, and `text` on MySQL (due to lacking support for json datatype on old enough version).
31 lines
945 B
Ruby
31 lines
945 B
Ruby
# frozen_string_literal: true
|
|
|
|
require 'active_record/connection_adapters/abstract_mysql_adapter'
|
|
require 'active_record/connection_adapters/mysql/schema_definitions'
|
|
|
|
# MySQL (5.6) and MariaDB (10.1) are currently supported versions within GitLab,
|
|
# Since they do not support native `json` datatype we force to emulate it as `text`
|
|
|
|
if Gitlab::Database.mysql?
|
|
module ActiveRecord
|
|
module ConnectionAdapters
|
|
class AbstractMysqlAdapter
|
|
JSON_DATASIZE = 1.megabyte
|
|
|
|
NATIVE_DATABASE_TYPES.merge!(
|
|
json: { name: "text", limit: JSON_DATASIZE },
|
|
jsonb: { name: "text", limit: JSON_DATASIZE }
|
|
)
|
|
end
|
|
|
|
module MySQL
|
|
module ColumnMethods
|
|
# We add `jsonb` helper, as `json` is already defined for `MySQL` since Rails 5
|
|
def jsonb(*args, **options)
|
|
args.each { |name| column(name, :json, options) }
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|