Commit bfdb4c91 authored by Jasper Maes's avatar Jasper Maes Committed by Heinrich Lee Yu

Upgrade Rails to 5.1.6.1

Model.new.attributes now also returns encrypted attributes.
parent e7be8d24
source 'https://rubygems.org'
gem 'rails', '5.0.7.2'
gem 'rails', '5.1.6.1'
# Improves copy-on-write performance for MRI
gem 'nakayoshi_fork', '~> 0.0.4'
......@@ -18,7 +18,7 @@ gem 'mysql2', '~> 0.4.10', group: :mysql
gem 'pg', '~> 1.1', group: :postgres
gem 'rugged', '~> 0.28'
gem 'grape-path-helpers', '~> 1.0'
gem 'grape-path-helpers', '~> 1.1'
gem 'faraday', '~> 0.12'
......
......@@ -4,41 +4,41 @@ GEM
RedCloth (4.3.2)
abstract_type (0.0.7)
ace-rails-ap (4.1.2)
actioncable (5.0.7.2)
actionpack (= 5.0.7.2)
nio4r (>= 1.2, < 3.0)
actioncable (5.1.6.1)
actionpack (= 5.1.6.1)
nio4r (~> 2.0)
websocket-driver (~> 0.6.1)
actionmailer (5.0.7.2)
actionpack (= 5.0.7.2)
actionview (= 5.0.7.2)
activejob (= 5.0.7.2)
actionmailer (5.1.6.1)
actionpack (= 5.1.6.1)
actionview (= 5.1.6.1)
activejob (= 5.1.6.1)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.0.7.2)
actionview (= 5.0.7.2)
activesupport (= 5.0.7.2)
actionpack (5.1.6.1)
actionview (= 5.1.6.1)
activesupport (= 5.1.6.1)
rack (~> 2.0)
rack-test (~> 0.6.3)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.0.7.2)
activesupport (= 5.0.7.2)
actionview (5.1.6.1)
activesupport (= 5.1.6.1)
builder (~> 3.1)
erubis (~> 2.7.0)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
activejob (5.0.7.2)
activesupport (= 5.0.7.2)
activejob (5.1.6.1)
activesupport (= 5.1.6.1)
globalid (>= 0.3.6)
activemodel (5.0.7.2)
activesupport (= 5.0.7.2)
activerecord (5.0.7.2)
activemodel (= 5.0.7.2)
activesupport (= 5.0.7.2)
arel (~> 7.0)
activemodel (5.1.6.1)
activesupport (= 5.1.6.1)
activerecord (5.1.6.1)
activemodel (= 5.1.6.1)
activesupport (= 5.1.6.1)
arel (~> 8.0)
activerecord_sane_schema_dumper (1.0)
rails (>= 5, < 6)
activesupport (5.0.7.2)
activesupport (5.1.6.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
......@@ -52,7 +52,7 @@ GEM
public_suffix (>= 2.0.2, < 4.0)
aes_key_wrap (1.0.1)
akismet (2.0.0)
arel (7.1.4)
arel (8.0.0)
asana (0.8.1)
faraday (~> 0.9)
faraday_middleware (~> 0.9)
......@@ -208,7 +208,6 @@ GEM
encryptor (3.0.0)
equalizer (0.0.11)
erubi (1.7.1)
erubis (2.7.0)
escape_utils (1.2.1)
et-orbi (1.1.7)
tzinfo
......@@ -282,8 +281,8 @@ GEM
fog-xml (0.1.3)
fog-core
nokogiri (>= 1.5.11, < 2.0.0)
font-awesome-rails (4.7.0.1)
railties (>= 3.2, < 5.1)
font-awesome-rails (4.7.0.4)
railties (>= 3.2, < 6.0)
foreman (0.84.0)
thor (~> 0.19.1)
formatador (0.2.5)
......@@ -365,8 +364,8 @@ GEM
grape-entity (0.7.1)
activesupport (>= 4.0)
multi_json (>= 1.3.2)
grape-path-helpers (1.0.6)
activesupport (>= 4, < 5.1)
grape-path-helpers (1.1.0)
activesupport
grape (~> 1.0)
rake (~> 12)
grape_logging (1.7.0)
......@@ -689,19 +688,19 @@ GEM
rack
rack-proxy (0.6.0)
rack
rack-test (0.6.3)
rack (>= 1.0)
rails (5.0.7.2)
actioncable (= 5.0.7.2)
actionmailer (= 5.0.7.2)
actionpack (= 5.0.7.2)
actionview (= 5.0.7.2)
activejob (= 5.0.7.2)
activemodel (= 5.0.7.2)
activerecord (= 5.0.7.2)
activesupport (= 5.0.7.2)
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (5.1.6.1)
actioncable (= 5.1.6.1)
actionmailer (= 5.1.6.1)
actionpack (= 5.1.6.1)
actionview (= 5.1.6.1)
activejob (= 5.1.6.1)
activemodel (= 5.1.6.1)
activerecord (= 5.1.6.1)
activesupport (= 5.1.6.1)
bundler (>= 1.3.0)
railties (= 5.0.7.2)
railties (= 5.1.6.1)
sprockets-rails (>= 2.0.0)
rails-controller-testing (1.0.2)
actionpack (~> 5.x, >= 5.0.1)
......@@ -715,9 +714,9 @@ GEM
rails-i18n (5.1.1)
i18n (>= 0.7, < 2)
railties (>= 5.0, < 6)
railties (5.0.7.2)
actionpack (= 5.0.7.2)
activesupport (= 5.0.7.2)
railties (5.1.6.1)
actionpack (= 5.1.6.1)
activesupport (= 5.1.6.1)
method_source
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
......@@ -1106,7 +1105,7 @@ DEPENDENCIES
gpgme (~> 2.0.18)
grape (~> 1.1.0)
grape-entity (~> 0.7.1)
grape-path-helpers (~> 1.0)
grape-path-helpers (~> 1.1)
grape_logging (~> 1.7)
graphiql-rails (~> 1.4.10)
graphql (~> 1.8.0)
......@@ -1184,7 +1183,7 @@ DEPENDENCIES
rack-cors (~> 1.0.0)
rack-oauth2 (~> 1.9.3)
rack-proxy (~> 0.6.0)
rails (= 5.0.7.2)
rails (= 5.1.6.1)
rails-controller-testing
rails-i18n (~> 5.1)
rainbow (~> 3.0)
......
......@@ -56,7 +56,7 @@ module Ci
update_project_statistics stat: :build_artifacts_size
after_save :update_file_store, if: :file_changed?
after_save :update_file_store, if: :saved_change_to_file?
scope :with_files_stored_locally, -> { where(file_store: [nil, ::JobArtifactUploader::Store::LOCAL]) }
......
......@@ -230,7 +230,7 @@ module Clusters
end
def update_kubernetes_namespace
return unless namespace_changed?
return unless saved_change_to_namespace?
run_after_commit do
ClusterConfigureWorker.perform_async(cluster_id)
......
......@@ -13,8 +13,8 @@ module Storage
raise Gitlab::UpdatePathError.new("Namespace #{name} (#{id}) cannot be moved because at least one project (e.g. #{proj_with_tags.name} (#{proj_with_tags.id})) has tags in container registry")
end
parent_was = if parent_changed? && parent_id_was.present?
Namespace.find(parent_id_was) # raise NotFound early if needed
parent_was = if parent_changed? && parent_id_before_last_save.present?
Namespace.find(parent_id_before_last_save) # raise NotFound early if needed
end
move_repositories
......
......@@ -61,7 +61,7 @@ class Group < Namespace
after_create :post_create_hook
after_destroy :post_destroy_hook
after_save :update_two_factor_requirement
after_update :path_changed_hook, if: :path_changed?
after_update :path_changed_hook, if: :saved_change_to_path?
class << self
def sort_by_attribute(method)
......@@ -411,7 +411,7 @@ class Group < Namespace
private
def update_two_factor_requirement
return unless require_two_factor_authentication_changed? || two_factor_grace_period_changed?
return unless saved_change_to_require_two_factor_authentication? || saved_change_to_two_factor_grace_period?
users.find_each(&:update_two_factor_requirement)
end
......
......@@ -13,7 +13,7 @@ class LfsObject < ApplicationRecord
mount_uploader :file, LfsObjectUploader
after_save :update_file_store, if: :file_changed?
after_save :update_file_store, if: :saved_change_to_file?
def update_file_store
# The file.object_store is set during `uploader.store!`
......
......@@ -55,7 +55,7 @@ class GroupMember < Member
end
def post_update_hook
if access_level_changed?
if saved_change_to_access_level?
run_after_commit { notification_service.update_group_member(self) }
end
......
......@@ -111,7 +111,7 @@ class ProjectMember < Member
end
def post_update_hook
if access_level_changed?
if saved_change_to_access_level?
run_after_commit { notification_service.update_project_member(self) }
end
......
......@@ -700,7 +700,7 @@ class MergeRequest < ApplicationRecord
end
def reload_diff_if_branch_changed
if (source_branch_changed? || target_branch_changed?) &&
if (saved_change_to_source_branch? || saved_change_to_target_branch?) &&
(source_branch_head && target_branch_head)
reload_diff
end
......
......@@ -50,6 +50,8 @@ class Namespace < ApplicationRecord
validate :nesting_level_allowed
validates_associated :runners
delegate :name, to: :owner, allow_nil: true, prefix: true
delegate :avatar_url, to: :owner, allow_nil: true
......@@ -57,7 +59,7 @@ class Namespace < ApplicationRecord
before_create :sync_share_with_group_lock_with_parent
before_update :sync_share_with_group_lock_with_parent, if: :parent_changed?
after_update :force_share_with_group_lock_on_descendants, if: -> { share_with_group_lock_changed? && share_with_group_lock? }
after_update :force_share_with_group_lock_on_descendants, if: -> { saved_change_to_share_with_group_lock? && share_with_group_lock? }
# Legacy Storage specific hooks
......@@ -292,7 +294,7 @@ class Namespace < ApplicationRecord
private
def path_or_parent_changed?
path_changed? || parent_changed?
saved_change_to_path? || saved_change_to_parent_id?
end
def refresh_access_of_projects_invited_groups
......
......@@ -147,20 +147,20 @@ class PagesDomain < ApplicationRecord
# rubocop: enable CodeReuse/ServiceClass
def pages_config_changed?
project_id_changed? ||
domain_changed? ||
certificate_changed? ||
key_changed? ||
saved_change_to_project_id? ||
saved_change_to_domain? ||
saved_change_to_certificate? ||
saved_change_to_key? ||
became_enabled? ||
became_disabled?
end
def became_enabled?
enabled_until.present? && !enabled_until_was.present?
enabled_until.present? && !enabled_until_before_last_save.present?
end
def became_disabled?
!enabled_until.present? && enabled_until_was.present?
!enabled_until.present? && enabled_until_before_last_save.present?
end
def validate_matching_key
......
......@@ -90,7 +90,7 @@ class Project < ApplicationRecord
before_save :ensure_runners_token
after_save :update_project_statistics, if: :namespace_id_changed?
after_save :update_project_statistics, if: :saved_change_to_namespace_id?
after_save :create_import_state, if: ->(project) { project.import? && project.import_state.nil? }
......@@ -116,7 +116,7 @@ class Project < ApplicationRecord
after_initialize :use_hashed_storage
after_create :check_repository_absence!
after_create :ensure_storage_path_exists
after_save :ensure_storage_path_exists, if: :namespace_id_changed?
after_save :ensure_storage_path_exists, if: :saved_change_to_namespace_id?
acts_as_ordered_taggable
......@@ -1430,7 +1430,7 @@ class Project < ApplicationRecord
# update visibility_level of forks
def update_forks_visibility_level
return unless visibility_level < visibility_level_was
return unless visibility_level < visibility_level_before_last_save
forks.each do |forked_project|
if forked_project.visibility_level > visibility_level
......
......@@ -248,7 +248,7 @@ class RemoteMirror < ApplicationRecord
# Before adding a new remote we have to delete the data from
# the previous remote name
prev_remote_name = remote_name_was || fallback_remote_name
prev_remote_name = remote_name_before_last_save || fallback_remote_name
run_after_commit do
project.repository.async_remove_remote(prev_remote_name)
end
......
......@@ -14,26 +14,26 @@ class Route < ApplicationRecord
before_validation :delete_conflicting_orphaned_routes
after_create :delete_conflicting_redirects
after_update :delete_conflicting_redirects, if: :path_changed?
after_update :delete_conflicting_redirects, if: :saved_change_to_path?
after_update :create_redirect_for_old_path
after_update :rename_descendants
scope :inside_path, -> (path) { where('routes.path LIKE ?', "#{sanitize_sql_like(path)}/%") }
def rename_descendants
return unless path_changed? || name_changed?
return unless saved_change_to_path? || saved_change_to_name?
descendant_routes = self.class.inside_path(path_was)
descendant_routes = self.class.inside_path(path_before_last_save)
descendant_routes.each do |route|
attributes = {}
if path_changed? && route.path.present?
attributes[:path] = route.path.sub(path_was, path)
if saved_change_to_path? && route.path.present?
attributes[:path] = route.path.sub(path_before_last_save, path)
end
if name_changed? && name_was.present? && route.name.present?
attributes[:name] = route.name.sub(name_was, name)
if saved_change_to_name? && name_before_last_save.present? && route.name.present?
attributes[:name] = route.name.sub(name_before_last_save, name)
end
if attributes.present?
......@@ -65,7 +65,7 @@ class Route < ApplicationRecord
private
def create_redirect_for_old_path
create_redirect(path_was) if path_changed?
create_redirect(path_before_last_save) if saved_change_to_path?
end
def delete_conflicting_orphaned_routes
......
......@@ -194,7 +194,7 @@ class User < ApplicationRecord
before_validation :ensure_namespace_correct
before_save :ensure_namespace_correct # in case validation is skipped
after_validation :set_username_errors
after_update :username_changed_hook, if: :username_changed?
after_update :username_changed_hook, if: :saved_change_to_username?
after_destroy :post_destroy_hook
after_destroy :remove_key_cache
after_commit(on: :update) do
......
......@@ -80,7 +80,7 @@ module Projects
value = value.is_a?(Hash) ? value.to_json : value
service_hash[ActiveRecord::Base.connection.quote_column_name(key)] =
ActiveRecord::Base.sanitize(value)
ActiveRecord::Base.connection.quote(value)
end
end
end
......
---
title: Rails 5.1
merge_request: 24852
author: Jasper Maes
type: other
......@@ -198,9 +198,6 @@ module Gitlab
# Version of your assets, change this if you want to expire all your assets
config.assets.version = '1.0'
# Can be removed once upgraded to Rails 5.1 or higher
config.action_controller.raise_on_unfiltered_parameters = true
# Nokogiri is significantly faster and uses less memory than REXML
ActiveSupport::XmlMini.backend = 'Nokogiri'
......
# Remove once https://github.com/rails/rails/pull/32498
# is released on a 5.1.x rails version.
# Commit on 5-1-stable branch: https://github.com/rails/rails/commit/6ef736625eddf6700f2e67f7849c79c92381abee
module ActiveRecord
class AttributeMutationTracker
def changes
attr_names.each_with_object({}.with_indifferent_access) do |attr_name, result|
change = change_to_attribute(attr_name)
if change
result.merge!(attr_name => change)
end
end
end
end
end
# This is a monkey patch which must be removed when migrating to Rails 5.1 from 5.0.
#
# In Rails 5.0 there was introduced a bug which casts types in the uniqueness validator.
# https://github.com/rails/rails/pull/23523/commits/811a4fa8eb6ceea841e61e8ac05747ffb69595ae
#
# That causes to bugs like this:
#
# 1) API::Users POST /user/:id/gpg_keys/:key_id/revoke when authenticated revokes existing key
# Failure/Error: let(:gpg_key) { create(:gpg_key, user: user) }
#
# TypeError:
# can't cast Hash
# # ./spec/requests/api/users_spec.rb:7:in `block (2 levels) in <top (required)>'
# # ./spec/requests/api/users_spec.rb:908:in `block (4 levels) in <top (required)>'
# # ------------------
# # --- Caused by: ---
# # TypeError:
# # TypeError
# # ./spec/requests/api/users_spec.rb:7:in `block (2 levels) in <top (required)>'
#
# This bug was fixed in Rails 5.1 by https://github.com/rails/rails/pull/24745/commits/aa062318c451512035c10898a1af95943b1a3803
if Rails.gem_version >= Gem::Version.new("5.1")
raise "Remove this monkey patch: #{__FILE__}"
end
# Copy-paste from https://github.com/kamipo/rails/blob/aa062318c451512035c10898a1af95943b1a3803/activerecord/lib/active_record/validations/uniqueness.rb
# including local fixes to make Rubocop happy again.
module ActiveRecord
module Validations
class UniquenessValidator < ActiveModel::EachValidator # :nodoc:
def validate_each(record, attribute, value)
finder_class = find_finder_class_for(record)
table = finder_class.arel_table
value = map_enum_attribute(finder_class, attribute, value)
relation = build_relation(finder_class, table, attribute, value)
if record.persisted?
if finder_class.primary_key
relation = relation.where.not(finder_class.primary_key => record.id_was || record.id)
else
raise UnknownPrimaryKey.new(finder_class, "Can not validate uniqueness for persisted record without primary key.")
end
end
relation = scope_relation(record, table, relation)
relation = relation.merge(options[:conditions]) if options[:conditions]
if relation.exists?
error_options = options.except(:case_sensitive, :scope, :conditions)
error_options[:value] = value
record.errors.add(attribute, :taken, error_options)
end
rescue RangeError
end
protected
def build_relation(klass, table, attribute, value) #:nodoc:
if reflection = klass._reflect_on_association(attribute)
attribute = reflection.foreign_key
value = value.attributes[reflection.klass.primary_key] unless value.nil?
end
# the attribute may be an aliased attribute
if klass.attribute_alias?(attribute)
attribute = klass.attribute_alias(attribute)
end
attribute_name = attribute.to_s
column = klass.columns_hash[attribute_name]
cast_type = klass.type_for_attribute(attribute_name)
comparison =
if !options[:case_sensitive] && !value.nil?
# will use SQL LOWER function before comparison, unless it detects a case insensitive collation
klass.connection.case_insensitive_comparison(table, attribute, column, value)
else
klass.connection.case_sensitive_comparison(table, attribute, column, value)
end
if value.nil?
klass.unscoped.where(comparison)
else
bind = Relation::QueryAttribute.new(attribute_name, value, cast_type)
klass.unscoped.where(comparison, bind)
end
end
end
end
end
# rubocop:disable Gitlab/ModuleWithInstanceVariables
# Remove once https://github.com/rails/rails/issues/32867
# is released on a 5.1.x rails version.
# Commit on 5-1-stable branch: https://github.com/rails/rails/commit/44f0df3f3980ba3aeca956839e1948b246ff34fe
module ActiveRecord
module AttributeMethods
module Dirty
def attributes_in_database
mutations_from_database.changed_values
end
end
end
module Persistence
def becomes(klass)
became = klass.new
became.instance_variable_set("@attributes", @attributes)
became.instance_variable_set("@mutation_tracker", @mutation_tracker ||= nil)
became.instance_variable_set("@mutations_from_database", @mutations_from_database ||= nil)
became.instance_variable_set("@changed_attributes", attributes_changed_by_setter)
became.instance_variable_set("@new_record", new_record?)
became.instance_variable_set("@destroyed", destroyed?)
became.errors.copy!(errors)
became
end
end
end
# rubocop:disable Gitlab/ModuleWithInstanceVariables
# build_select only selects the required fields if the model has ignored_columns.
# This is incompatible with some migrations or background migration specs because
# rails keeps a statement cache in memory. So if a model with ignored_columns in a
# migration is used, the query with select table.col1, table.col2 is stored in the
# statement cache. If a different migration is then run and one of these columns is
# removed in the meantime, the query is invalid.
module ActiveRecord
module QueryMethods
private
def build_select(arel)
if select_values.any?
arel.project(*arel_columns(select_values.uniq))
else
arel.project(@klass.arel_table[Arel.star])
end
end
end
end
# rubocop:disable Lint/RescueException
# Remove this monkey patch when we move to Rails 5.1, because the bug has been fixed in https://github.com/rails/rails/pull/26050.
if Rails.gem_version >= Gem::Version.new("5.1")
raise "Remove this monkey patch: #{__FILE__}"
end
module ActiveRecord
module Locking
module Optimistic
# We overwrite this method because we don't want to have default value
# for newly created records
def _create_record(attribute_names = self.attribute_names, *) # :nodoc:
super
end
def _update_record(attribute_names = self.attribute_names) #:nodoc:
return super unless locking_enabled?
return 0 if attribute_names.empty?
lock_col = self.class.locking_column
previous_lock_value = send(lock_col).to_i
increment_lock
attribute_names += [lock_col]
attribute_names.uniq!
begin
relation = self.class.unscoped
affected_rows = relation.where(
self.class.primary_key => id,
# Patched because when `lock_version` is read as `0`, it may actually be `NULL` in the DB.
lock_col => previous_lock_value == 0 ? [nil, 0] : previous_lock_value
).update_all(
attributes_for_update(attribute_names).map do |name|
[name, _read_attribute(name)]
end.to_h
)
unless affected_rows == 1
raise ActiveRecord::StaleObjectError.new(self, "update")
end
affected_rows
# If something went wrong, revert the version.
rescue Exception
send(lock_col + '=', previous_lock_value)
raise
end
end
# This is patched because we need it to query `lock_version IS NULL`
# rather than `lock_version = 0` whenever lock_version is NULL.
def relation_for_destroy
return super unless locking_enabled?
column_name = self.class.locking_column
super.where(self.class.arel_table[column_name].eq(self[column_name]))
end
end
# This is patched because we want `lock_version` default to `NULL`
# rather than `0`
class LockingType
def deserialize(value)
super
end
def serialize(value)
super
end
end
end
end
......@@ -4,7 +4,8 @@ module ActiveRecord
module ConnectionAdapters
class AbstractMysqlAdapter
NATIVE_DATABASE_TYPES.merge!(
bigserial: { name: 'bigint(20) auto_increment PRIMARY KEY' }
bigserial: { name: 'bigint(20) auto_increment PRIMARY KEY' },
serial: { name: 'int auto_increment PRIMARY KEY' }
)
end
end
......
......@@ -78,7 +78,7 @@ module ActiveRecord
if index_name.length > max_index_length
raise ArgumentError, "Index name '#{index_name}' on table '#{table_name}' is too long; the limit is #{max_index_length} characters"
end
if data_source_exists?(table_name) && index_name_exists?(table_name, index_name, false)
if data_source_exists?(table_name) && index_name_exists?(table_name, index_name)
raise ArgumentError, "Index name '#{index_name}' on table '#{table_name}' already exists"
end
index_columns = quoted_columns_for_index(column_names, options).join(", ")
......
......@@ -9,11 +9,11 @@ class AddUniqueIndexToSubscriptions < ActiveRecord::Migration[4.2]
def up
add_concurrent_index :subscriptions, [:subscribable_id, :subscribable_type, :user_id, :project_id], { unique: true, name: 'index_subscriptions_on_subscribable_and_user_id_and_project_id' }
remove_index :subscriptions, name: 'subscriptions_user_id_and_ref_fields' if index_name_exists?(:subscriptions, 'subscriptions_user_id_and_ref_fields', false)
remove_index :subscriptions, name: 'subscriptions_user_id_and_ref_fields' if index_name_exists?(:subscriptions, 'subscriptions_user_id_and_ref_fields')
end
def down
add_concurrent_index :subscriptions, [:subscribable_id, :subscribable_type, :user_id], { unique: true, name: 'subscriptions_user_id_and_ref_fields' }
remove_index :subscriptions, name: 'index_subscriptions_on_subscribable_and_user_id_and_project_id' if index_name_exists?(:subscriptions, 'index_subscriptions_on_subscribable_and_user_id_and_project_id', false)
remove_index :subscriptions, name: 'index_subscriptions_on_subscribable_and_user_id_and_project_id' if index_name_exists?(:subscriptions, 'index_subscriptions_on_subscribable_and_user_id_and_project_id')
end
end
......@@ -16,7 +16,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
enable_extension "plpgsql"
enable_extension "pg_trgm"
create_table "abuse_reports", force: :cascade do |t|
create_table "abuse_reports", id: :serial, force: :cascade do |t|
t.integer "reporter_id"
t.integer "user_id"
t.text "message"
......@@ -26,7 +26,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.integer "cached_markdown_version"
end
create_table "appearances", force: :cascade do |t|
create_table "appearances", id: :serial, force: :cascade do |t|
t.string "title", null: false
t.text "description", null: false
t.string "logo"
......@@ -48,13 +48,13 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.boolean "email_header_and_footer_enabled", default: false, null: false
end
create_table "application_setting_terms", force: :cascade do |t|
create_table "application_setting_terms", id: :serial, force: :cascade do |t|
t.integer "cached_markdown_version"
t.text "terms", null: false
t.text "terms_html"
end
create_table "application_settings", force: :cascade do |t|
create_table "application_settings", id: :serial, force: :cascade do |t|
t.integer "default_projects_limit"
t.boolean "signup_enabled"
t.boolean "gravatar_enabled"
......@@ -224,14 +224,14 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["usage_stats_set_by_user_id"], name: "index_application_settings_on_usage_stats_set_by_user_id", using: :btree
end
create_table "approval_merge_request_rule_sources", id: :bigserial, force: :cascade do |t|
create_table "approval_merge_request_rule_sources", force: :cascade do |t|
t.bigint "approval_merge_request_rule_id", null: false
t.bigint "approval_project_rule_id", null: false
t.index ["approval_merge_request_rule_id"], name: "index_approval_merge_request_rule_sources_1", unique: true, using: :btree
t.index ["approval_project_rule_id"], name: "index_approval_merge_request_rule_sources_2", using: :btree
end
create_table "approval_merge_request_rules", id: :bigserial, force: :cascade do |t|
create_table "approval_merge_request_rules", force: :cascade do |t|
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
t.integer "merge_request_id", null: false
......@@ -242,28 +242,28 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["merge_request_id", "code_owner"], name: "index_approval_merge_request_rules_1", using: :btree
end
create_table "approval_merge_request_rules_approved_approvers", id: :bigserial, force: :cascade do |t|
create_table "approval_merge_request_rules_approved_approvers", force: :cascade do |t|
t.bigint "approval_merge_request_rule_id", null: false
t.integer "user_id", null: false
t.index ["approval_merge_request_rule_id", "user_id"], name: "index_approval_merge_request_rules_approved_approvers_1", unique: true, using: :btree
t.index ["user_id"], name: "index_approval_merge_request_rules_approved_approvers_2", using: :btree
end
create_table "approval_merge_request_rules_groups", id: :bigserial, force: :cascade do |t|
create_table "approval_merge_request_rules_groups", force: :cascade do |t|
t.bigint "approval_merge_request_rule_id", null: false
t.integer "group_id", null: false
t.index ["approval_merge_request_rule_id", "group_id"], name: "index_approval_merge_request_rules_groups_1", unique: true, using: :btree
t.index ["group_id"], name: "index_approval_merge_request_rules_groups_2", using: :btree
end
create_table "approval_merge_request_rules_users", id: :bigserial, force: :cascade do |t|
create_table "approval_merge_request_rules_users", force: :cascade do |t|
t.bigint "approval_merge_request_rule_id", null: false
t.integer "user_id", null: false
t.index ["approval_merge_request_rule_id", "user_id"], name: "index_approval_merge_request_rules_users_1", unique: true, using: :btree
t.index ["user_id"], name: "index_approval_merge_request_rules_users_2", using: :btree
end
create_table "approval_project_rules", id: :bigserial, force: :cascade do |t|
create_table "approval_project_rules", force: :cascade do |t|
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
t.integer "project_id", null: false
......@@ -272,21 +272,21 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["project_id"], name: "index_approval_project_rules_on_project_id", using: :btree
end
create_table "approval_project_rules_groups", id: :bigserial, force: :cascade do |t|
create_table "approval_project_rules_groups", force: :cascade do |t|
t.bigint "approval_project_rule_id", null: false
t.integer "group_id", null: false
t.index ["approval_project_rule_id", "group_id"], name: "index_approval_project_rules_groups_1", unique: true, using: :btree
t.index ["group_id"], name: "index_approval_project_rules_groups_2", using: :btree
end
create_table "approval_project_rules_users", id: :bigserial, force: :cascade do |t|
create_table "approval_project_rules_users", force: :cascade do |t|
t.bigint "approval_project_rule_id", null: false
t.integer "user_id", null: false
t.index ["approval_project_rule_id", "user_id"], name: "index_approval_project_rules_users_1", unique: true, using: :btree
t.index ["user_id"], name: "index_approval_project_rules_users_2", using: :btree
end
create_table "approvals", force: :cascade do |t|
create_table "approvals", id: :serial, force: :cascade do |t|
t.integer "merge_request_id", null: false
t.integer "user_id", null: false
t.datetime "created_at"
......@@ -294,7 +294,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["merge_request_id"], name: "index_approvals_on_merge_request_id", using: :btree
end
create_table "approver_groups", force: :cascade do |t|
create_table "approver_groups", id: :serial, force: :cascade do |t|
t.integer "target_id", null: false
t.string "target_type", null: false
t.integer "group_id", null: false
......@@ -304,7 +304,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["target_id", "target_type"], name: "index_approver_groups_on_target_id_and_target_type", using: :btree
end
create_table "approvers", force: :cascade do |t|
create_table "approvers", id: :serial, force: :cascade do |t|
t.integer "target_id", null: false
t.string "target_type"
t.integer "user_id", null: false
......@@ -314,7 +314,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["user_id"], name: "index_approvers_on_user_id", using: :btree
end
create_table "audit_events", force: :cascade do |t|
create_table "audit_events", id: :serial, force: :cascade do |t|
t.integer "author_id", null: false
t.string "type", null: false
t.integer "entity_id", null: false
......@@ -325,7 +325,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["entity_id", "entity_type"], name: "index_audit_events_on_entity_id_and_entity_type", using: :btree
end
create_table "award_emoji", force: :cascade do |t|
create_table "award_emoji", id: :serial, force: :cascade do |t|
t.string "name"
t.integer "user_id"
t.integer "awardable_id"
......@@ -336,7 +336,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["user_id", "name"], name: "index_award_emoji_on_user_id_and_name", using: :btree
end
create_table "badges", force: :cascade do |t|
create_table "badges", id: :serial, force: :cascade do |t|
t.string "link_url", null: false
t.string "image_url", null: false
t.integer "project_id"
......@@ -348,14 +348,14 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["project_id"], name: "index_badges_on_project_id", using: :btree
end
create_table "board_assignees", force: :cascade do |t|
create_table "board_assignees", id: :serial, force: :cascade do |t|
t.integer "board_id", null: false
t.integer "assignee_id", null: false
t.index ["assignee_id"], name: "index_board_assignees_on_assignee_id", using: :btree
t.index ["board_id", "assignee_id"], name: "index_board_assignees_on_board_id_and_assignee_id", unique: true, using: :btree
end
create_table "board_group_recent_visits", id: :bigserial, force: :cascade do |t|
create_table "board_group_recent_visits", force: :cascade do |t|
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
t.integer "user_id"
......@@ -367,14 +367,14 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["user_id"], name: "index_board_group_recent_visits_on_user_id", using: :btree
end
create_table "board_labels", force: :cascade do |t|
create_table "board_labels", id: :serial, force: :cascade do |t|
t.integer "board_id", null: false
t.integer "label_id", null: false
t.index ["board_id", "label_id"], name: "index_board_labels_on_board_id_and_label_id", unique: true, using: :btree
t.index ["label_id"], name: "index_board_labels_on_label_id", using: :btree
end
create_table "board_project_recent_visits", id: :bigserial, force: :cascade do |t|
create_table "board_project_recent_visits", force: :cascade do |t|
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
t.integer "user_id"
......@@ -386,7 +386,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["user_id"], name: "index_board_project_recent_visits_on_user_id", using: :btree
end
create_table "boards", force: :cascade do |t|
create_table "boards", id: :serial, force: :cascade do |t|
t.integer "project_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
......@@ -399,7 +399,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["project_id"], name: "index_boards_on_project_id", using: :btree
end
create_table "broadcast_messages", force: :cascade do |t|
create_table "broadcast_messages", id: :serial, force: :cascade do |t|
t.text "message", null: false
t.datetime "starts_at", null: false
t.datetime "ends_at", null: false
......@@ -412,7 +412,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["starts_at", "ends_at", "id"], name: "index_broadcast_messages_on_starts_at_and_ends_at_and_id", using: :btree
end
create_table "chat_names", force: :cascade do |t|
create_table "chat_names", id: :serial, force: :cascade do |t|
t.integer "user_id", null: false
t.integer "service_id", null: false
t.string "team_id", null: false
......@@ -426,7 +426,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["user_id", "service_id"], name: "index_chat_names_on_user_id_and_service_id", unique: true, using: :btree
end
create_table "chat_teams", force: :cascade do |t|
create_table "chat_teams", id: :serial, force: :cascade do |t|
t.integer "namespace_id", null: false
t.string "team_id"
t.string "name"
......@@ -435,7 +435,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["namespace_id"], name: "index_chat_teams_on_namespace_id", unique: true, using: :btree
end
create_table "ci_build_trace_chunks", id: :bigserial, force: :cascade do |t|
create_table "ci_build_trace_chunks", force: :cascade do |t|
t.integer "build_id", null: false
t.integer "chunk_index", null: false
t.integer "data_store", null: false
......@@ -443,13 +443,13 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["build_id", "chunk_index"], name: "index_ci_build_trace_chunks_on_build_id_and_chunk_index", unique: true, using: :btree
end
create_table "ci_build_trace_section_names", force: :cascade do |t|
create_table "ci_build_trace_section_names", id: :serial, force: :cascade do |t|
t.integer "project_id", null: false
t.string "name", null: false
t.index ["project_id", "name"], name: "index_ci_build_trace_section_names_on_project_id_and_name", unique: true, using: :btree
end
create_table "ci_build_trace_sections", force: :cascade do |t|
create_table "ci_build_trace_sections", id: :serial, force: :cascade do |t|
t.integer "project_id", null: false
t.datetime "date_start", null: false
t.datetime "date_end", null: false
......@@ -462,7 +462,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["section_name_id"], name: "index_ci_build_trace_sections_on_section_name_id", using: :btree
end
create_table "ci_builds", force: :cascade do |t|
create_table "ci_builds", id: :serial, force: :cascade do |t|
t.string "status"
t.datetime "finished_at"
t.text "trace"
......@@ -530,7 +530,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["user_id"], name: "index_ci_builds_on_user_id", using: :btree
end
create_table "ci_builds_metadata", force: :cascade do |t|
create_table "ci_builds_metadata", id: :serial, force: :cascade do |t|
t.integer "build_id", null: false
t.integer "project_id", null: false
t.integer "timeout"
......@@ -541,7 +541,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["project_id"], name: "index_ci_builds_metadata_on_project_id", using: :btree
end
create_table "ci_builds_runner_session", id: :bigserial, force: :cascade do |t|
create_table "ci_builds_runner_session", force: :cascade do |t|
t.integer "build_id", null: false
t.string "url", null: false
t.string "certificate"
......@@ -549,7 +549,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["build_id"], name: "index_ci_builds_runner_session_on_build_id", unique: true, using: :btree
end
create_table "ci_group_variables", force: :cascade do |t|
create_table "ci_group_variables", id: :serial, force: :cascade do |t|
t.string "key", null: false
t.text "value"
t.text "encrypted_value"
......@@ -563,7 +563,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["group_id", "key"], name: "index_ci_group_variables_on_group_id_and_key", unique: true, using: :btree
end
create_table "ci_job_artifacts", force: :cascade do |t|
create_table "ci_job_artifacts", id: :serial, force: :cascade do |t|
t.integer "project_id", null: false
t.integer "job_id", null: false
t.integer "file_type", null: false
......@@ -582,7 +582,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["project_id"], name: "index_ci_job_artifacts_on_project_id", using: :btree
end
create_table "ci_pipeline_chat_data", id: :bigserial, force: :cascade do |t|
create_table "ci_pipeline_chat_data", force: :cascade do |t|
t.integer "pipeline_id", null: false
t.integer "chat_name_id", null: false
t.text "response_url", null: false
......@@ -590,7 +590,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["pipeline_id"], name: "index_ci_pipeline_chat_data_on_pipeline_id", unique: true, using: :btree
end
create_table "ci_pipeline_schedule_variables", force: :cascade do |t|
create_table "ci_pipeline_schedule_variables", id: :serial, force: :cascade do |t|
t.string "key", null: false
t.text "value"
t.text "encrypted_value"
......@@ -602,7 +602,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["pipeline_schedule_id", "key"], name: "index_ci_pipeline_schedule_variables_on_schedule_id_and_key", unique: true, using: :btree
end
create_table "ci_pipeline_schedules", force: :cascade do |t|
create_table "ci_pipeline_schedules", id: :serial, force: :cascade do |t|
t.string "description"
t.string "ref"
t.string "cron"
......@@ -618,7 +618,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["project_id"], name: "index_ci_pipeline_schedules_on_project_id", using: :btree
end
create_table "ci_pipeline_variables", force: :cascade do |t|
create_table "ci_pipeline_variables", id: :serial, force: :cascade do |t|
t.string "key", null: false
t.text "value"
t.text "encrypted_value"
......@@ -628,7 +628,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["pipeline_id", "key"], name: "index_ci_pipeline_variables_on_pipeline_id_and_key", unique: true, using: :btree
end
create_table "ci_pipelines", force: :cascade do |t|
create_table "ci_pipelines", id: :serial, force: :cascade do |t|
t.string "ref"
t.string "sha"
t.string "before_sha"
......@@ -668,14 +668,14 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["user_id"], name: "index_ci_pipelines_on_user_id", using: :btree
end
create_table "ci_runner_namespaces", force: :cascade do |t|
create_table "ci_runner_namespaces", id: :serial, force: :cascade do |t|
t.integer "runner_id"
t.integer "namespace_id"
t.index ["namespace_id"], name: "index_ci_runner_namespaces_on_namespace_id", using: :btree
t.index ["runner_id", "namespace_id"], name: "index_ci_runner_namespaces_on_runner_id_and_namespace_id", unique: true, using: :btree
end
create_table "ci_runner_projects", force: :cascade do |t|
create_table "ci_runner_projects", id: :serial, force: :cascade do |t|
t.integer "runner_id", null: false
t.datetime "created_at"
t.datetime "updated_at"
......@@ -684,7 +684,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["runner_id"], name: "index_ci_runner_projects_on_runner_id", using: :btree
end
create_table "ci_runners", force: :cascade do |t|
create_table "ci_runners", id: :serial, force: :cascade do |t|
t.string "token"
t.datetime "created_at"
t.datetime "updated_at"
......@@ -712,7 +712,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["token_encrypted"], name: "index_ci_runners_on_token_encrypted", using: :btree
end
create_table "ci_sources_pipelines", force: :cascade do |t|
create_table "ci_sources_pipelines", id: :serial, force: :cascade do |t|
t.integer "project_id"
t.integer "pipeline_id"
t.integer "source_project_id"
......@@ -725,7 +725,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["source_project_id"], name: "index_ci_sources_pipelines_on_source_project_id", using: :btree
end
create_table "ci_stages", force: :cascade do |t|
create_table "ci_stages", id: :serial, force: :cascade do |t|
t.integer "project_id"
t.integer "pipeline_id"
t.datetime "created_at"
......@@ -740,7 +740,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["project_id"], name: "index_ci_stages_on_project_id", using: :btree
end
create_table "ci_trigger_requests", force: :cascade do |t|
create_table "ci_trigger_requests", id: :serial, force: :cascade do |t|
t.integer "trigger_id", null: false
t.text "variables"
t.datetime "created_at"
......@@ -750,7 +750,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["trigger_id"], name: "index_ci_trigger_requests_on_trigger_id", using: :btree
end
create_table "ci_triggers", force: :cascade do |t|
create_table "ci_triggers", id: :serial, force: :cascade do |t|
t.string "token"
t.datetime "created_at"
t.datetime "updated_at"
......@@ -762,7 +762,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["project_id"], name: "index_ci_triggers_on_project_id", using: :btree
end
create_table "ci_variables", force: :cascade do |t|
create_table "ci_variables", id: :serial, force: :cascade do |t|
t.string "key", null: false
t.text "value"
t.text "encrypted_value"
......@@ -775,14 +775,14 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["project_id", "key", "environment_scope"], name: "index_ci_variables_on_project_id_and_key_and_environment_scope", unique: true, using: :btree
end
create_table "cluster_groups", force: :cascade do |t|
create_table "cluster_groups", id: :serial, force: :cascade do |t|
t.integer "cluster_id", null: false
t.integer "group_id", null: false
t.index ["cluster_id", "group_id"], name: "index_cluster_groups_on_cluster_id_and_group_id", unique: true, using: :btree
t.index ["group_id"], name: "index_cluster_groups_on_group_id", using: :btree
end
create_table "cluster_platforms_kubernetes", force: :cascade do |t|
create_table "cluster_platforms_kubernetes", id: :serial, force: :cascade do |t|
t.integer "cluster_id", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
......@@ -798,7 +798,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["cluster_id"], name: "index_cluster_platforms_kubernetes_on_cluster_id", unique: true, using: :btree
end
create_table "cluster_projects", force: :cascade do |t|
create_table "cluster_projects", id: :serial, force: :cascade do |t|
t.integer "project_id", null: false
t.integer "cluster_id", null: false
t.datetime "created_at", null: false
......@@ -807,7 +807,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["project_id"], name: "index_cluster_projects_on_project_id", using: :btree
end
create_table "cluster_providers_gcp", force: :cascade do |t|
create_table "cluster_providers_gcp", id: :serial, force: :cascade do |t|
t.integer "cluster_id", null: false
t.integer "status"
t.integer "num_nodes", null: false
......@@ -825,7 +825,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["cluster_id"], name: "index_cluster_providers_gcp_on_cluster_id", unique: true, using: :btree
end
create_table "clusters", force: :cascade do |t|
create_table "clusters", id: :serial, force: :cascade do |t|
t.integer "user_id"
t.integer "provider_type"
t.integer "platform_type"
......@@ -841,7 +841,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["user_id"], name: "index_clusters_on_user_id", using: :btree
end
create_table "clusters_applications_cert_managers", force: :cascade do |t|
create_table "clusters_applications_cert_managers", id: :serial, force: :cascade do |t|
t.integer "cluster_id", null: false
t.integer "status", null: false
t.string "version", null: false
......@@ -852,7 +852,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["cluster_id"], name: "index_clusters_applications_cert_managers_on_cluster_id", unique: true, using: :btree
end
create_table "clusters_applications_helm", force: :cascade do |t|
create_table "clusters_applications_helm", id: :serial, force: :cascade do |t|
t.integer "cluster_id", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
......@@ -865,7 +865,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["cluster_id"], name: "index_clusters_applications_helm_on_cluster_id", unique: true, using: :btree
end
create_table "clusters_applications_ingress", force: :cascade do |t|
create_table "clusters_applications_ingress", id: :serial, force: :cascade do |t|
t.integer "cluster_id", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
......@@ -879,7 +879,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["cluster_id"], name: "index_clusters_applications_ingress_on_cluster_id", unique: true, using: :btree
end
create_table "clusters_applications_jupyter", force: :cascade do |t|
create_table "clusters_applications_jupyter", id: :serial, force: :cascade do |t|
t.integer "cluster_id", null: false
t.integer "oauth_application_id"
t.integer "status", null: false
......@@ -892,7 +892,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["oauth_application_id"], name: "index_clusters_applications_jupyter_on_oauth_application_id", using: :btree
end
create_table "clusters_applications_knative", force: :cascade do |t|
create_table "clusters_applications_knative", id: :serial, force: :cascade do |t|
t.integer "cluster_id", null: false
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
......@@ -905,7 +905,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["cluster_id"], name: "index_clusters_applications_knative_on_cluster_id", unique: true, using: :btree
end
create_table "clusters_applications_prometheus", force: :cascade do |t|
create_table "clusters_applications_prometheus", id: :serial, force: :cascade do |t|
t.integer "cluster_id", null: false
t.integer "status", null: false
t.string "version", null: false
......@@ -918,7 +918,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["cluster_id"], name: "index_clusters_applications_prometheus_on_cluster_id", unique: true, using: :btree
end
create_table "clusters_applications_runners", force: :cascade do |t|
create_table "clusters_applications_runners", id: :serial, force: :cascade do |t|
t.integer "cluster_id", null: false
t.integer "runner_id"
t.integer "status", null: false
......@@ -931,7 +931,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["runner_id"], name: "index_clusters_applications_runners_on_runner_id", using: :btree
end
create_table "clusters_kubernetes_namespaces", id: :bigserial, force: :cascade do |t|
create_table "clusters_kubernetes_namespaces", force: :cascade do |t|
t.integer "cluster_id", null: false
t.integer "project_id"
t.integer "cluster_project_id"
......@@ -947,7 +947,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["project_id"], name: "index_clusters_kubernetes_namespaces_on_project_id", using: :btree
end
create_table "container_repositories", force: :cascade do |t|
create_table "container_repositories", id: :serial, force: :cascade do |t|
t.integer "project_id", null: false
t.string "name", null: false
t.datetime "created_at", null: false
......@@ -956,7 +956,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["project_id"], name: "index_container_repositories_on_project_id", using: :btree
end
create_table "conversational_development_index_metrics", force: :cascade do |t|
create_table "conversational_development_index_metrics", id: :serial, force: :cascade do |t|
t.float "leader_issues", null: false
t.float "instance_issues", null: false
t.float "leader_notes", null: false
......@@ -991,7 +991,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.float "percentage_service_desk_issues", default: 0.0, null: false
end
create_table "dependency_proxy_blobs", force: :cascade do |t|
create_table "dependency_proxy_blobs", id: :serial, force: :cascade do |t|
t.integer "group_id", null: false
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
......@@ -1002,7 +1002,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["group_id", "file_name"], name: "index_dependency_proxy_blobs_on_group_id_and_file_name", using: :btree
end
create_table "dependency_proxy_group_settings", force: :cascade do |t|
create_table "dependency_proxy_group_settings", id: :serial, force: :cascade do |t|
t.integer "group_id", null: false
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
......@@ -1010,7 +1010,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["group_id"], name: "index_dependency_proxy_group_settings_on_group_id", using: :btree
end
create_table "deploy_keys_projects", force: :cascade do |t|
create_table "deploy_keys_projects", id: :serial, force: :cascade do |t|
t.integer "deploy_key_id", null: false
t.integer "project_id", null: false
t.datetime "created_at"
......@@ -1019,7 +1019,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["project_id"], name: "index_deploy_keys_projects_on_project_id", using: :btree
end
create_table "deploy_tokens", force: :cascade do |t|
create_table "deploy_tokens", id: :serial, force: :cascade do |t|
t.boolean "revoked", default: false
t.boolean "read_repository", default: false, null: false
t.boolean "read_registry", default: false, null: false
......@@ -1031,7 +1031,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["token"], name: "index_deploy_tokens_on_token", unique: true, using: :btree
end
create_table "deployments", force: :cascade do |t|
create_table "deployments", id: :serial, force: :cascade do |t|
t.integer "iid", null: false
t.integer "project_id", null: false
t.integer "environment_id", null: false
......@@ -1057,7 +1057,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["project_id", "status"], name: "index_deployments_on_project_id_and_status", using: :btree
end
create_table "design_management_designs", id: :bigserial, force: :cascade do |t|
create_table "design_management_designs", force: :cascade do |t|
t.integer "project_id", null: false
t.integer "issue_id", null: false
t.string "filename", null: false
......@@ -1073,12 +1073,12 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["version_id"], name: "index_design_management_designs_versions_on_version_id", using: :btree
end
create_table "design_management_versions", id: :bigserial, force: :cascade do |t|
create_table "design_management_versions", force: :cascade do |t|
t.binary "sha", null: false
t.index ["sha"], name: "index_design_management_versions_on_sha", unique: true, using: :btree
end
create_table "draft_notes", id: :bigserial, force: :cascade do |t|
create_table "draft_notes", force: :cascade do |t|
t.integer "merge_request_id", null: false
t.integer "author_id", null: false
t.boolean "resolve_discussion", default: false, null: false
......@@ -1106,7 +1106,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["project_id"], name: "index_elasticsearch_indexed_projects_on_project_id", unique: true, using: :btree
end
create_table "emails", force: :cascade do |t|
create_table "emails", id: :serial, force: :cascade do |t|
t.integer "user_id", null: false
t.string "email", null: false
t.datetime "created_at"
......@@ -1119,7 +1119,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["user_id"], name: "index_emails_on_user_id", using: :btree
end
create_table "environments", force: :cascade do |t|
create_table "environments", id: :serial, force: :cascade do |t|
t.integer "project_id", null: false
t.string "name", null: false
t.datetime "created_at"
......@@ -1133,7 +1133,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["project_id", "slug"], name: "index_environments_on_project_id_and_slug", unique: true, using: :btree
end
create_table "epic_issues", force: :cascade do |t|
create_table "epic_issues", id: :serial, force: :cascade do |t|
t.integer "epic_id", null: false
t.integer "issue_id", null: false
t.integer "relative_position", default: 1073741823, null: false
......@@ -1141,14 +1141,14 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["issue_id"], name: "index_epic_issues_on_issue_id", unique: true, using: :btree
end
create_table "epic_metrics", force: :cascade do |t|
create_table "epic_metrics", id: :serial, force: :cascade do |t|
t.integer "epic_id", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["epic_id"], name: "index_epic_metrics", using: :btree
end
create_table "epics", force: :cascade do |t|
create_table "epics", id: :serial, force: :cascade do |t|
t.integer "milestone_id"
t.integer "group_id", null: false
t.integer "author_id", null: false
......@@ -1189,7 +1189,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["start_date"], name: "index_epics_on_start_date", using: :btree
end
create_table "events", force: :cascade do |t|
create_table "events", id: :serial, force: :cascade do |t|
t.integer "project_id"
t.integer "author_id", null: false
t.integer "target_id"
......@@ -1204,7 +1204,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["target_type", "target_id"], name: "index_events_on_target_type_and_target_id", using: :btree
end
create_table "feature_gates", force: :cascade do |t|
create_table "feature_gates", id: :serial, force: :cascade do |t|
t.string "feature_key", null: false
t.string "key", null: false
t.string "value"
......@@ -1213,14 +1213,14 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["feature_key", "key", "value"], name: "index_feature_gates_on_feature_key_and_key_and_value", unique: true, using: :btree
end
create_table "features", force: :cascade do |t|
create_table "features", id: :serial, force: :cascade do |t|
t.string "key", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["key"], name: "index_features_on_key", unique: true, using: :btree
end
create_table "fork_network_members", force: :cascade do |t|
create_table "fork_network_members", id: :serial, force: :cascade do |t|
t.integer "fork_network_id", null: false
t.integer "project_id", null: false
t.integer "forked_from_project_id"
......@@ -1229,13 +1229,13 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["project_id"], name: "index_fork_network_members_on_project_id", unique: true, using: :btree
end
create_table "fork_networks", force: :cascade do |t|
create_table "fork_networks", id: :serial, force: :cascade do |t|
t.integer "root_project_id"
t.string "deleted_root_project_name"
t.index ["root_project_id"], name: "index_fork_networks_on_root_project_id", unique: true, using: :btree
end
create_table "forked_project_links", force: :cascade do |t|
create_table "forked_project_links", id: :serial, force: :cascade do |t|
t.integer "forked_to_project_id", null: false
t.integer "forked_from_project_id", null: false
t.datetime "created_at"
......@@ -1243,11 +1243,11 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["forked_to_project_id"], name: "index_forked_project_links_on_forked_to_project_id", unique: true, using: :btree
end
create_table "geo_cache_invalidation_events", id: :bigserial, force: :cascade do |t|
create_table "geo_cache_invalidation_events", force: :cascade do |t|
t.string "key", null: false
end
create_table "geo_event_log", id: :bigserial, force: :cascade do |t|
create_table "geo_event_log", force: :cascade do |t|
t.datetime "created_at", null: false
t.bigint "repository_updated_event_id"
t.bigint "repository_deleted_event_id"
......@@ -1275,14 +1275,14 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["upload_deleted_event_id"], name: "index_geo_event_log_on_upload_deleted_event_id", where: "(upload_deleted_event_id IS NOT NULL)", using: :btree
end
create_table "geo_hashed_storage_attachments_events", id: :bigserial, force: :cascade do |t|
create_table "geo_hashed_storage_attachments_events", force: :cascade do |t|
t.integer "project_id", null: false
t.text "old_attachments_path", null: false
t.text "new_attachments_path", null: false
t.index ["project_id"], name: "index_geo_hashed_storage_attachments_events_on_project_id", using: :btree
end
create_table "geo_hashed_storage_migrated_events", id: :bigserial, force: :cascade do |t|
create_table "geo_hashed_storage_migrated_events", force: :cascade do |t|
t.integer "project_id", null: false
t.text "repository_storage_name", null: false
t.text "old_disk_path", null: false
......@@ -1294,20 +1294,20 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["project_id"], name: "index_geo_hashed_storage_migrated_events_on_project_id", using: :btree
end
create_table "geo_job_artifact_deleted_events", id: :bigserial, force: :cascade do |t|
create_table "geo_job_artifact_deleted_events", force: :cascade do |t|
t.integer "job_artifact_id", null: false
t.string "file_path", null: false
t.index ["job_artifact_id"], name: "index_geo_job_artifact_deleted_events_on_job_artifact_id", using: :btree
end
create_table "geo_lfs_object_deleted_events", id: :bigserial, force: :cascade do |t|
create_table "geo_lfs_object_deleted_events", force: :cascade do |t|
t.integer "lfs_object_id", null: false
t.string "oid", null: false
t.string "file_path", null: false
t.index ["lfs_object_id"], name: "index_geo_lfs_object_deleted_events_on_lfs_object_id", using: :btree
end
create_table "geo_node_namespace_links", force: :cascade do |t|
create_table "geo_node_namespace_links", id: :serial, force: :cascade do |t|
t.integer "geo_node_id", null: false
t.integer "namespace_id", null: false
t.datetime "created_at", null: false
......@@ -1317,7 +1317,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["namespace_id"], name: "index_geo_node_namespace_links_on_namespace_id", using: :btree
end
create_table "geo_node_statuses", force: :cascade do |t|
create_table "geo_node_statuses", id: :serial, force: :cascade do |t|
t.integer "geo_node_id", null: false
t.integer "db_replication_lag_seconds"
t.integer "repositories_synced_count"
......@@ -1366,7 +1366,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["geo_node_id"], name: "index_geo_node_statuses_on_geo_node_id", unique: true, using: :btree
end
create_table "geo_nodes", force: :cascade do |t|
create_table "geo_nodes", id: :serial, force: :cascade do |t|
t.boolean "primary"
t.integer "oauth_application_id"
t.boolean "enabled", default: true, null: false
......@@ -1387,12 +1387,12 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["url"], name: "index_geo_nodes_on_url", unique: true, using: :btree
end
create_table "geo_repositories_changed_events", id: :bigserial, force: :cascade do |t|
create_table "geo_repositories_changed_events", force: :cascade do |t|
t.integer "geo_node_id", null: false
t.index ["geo_node_id"], name: "index_geo_repositories_changed_events_on_geo_node_id", using: :btree
end
create_table "geo_repository_created_events", id: :bigserial, force: :cascade do |t|
create_table "geo_repository_created_events", force: :cascade do |t|
t.integer "project_id", null: false
t.text "repository_storage_name", null: false
t.text "repo_path", null: false
......@@ -1401,7 +1401,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["project_id"], name: "index_geo_repository_created_events_on_project_id", using: :btree
end
create_table "geo_repository_deleted_events", id: :bigserial, force: :cascade do |t|
create_table "geo_repository_deleted_events", force: :cascade do |t|
t.integer "project_id", null: false
t.text "repository_storage_name", null: false
t.text "deleted_path", null: false
......@@ -1410,7 +1410,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["project_id"], name: "index_geo_repository_deleted_events_on_project_id", using: :btree
end
create_table "geo_repository_renamed_events", id: :bigserial, force: :cascade do |t|
create_table "geo_repository_renamed_events", force: :cascade do |t|
t.integer "project_id", null: false
t.text "repository_storage_name", null: false
t.text "old_path_with_namespace", null: false
......@@ -1422,7 +1422,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["project_id"], name: "index_geo_repository_renamed_events_on_project_id", using: :btree
end
create_table "geo_repository_updated_events", id: :bigserial, force: :cascade do |t|
create_table "geo_repository_updated_events", force: :cascade do |t|
t.integer "branches_affected", null: false
t.integer "tags_affected", null: false
t.integer "project_id", null: false
......@@ -1434,12 +1434,12 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["source"], name: "index_geo_repository_updated_events_on_source", using: :btree
end
create_table "geo_reset_checksum_events", id: :bigserial, force: :cascade do |t|
create_table "geo_reset_checksum_events", force: :cascade do |t|
t.integer "project_id", null: false
t.index ["project_id"], name: "index_geo_reset_checksum_events_on_project_id", using: :btree
end
create_table "geo_upload_deleted_events", id: :bigserial, force: :cascade do |t|
create_table "geo_upload_deleted_events", force: :cascade do |t|
t.integer "upload_id", null: false
t.string "file_path", null: false
t.integer "model_id", null: false
......@@ -1448,7 +1448,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["upload_id"], name: "index_geo_upload_deleted_events_on_upload_id", using: :btree
end
create_table "gitlab_subscriptions", id: :bigserial, force: :cascade do |t|
create_table "gitlab_subscriptions", force: :cascade do |t|
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
t.date "start_date"
......@@ -1463,7 +1463,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["namespace_id"], name: "index_gitlab_subscriptions_on_namespace_id", unique: true, using: :btree
end
create_table "gpg_key_subkeys", force: :cascade do |t|
create_table "gpg_key_subkeys", id: :serial, force: :cascade do |t|
t.integer "gpg_key_id", null: false
t.binary "keyid"
t.binary "fingerprint"
......@@ -1472,7 +1472,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["keyid"], name: "index_gpg_key_subkeys_on_keyid", unique: true, using: :btree
end
create_table "gpg_keys", force: :cascade do |t|
create_table "gpg_keys", id: :serial, force: :cascade do |t|
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
t.integer "user_id"
......@@ -1484,7 +1484,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["user_id"], name: "index_gpg_keys_on_user_id", using: :btree
end
create_table "gpg_signatures", force: :cascade do |t|
create_table "gpg_signatures", id: :serial, force: :cascade do |t|
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
t.integer "project_id"
......@@ -1502,7 +1502,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["project_id"], name: "index_gpg_signatures_on_project_id", using: :btree
end
create_table "group_custom_attributes", force: :cascade do |t|
create_table "group_custom_attributes", id: :serial, force: :cascade do |t|
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
t.integer "group_id", null: false
......@@ -1512,14 +1512,14 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["key", "value"], name: "index_group_custom_attributes_on_key_and_value", using: :btree
end
create_table "historical_data", force: :cascade do |t|
create_table "historical_data", id: :serial, force: :cascade do |t|
t.date "date", null: false
t.integer "active_user_count"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "identities", force: :cascade do |t|
create_table "identities", id: :serial, force: :cascade do |t|
t.string "extern_uid"
t.string "provider"
t.integer "user_id"
......@@ -1531,7 +1531,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["user_id"], name: "index_identities_on_user_id", using: :btree
end
create_table "import_export_uploads", force: :cascade do |t|
create_table "import_export_uploads", id: :serial, force: :cascade do |t|
t.datetime_with_timezone "updated_at", null: false
t.integer "project_id"
t.text "import_file"
......@@ -1540,7 +1540,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["updated_at"], name: "index_import_export_uploads_on_updated_at", using: :btree
end
create_table "index_statuses", force: :cascade do |t|
create_table "index_statuses", id: :serial, force: :cascade do |t|
t.integer "project_id", null: false
t.datetime "indexed_at"
t.text "note"
......@@ -1550,14 +1550,14 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["project_id"], name: "index_index_statuses_on_project_id", unique: true, using: :btree
end
create_table "insights", force: :cascade do |t|
create_table "insights", id: :serial, force: :cascade do |t|
t.integer "namespace_id", null: false
t.integer "project_id", null: false
t.index ["namespace_id"], name: "index_insights_on_namespace_id", using: :btree
t.index ["project_id"], name: "index_insights_on_project_id", using: :btree
end
create_table "internal_ids", id: :bigserial, force: :cascade do |t|
create_table "internal_ids", force: :cascade do |t|
t.integer "project_id"
t.integer "usage", null: false
t.integer "last_value", null: false
......@@ -1575,7 +1575,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["user_id"], name: "index_issue_assignees_on_user_id", using: :btree
end
create_table "issue_links", force: :cascade do |t|
create_table "issue_links", id: :serial, force: :cascade do |t|
t.integer "source_id", null: false
t.integer "target_id", null: false
t.datetime "created_at"
......@@ -1585,7 +1585,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["target_id"], name: "index_issue_links_on_target_id", using: :btree
end
create_table "issue_metrics", force: :cascade do |t|
create_table "issue_metrics", id: :serial, force: :cascade do |t|
t.integer "issue_id", null: false
t.datetime "first_mentioned_in_commit_at"
t.datetime "first_associated_with_milestone_at"
......@@ -1595,7 +1595,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["issue_id"], name: "index_issue_metrics", using: :btree
end
create_table "issues", force: :cascade do |t|
create_table "issues", id: :serial, force: :cascade do |t|
t.string "title"
t.integer "author_id"
t.integer "project_id"
......@@ -1640,7 +1640,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["updated_by_id"], name: "index_issues_on_updated_by_id", where: "(updated_by_id IS NOT NULL)", using: :btree
end
create_table "jira_connect_installations", id: :bigserial, force: :cascade do |t|
create_table "jira_connect_installations", force: :cascade do |t|
t.string "client_key"
t.string "encrypted_shared_secret"
t.string "encrypted_shared_secret_iv"
......@@ -1648,7 +1648,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["client_key"], name: "index_jira_connect_installations_on_client_key", unique: true, using: :btree
end
create_table "keys", force: :cascade do |t|
create_table "keys", id: :serial, force: :cascade do |t|
t.integer "user_id"
t.datetime "created_at"
t.datetime "updated_at"
......@@ -1662,7 +1662,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["user_id"], name: "index_keys_on_user_id", using: :btree
end
create_table "label_links", force: :cascade do |t|
create_table "label_links", id: :serial, force: :cascade do |t|
t.integer "label_id"
t.integer "target_id"
t.string "target_type"
......@@ -1672,7 +1672,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["target_id", "target_type"], name: "index_label_links_on_target_id_and_target_type", using: :btree
end
create_table "label_priorities", force: :cascade do |t|
create_table "label_priorities", id: :serial, force: :cascade do |t|
t.integer "project_id", null: false
t.integer "label_id", null: false
t.integer "priority", null: false
......@@ -1683,7 +1683,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["project_id", "label_id"], name: "index_label_priorities_on_project_id_and_label_id", unique: true, using: :btree
end
create_table "labels", force: :cascade do |t|
create_table "labels", id: :serial, force: :cascade do |t|
t.string "title"
t.string "color"
t.integer "project_id"
......@@ -1702,7 +1702,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["type", "project_id"], name: "index_labels_on_type_and_project_id", using: :btree
end
create_table "ldap_group_links", force: :cascade do |t|
create_table "ldap_group_links", id: :serial, force: :cascade do |t|
t.string "cn"
t.integer "group_access", null: false
t.integer "group_id", null: false
......@@ -1712,7 +1712,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.string "filter"
end
create_table "lfs_file_locks", force: :cascade do |t|
create_table "lfs_file_locks", id: :serial, force: :cascade do |t|
t.integer "project_id", null: false
t.integer "user_id", null: false
t.datetime "created_at", null: false
......@@ -1721,7 +1721,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["user_id"], name: "index_lfs_file_locks_on_user_id", using: :btree
end
create_table "lfs_objects", force: :cascade do |t|
create_table "lfs_objects", id: :serial, force: :cascade do |t|
t.string "oid", null: false
t.bigint "size", null: false
t.datetime "created_at"
......@@ -1732,7 +1732,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["oid"], name: "index_lfs_objects_on_oid", unique: true, using: :btree
end
create_table "lfs_objects_projects", force: :cascade do |t|
create_table "lfs_objects_projects", id: :serial, force: :cascade do |t|
t.integer "lfs_object_id", null: false
t.integer "project_id", null: false
t.datetime "created_at"
......@@ -1740,13 +1740,13 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["project_id"], name: "index_lfs_objects_projects_on_project_id", using: :btree
end
create_table "licenses", force: :cascade do |t|
create_table "licenses", id: :serial, force: :cascade do |t|
t.text "data", null: false
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "lists", force: :cascade do |t|
create_table "lists", id: :serial, force: :cascade do |t|
t.integer "board_id", null: false
t.integer "label_id"
t.integer "list_type", default: 1, null: false
......@@ -1762,7 +1762,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["user_id"], name: "index_lists_on_user_id", using: :btree
end
create_table "members", force: :cascade do |t|
create_table "members", id: :serial, force: :cascade do |t|
t.integer "access_level", null: false
t.integer "source_id", null: false
t.string "source_type", null: false
......@@ -1827,7 +1827,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["merge_request_diff_id", "relative_order"], name: "index_merge_request_diff_files_on_mr_diff_id_and_order", unique: true, using: :btree
end
create_table "merge_request_diffs", force: :cascade do |t|
create_table "merge_request_diffs", id: :serial, force: :cascade do |t|
t.string "state"
t.integer "merge_request_id", null: false
t.datetime "created_at"
......@@ -1844,7 +1844,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["merge_request_id", "id"], name: "index_merge_request_diffs_on_merge_request_id_and_id_partial", where: "((NOT stored_externally) OR (stored_externally IS NULL))", using: :btree
end
create_table "merge_request_metrics", force: :cascade do |t|
create_table "merge_request_metrics", id: :serial, force: :cascade do |t|
t.integer "merge_request_id", null: false
t.datetime "latest_build_started_at"
t.datetime "latest_build_finished_at"
......@@ -1865,7 +1865,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["pipeline_id"], name: "index_merge_request_metrics_on_pipeline_id", using: :btree
end
create_table "merge_requests", force: :cascade do |t|
create_table "merge_requests", id: :serial, force: :cascade do |t|
t.string "target_branch", null: false
t.string "source_branch", null: false
t.integer "source_project_id"
......@@ -1924,7 +1924,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["updated_by_id"], name: "index_merge_requests_on_updated_by_id", where: "(updated_by_id IS NOT NULL)", using: :btree
end
create_table "merge_requests_closing_issues", force: :cascade do |t|
create_table "merge_requests_closing_issues", id: :serial, force: :cascade do |t|
t.integer "merge_request_id", null: false
t.integer "issue_id", null: false
t.datetime "created_at", null: false
......@@ -1933,7 +1933,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["merge_request_id"], name: "index_merge_requests_closing_issues_on_merge_request_id", using: :btree
end
create_table "milestones", force: :cascade do |t|
create_table "milestones", id: :serial, force: :cascade do |t|
t.string "title", null: false
t.integer "project_id"
t.text "description"
......@@ -1955,14 +1955,14 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["title"], name: "index_milestones_on_title_trigram", using: :gin, opclasses: {"title"=>"gin_trgm_ops"}
end
create_table "namespace_statistics", force: :cascade do |t|
create_table "namespace_statistics", id: :serial, force: :cascade do |t|
t.integer "namespace_id", null: false
t.integer "shared_runners_seconds", default: 0, null: false
t.datetime "shared_runners_seconds_last_reset"
t.index ["namespace_id"], name: "index_namespace_statistics_on_namespace_id", unique: true, using: :btree
end
create_table "namespaces", force: :cascade do |t|
create_table "namespaces", id: :serial, force: :cascade do |t|
t.string "name", null: false
t.string "path", null: false
t.integer "owner_id"
......@@ -2018,7 +2018,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["type"], name: "index_namespaces_on_type", using: :btree
end
create_table "note_diff_files", force: :cascade do |t|
create_table "note_diff_files", id: :serial, force: :cascade do |t|
t.integer "diff_note_id", null: false
t.text "diff", null: false
t.boolean "new_file", null: false
......@@ -2031,7 +2031,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["diff_note_id"], name: "index_note_diff_files_on_diff_note_id", unique: true, using: :btree
end
create_table "notes", force: :cascade do |t|
create_table "notes", id: :serial, force: :cascade do |t|
t.text "note"
t.string "noteable_type"
t.integer "author_id"
......@@ -2068,7 +2068,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["review_id"], name: "index_notes_on_review_id", using: :btree
end
create_table "notification_settings", force: :cascade do |t|
create_table "notification_settings", id: :serial, force: :cascade do |t|
t.integer "user_id", null: false
t.integer "source_id"
t.string "source_type"
......@@ -2095,7 +2095,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["user_id"], name: "index_notification_settings_on_user_id", using: :btree
end
create_table "oauth_access_grants", force: :cascade do |t|
create_table "oauth_access_grants", id: :serial, force: :cascade do |t|
t.integer "resource_owner_id", null: false
t.integer "application_id", null: false
t.string "token", null: false
......@@ -2107,7 +2107,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["token"], name: "index_oauth_access_grants_on_token", unique: true, using: :btree
end
create_table "oauth_access_tokens", force: :cascade do |t|
create_table "oauth_access_tokens", id: :serial, force: :cascade do |t|
t.integer "resource_owner_id"
t.integer "application_id"
t.string "token", null: false
......@@ -2121,7 +2121,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["token"], name: "index_oauth_access_tokens_on_token", unique: true, using: :btree
end
create_table "oauth_applications", force: :cascade do |t|
create_table "oauth_applications", id: :serial, force: :cascade do |t|
t.string "name", null: false
t.string "uid", null: false
t.string "secret", null: false
......@@ -2136,13 +2136,13 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["uid"], name: "index_oauth_applications_on_uid", unique: true, using: :btree
end
create_table "oauth_openid_requests", force: :cascade do |t|
create_table "oauth_openid_requests", id: :serial, force: :cascade do |t|
t.integer "access_grant_id", null: false
t.string "nonce", null: false
t.index ["access_grant_id"], name: "index_oauth_openid_requests_on_access_grant_id", using: :btree
end
create_table "operations_feature_flag_scopes", id: :bigserial, force: :cascade do |t|
create_table "operations_feature_flag_scopes", force: :cascade do |t|
t.bigint "feature_flag_id", null: false
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
......@@ -2151,7 +2151,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["feature_flag_id", "environment_scope"], name: "index_feature_flag_scopes_on_flag_id_and_environment_scope", unique: true, using: :btree
end
create_table "operations_feature_flags", id: :bigserial, force: :cascade do |t|
create_table "operations_feature_flags", force: :cascade do |t|
t.integer "project_id", null: false
t.boolean "active", null: false
t.datetime_with_timezone "created_at", null: false
......@@ -2161,13 +2161,13 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["project_id", "name"], name: "index_operations_feature_flags_on_project_id_and_name", unique: true, using: :btree
end
create_table "operations_feature_flags_clients", id: :bigserial, force: :cascade do |t|
create_table "operations_feature_flags_clients", force: :cascade do |t|
t.integer "project_id", null: false
t.string "token", null: false
t.index ["project_id", "token"], name: "index_operations_feature_flags_clients_on_project_id_and_token", unique: true, using: :btree
end
create_table "packages_maven_metadata", id: :bigserial, force: :cascade do |t|
create_table "packages_maven_metadata", force: :cascade do |t|
t.bigint "package_id", null: false
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
......@@ -2178,7 +2178,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["package_id", "path"], name: "index_packages_maven_metadata_on_package_id_and_path", using: :btree
end
create_table "packages_package_files", id: :bigserial, force: :cascade do |t|
create_table "packages_package_files", force: :cascade do |t|
t.bigint "package_id", null: false
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
......@@ -2192,7 +2192,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["package_id", "file_name"], name: "index_packages_package_files_on_package_id_and_file_name", using: :btree
end
create_table "packages_packages", id: :bigserial, force: :cascade do |t|
create_table "packages_packages", force: :cascade do |t|
t.integer "project_id", null: false
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
......@@ -2202,7 +2202,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["project_id"], name: "index_packages_packages_on_project_id", using: :btree
end
create_table "pages_domains", force: :cascade do |t|
create_table "pages_domains", id: :serial, force: :cascade do |t|
t.integer "project_id"
t.text "certificate"
t.text "encrypted_key"
......@@ -2221,7 +2221,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["verified_at"], name: "index_pages_domains_on_verified_at", using: :btree
end
create_table "path_locks", force: :cascade do |t|
create_table "path_locks", id: :serial, force: :cascade do |t|
t.string "path", null: false
t.integer "project_id"
t.integer "user_id"
......@@ -2232,7 +2232,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["user_id"], name: "index_path_locks_on_user_id", using: :btree
end
create_table "personal_access_tokens", force: :cascade do |t|
create_table "personal_access_tokens", id: :serial, force: :cascade do |t|
t.integer "user_id", null: false
t.string "name", null: false
t.boolean "revoked", default: false
......@@ -2246,7 +2246,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["user_id"], name: "index_personal_access_tokens_on_user_id", using: :btree
end
create_table "plans", force: :cascade do |t|
create_table "plans", id: :serial, force: :cascade do |t|
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "name"
......@@ -2256,7 +2256,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["name"], name: "index_plans_on_name", using: :btree
end
create_table "pool_repositories", id: :bigserial, force: :cascade do |t|
create_table "pool_repositories", force: :cascade do |t|
t.integer "shard_id", null: false
t.string "disk_path"
t.string "state"
......@@ -2266,14 +2266,14 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["source_project_id"], name: "index_pool_repositories_on_source_project_id", unique: true, using: :btree
end
create_table "programming_languages", force: :cascade do |t|
create_table "programming_languages", id: :serial, force: :cascade do |t|
t.string "name", null: false
t.string "color", null: false
t.datetime_with_timezone "created_at", null: false
t.index ["name"], name: "index_programming_languages_on_name", unique: true, using: :btree
end
create_table "project_alerting_settings", primary_key: "project_id", id: :integer, force: :cascade do |t|
create_table "project_alerting_settings", primary_key: "project_id", id: :integer, default: nil, force: :cascade do |t|
t.string "encrypted_token", null: false
t.string "encrypted_token_iv", null: false
end
......@@ -2286,7 +2286,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["user_id", "project_id", "access_level"], name: "index_project_authorizations_on_user_id_project_id_access_level", unique: true, using: :btree
end
create_table "project_auto_devops", force: :cascade do |t|
create_table "project_auto_devops", id: :serial, force: :cascade do |t|
t.integer "project_id", null: false
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
......@@ -2296,14 +2296,14 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["project_id"], name: "index_project_auto_devops_on_project_id", unique: true, using: :btree
end
create_table "project_ci_cd_settings", force: :cascade do |t|
create_table "project_ci_cd_settings", id: :serial, force: :cascade do |t|
t.integer "project_id", null: false
t.boolean "group_runners_enabled", default: true, null: false
t.boolean "merge_pipelines_enabled"
t.index ["project_id"], name: "index_project_ci_cd_settings_on_project_id", unique: true, using: :btree
end
create_table "project_custom_attributes", force: :cascade do |t|
create_table "project_custom_attributes", id: :serial, force: :cascade do |t|
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
t.integer "project_id", null: false
......@@ -2313,14 +2313,14 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["project_id", "key"], name: "index_project_custom_attributes_on_project_id_and_key", unique: true, using: :btree
end
create_table "project_daily_statistics", id: :bigserial, force: :cascade do |t|
create_table "project_daily_statistics", force: :cascade do |t|
t.integer "project_id", null: false
t.integer "fetch_count", null: false
t.date "date"
t.index ["project_id", "date"], name: "index_project_daily_statistics_on_project_id_and_date", unique: true, order: { date: :desc }, using: :btree
end
create_table "project_deploy_tokens", force: :cascade do |t|
create_table "project_deploy_tokens", id: :serial, force: :cascade do |t|
t.integer "project_id", null: false
t.integer "deploy_token_id", null: false
t.datetime_with_timezone "created_at", null: false
......@@ -2328,7 +2328,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["project_id", "deploy_token_id"], name: "index_project_deploy_tokens_on_project_id_and_deploy_token_id", unique: true, using: :btree
end
create_table "project_error_tracking_settings", primary_key: "project_id", id: :integer, force: :cascade do |t|
create_table "project_error_tracking_settings", primary_key: "project_id", id: :integer, default: nil, force: :cascade do |t|
t.boolean "enabled", default: false, null: false
t.string "api_url"
t.string "encrypted_token"
......@@ -2337,7 +2337,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.string "organization_name"
end
create_table "project_feature_usages", primary_key: "project_id", id: :integer, force: :cascade do |t|
create_table "project_feature_usages", primary_key: "project_id", id: :integer, default: nil, force: :cascade do |t|
t.datetime "jira_dvcs_cloud_last_sync_at"
t.datetime "jira_dvcs_server_last_sync_at"
t.index ["jira_dvcs_cloud_last_sync_at", "project_id"], name: "idx_proj_feat_usg_on_jira_dvcs_cloud_last_sync_at_and_proj_id", where: "(jira_dvcs_cloud_last_sync_at IS NOT NULL)", using: :btree
......@@ -2345,7 +2345,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["project_id"], name: "index_project_feature_usages_on_project_id", using: :btree
end
create_table "project_features", force: :cascade do |t|
create_table "project_features", id: :serial, force: :cascade do |t|
t.integer "project_id", null: false
t.integer "merge_requests_access_level"
t.integer "issues_access_level"
......@@ -2359,7 +2359,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["project_id"], name: "index_project_features_on_project_id", unique: true, using: :btree
end
create_table "project_group_links", force: :cascade do |t|
create_table "project_group_links", id: :serial, force: :cascade do |t|
t.integer "project_id", null: false
t.integer "group_id", null: false
t.datetime "created_at"
......@@ -2370,7 +2370,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["project_id"], name: "index_project_group_links_on_project_id", using: :btree
end
create_table "project_import_data", force: :cascade do |t|
create_table "project_import_data", id: :serial, force: :cascade do |t|
t.integer "project_id"
t.text "data"
t.text "encrypted_credentials"
......@@ -2379,13 +2379,13 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["project_id"], name: "index_project_import_data_on_project_id", using: :btree
end
create_table "project_incident_management_settings", primary_key: "project_id", id: :integer, force: :cascade do |t|
create_table "project_incident_management_settings", primary_key: "project_id", id: :serial, force: :cascade do |t|
t.boolean "create_issue", default: false, null: false
t.boolean "send_email", default: true, null: false
t.text "issue_template_key"
end
create_table "project_mirror_data", force: :cascade do |t|
create_table "project_mirror_data", id: :serial, force: :cascade do |t|
t.integer "project_id", null: false
t.integer "retry_count", default: 0, null: false
t.datetime "last_update_started_at"
......@@ -2403,7 +2403,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["status"], name: "index_project_mirror_data_on_status", using: :btree
end
create_table "project_repositories", id: :bigserial, force: :cascade do |t|
create_table "project_repositories", force: :cascade do |t|
t.integer "shard_id", null: false
t.string "disk_path", null: false
t.integer "project_id", null: false
......@@ -2412,7 +2412,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["shard_id"], name: "index_project_repositories_on_shard_id", using: :btree
end
create_table "project_repository_states", force: :cascade do |t|
create_table "project_repository_states", id: :serial, force: :cascade do |t|
t.integer "project_id", null: false
t.binary "repository_verification_checksum"
t.binary "wiki_verification_checksum"
......@@ -2432,7 +2432,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["project_id"], name: "index_project_repository_states_on_project_id", unique: true, using: :btree
end
create_table "project_statistics", force: :cascade do |t|
create_table "project_statistics", id: :serial, force: :cascade do |t|
t.integer "project_id", null: false
t.integer "namespace_id", null: false
t.bigint "commit_count", default: 0, null: false
......@@ -2446,7 +2446,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["project_id"], name: "index_project_statistics_on_project_id", unique: true, using: :btree
end
create_table "project_tracing_settings", id: :bigserial, force: :cascade do |t|
create_table "project_tracing_settings", force: :cascade do |t|
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
t.integer "project_id", null: false
......@@ -2454,7 +2454,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["project_id"], name: "index_project_tracing_settings_on_project_id", unique: true, using: :btree
end
create_table "projects", force: :cascade do |t|
create_table "projects", id: :serial, force: :cascade do |t|
t.string "name"
t.string "path"
t.text "description"
......@@ -2558,7 +2558,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["visibility_level"], name: "index_projects_on_visibility_level", using: :btree
end
create_table "prometheus_alert_events", id: :bigserial, force: :cascade do |t|
create_table "prometheus_alert_events", force: :cascade do |t|
t.integer "project_id", null: false
t.integer "prometheus_alert_id", null: false
t.datetime_with_timezone "started_at", null: false
......@@ -2569,7 +2569,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["prometheus_alert_id", "payload_key"], name: "index_prometheus_alert_event_scoped_payload_key", unique: true, using: :btree
end
create_table "prometheus_alerts", force: :cascade do |t|
create_table "prometheus_alerts", id: :serial, force: :cascade do |t|
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
t.float "threshold", null: false
......@@ -2582,7 +2582,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["prometheus_metric_id"], name: "index_prometheus_alerts_on_prometheus_metric_id", using: :btree
end
create_table "prometheus_metrics", force: :cascade do |t|
create_table "prometheus_metrics", id: :serial, force: :cascade do |t|
t.integer "project_id"
t.string "title", null: false
t.string "query", null: false
......@@ -2600,7 +2600,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["project_id"], name: "index_prometheus_metrics_on_project_id", using: :btree
end
create_table "protected_branch_merge_access_levels", force: :cascade do |t|
create_table "protected_branch_merge_access_levels", id: :serial, force: :cascade do |t|
t.integer "protected_branch_id", null: false
t.integer "access_level", default: 40
t.datetime "created_at", null: false
......@@ -2612,7 +2612,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["user_id"], name: "index_protected_branch_merge_access_levels_on_user_id", using: :btree
end
create_table "protected_branch_push_access_levels", force: :cascade do |t|
create_table "protected_branch_push_access_levels", id: :serial, force: :cascade do |t|
t.integer "protected_branch_id", null: false
t.integer "access_level", default: 40
t.datetime "created_at", null: false
......@@ -2624,7 +2624,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["user_id"], name: "index_protected_branch_push_access_levels_on_user_id", using: :btree
end
create_table "protected_branch_unprotect_access_levels", force: :cascade do |t|
create_table "protected_branch_unprotect_access_levels", id: :serial, force: :cascade do |t|
t.integer "protected_branch_id", null: false
t.integer "access_level", default: 40
t.integer "user_id"
......@@ -2634,7 +2634,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["user_id"], name: "index_protected_branch_unprotect_access_levels_on_user_id", using: :btree
end
create_table "protected_branches", force: :cascade do |t|
create_table "protected_branches", id: :serial, force: :cascade do |t|
t.integer "project_id", null: false
t.string "name", null: false
t.datetime "created_at"
......@@ -2642,7 +2642,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["project_id"], name: "index_protected_branches_on_project_id", using: :btree
end
create_table "protected_environment_deploy_access_levels", force: :cascade do |t|
create_table "protected_environment_deploy_access_levels", id: :serial, force: :cascade do |t|
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
t.integer "access_level", default: 40
......@@ -2654,7 +2654,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["user_id"], name: "index_protected_environment_deploy_access_levels_on_user_id", using: :btree
end
create_table "protected_environments", force: :cascade do |t|
create_table "protected_environments", id: :serial, force: :cascade do |t|
t.integer "project_id", null: false
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
......@@ -2663,7 +2663,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["project_id"], name: "index_protected_environments_on_project_id", using: :btree
end
create_table "protected_tag_create_access_levels", force: :cascade do |t|
create_table "protected_tag_create_access_levels", id: :serial, force: :cascade do |t|
t.integer "protected_tag_id", null: false
t.integer "access_level", default: 40
t.integer "user_id"
......@@ -2675,7 +2675,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["user_id"], name: "index_protected_tag_create_access_levels_on_user_id", using: :btree
end
create_table "protected_tags", force: :cascade do |t|
create_table "protected_tags", id: :serial, force: :cascade do |t|
t.integer "project_id", null: false
t.string "name", null: false
t.datetime "created_at", null: false
......@@ -2696,7 +2696,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["event_id"], name: "index_push_event_payloads_on_event_id", unique: true, using: :btree
end
create_table "push_rules", force: :cascade do |t|
create_table "push_rules", id: :serial, force: :cascade do |t|
t.string "force_push_regex"
t.string "delete_branch_regex"
t.string "commit_message_regex"
......@@ -2719,7 +2719,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["project_id"], name: "index_push_rules_on_project_id", using: :btree
end
create_table "redirect_routes", force: :cascade do |t|
create_table "redirect_routes", id: :serial, force: :cascade do |t|
t.integer "source_id", null: false
t.string "source_type", null: false
t.string "path", null: false
......@@ -2729,7 +2729,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["source_type", "source_id"], name: "index_redirect_routes_on_source_type_and_source_id", using: :btree
end
create_table "release_links", id: :bigserial, force: :cascade do |t|
create_table "release_links", force: :cascade do |t|
t.integer "release_id", null: false
t.string "url", null: false
t.string "name", null: false
......@@ -2739,7 +2739,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["release_id", "url"], name: "index_release_links_on_release_id_and_url", unique: true, using: :btree
end
create_table "releases", force: :cascade do |t|
create_table "releases", id: :serial, force: :cascade do |t|
t.string "tag"
t.text "description"
t.integer "project_id"
......@@ -2755,7 +2755,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["project_id"], name: "index_releases_on_project_id", using: :btree
end
create_table "remote_mirrors", force: :cascade do |t|
create_table "remote_mirrors", id: :serial, force: :cascade do |t|
t.integer "project_id"
t.string "url"
t.boolean "enabled", default: false
......@@ -2783,7 +2783,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["project_id", "programming_language_id"], name: "index_repository_languages_on_project_and_languages_id", unique: true, using: :btree
end
create_table "resource_label_events", id: :bigserial, force: :cascade do |t|
create_table "resource_label_events", force: :cascade do |t|
t.integer "action", null: false
t.integer "issue_id"
t.integer "merge_request_id"
......@@ -2801,7 +2801,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["user_id"], name: "index_resource_label_events_on_user_id", using: :btree
end
create_table "reviews", id: :bigserial, force: :cascade do |t|
create_table "reviews", force: :cascade do |t|
t.integer "author_id"
t.integer "merge_request_id", null: false
t.integer "project_id", null: false
......@@ -2811,7 +2811,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["project_id"], name: "index_reviews_on_project_id", using: :btree
end
create_table "routes", force: :cascade do |t|
create_table "routes", id: :serial, force: :cascade do |t|
t.integer "source_id", null: false
t.string "source_type", null: false
t.string "path", null: false
......@@ -2823,7 +2823,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["source_type", "source_id"], name: "index_routes_on_source_type_and_source_id", unique: true, using: :btree
end
create_table "saml_providers", force: :cascade do |t|
create_table "saml_providers", id: :serial, force: :cascade do |t|
t.integer "group_id", null: false
t.boolean "enabled", null: false
t.string "certificate_fingerprint", null: false
......@@ -2833,7 +2833,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["group_id"], name: "index_saml_providers_on_group_id", using: :btree
end
create_table "scim_oauth_access_tokens", force: :cascade do |t|
create_table "scim_oauth_access_tokens", id: :serial, force: :cascade do |t|
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
t.integer "group_id", null: false
......@@ -2841,7 +2841,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["group_id", "token_encrypted"], name: "index_scim_oauth_access_tokens_on_group_id_and_token_encrypted", unique: true, using: :btree
end
create_table "sent_notifications", force: :cascade do |t|
create_table "sent_notifications", id: :serial, force: :cascade do |t|
t.integer "project_id"
t.integer "noteable_id"
t.string "noteable_type"
......@@ -2855,7 +2855,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["reply_key"], name: "index_sent_notifications_on_reply_key", unique: true, using: :btree
end
create_table "services", force: :cascade do |t|
create_table "services", id: :serial, force: :cascade do |t|
t.string "type"
t.string "title"
t.integer "project_id"
......@@ -2882,12 +2882,12 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["type"], name: "index_services_on_type", using: :btree
end
create_table "shards", force: :cascade do |t|
create_table "shards", id: :serial, force: :cascade do |t|
t.string "name", null: false
t.index ["name"], name: "index_shards_on_name", unique: true, using: :btree
end
create_table "slack_integrations", force: :cascade do |t|
create_table "slack_integrations", id: :serial, force: :cascade do |t|
t.integer "service_id", null: false
t.string "team_id", null: false
t.string "team_name", null: false
......@@ -2899,7 +2899,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["team_id", "alias"], name: "index_slack_integrations_on_team_id_and_alias", unique: true, using: :btree
end
create_table "smartcard_identities", id: :bigserial, force: :cascade do |t|
create_table "smartcard_identities", force: :cascade do |t|
t.integer "user_id", null: false
t.string "subject", null: false
t.string "issuer", null: false
......@@ -2907,7 +2907,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["user_id"], name: "index_smartcard_identities_on_user_id", using: :btree
end
create_table "snippets", force: :cascade do |t|
create_table "snippets", id: :serial, force: :cascade do |t|
t.string "title"
t.text "content"
t.integer "author_id", null: false
......@@ -2930,7 +2930,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["visibility_level"], name: "index_snippets_on_visibility_level", using: :btree
end
create_table "software_license_policies", force: :cascade do |t|
create_table "software_license_policies", id: :serial, force: :cascade do |t|
t.integer "project_id", null: false
t.integer "software_license_id", null: false
t.integer "approval_status", default: 0, null: false
......@@ -2938,12 +2938,12 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["software_license_id"], name: "index_software_license_policies_on_software_license_id", using: :btree
end
create_table "software_licenses", force: :cascade do |t|
create_table "software_licenses", id: :serial, force: :cascade do |t|
t.string "name", null: false
t.index ["name"], name: "index_software_licenses_on_name", using: :btree
end
create_table "spam_logs", force: :cascade do |t|
create_table "spam_logs", id: :serial, force: :cascade do |t|
t.integer "user_id"
t.string "source_ip"
t.string "user_agent"
......@@ -2957,7 +2957,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.boolean "recaptcha_verified", default: false, null: false
end
create_table "subscriptions", force: :cascade do |t|
create_table "subscriptions", id: :serial, force: :cascade do |t|
t.integer "user_id"
t.integer "subscribable_id"
t.string "subscribable_type"
......@@ -2969,7 +2969,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["subscribable_id", "subscribable_type", "user_id", "project_id"], name: "index_subscriptions_on_subscribable_and_user_id_and_project_id", unique: true, using: :btree
end
create_table "suggestions", id: :bigserial, force: :cascade do |t|
create_table "suggestions", force: :cascade do |t|
t.integer "note_id", null: false
t.integer "relative_order", limit: 2, null: false
t.boolean "applied", default: false, null: false
......@@ -2982,7 +2982,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["note_id", "relative_order"], name: "index_suggestions_on_note_id_and_relative_order", unique: true, using: :btree
end
create_table "system_note_metadata", force: :cascade do |t|
create_table "system_note_metadata", id: :serial, force: :cascade do |t|
t.integer "note_id", null: false
t.integer "commit_count"
t.string "action"
......@@ -2991,7 +2991,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["note_id"], name: "index_system_note_metadata_on_note_id", unique: true, using: :btree
end
create_table "taggings", force: :cascade do |t|
create_table "taggings", id: :serial, force: :cascade do |t|
t.integer "tag_id"
t.integer "taggable_id"
t.string "taggable_type"
......@@ -3005,14 +3005,14 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["taggable_id", "taggable_type"], name: "index_taggings_on_taggable_id_and_taggable_type", using: :btree
end
create_table "tags", force: :cascade do |t|
create_table "tags", id: :serial, force: :cascade do |t|
t.string "name"
t.integer "taggings_count", default: 0
t.index ["name"], name: "index_tags_on_name", unique: true, using: :btree
t.index ["name"], name: "index_tags_on_name_trigram", using: :gin, opclasses: {"name"=>"gin_trgm_ops"}
end
create_table "term_agreements", force: :cascade do |t|
create_table "term_agreements", id: :serial, force: :cascade do |t|
t.integer "term_id", null: false
t.integer "user_id", null: false
t.boolean "accepted", default: false, null: false
......@@ -3023,7 +3023,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["user_id"], name: "index_term_agreements_on_user_id", using: :btree
end
create_table "timelogs", force: :cascade do |t|
create_table "timelogs", id: :serial, force: :cascade do |t|
t.integer "time_spent", null: false
t.integer "user_id"
t.datetime "created_at", null: false
......@@ -3036,7 +3036,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["user_id"], name: "index_timelogs_on_user_id", using: :btree
end
create_table "todos", force: :cascade do |t|
create_table "todos", id: :serial, force: :cascade do |t|
t.integer "user_id", null: false
t.integer "project_id"
t.integer "target_id"
......@@ -3060,12 +3060,12 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["user_id"], name: "index_todos_on_user_id", using: :btree
end
create_table "trending_projects", force: :cascade do |t|
create_table "trending_projects", id: :serial, force: :cascade do |t|
t.integer "project_id", null: false
t.index ["project_id"], name: "index_trending_projects_on_project_id", unique: true, using: :btree
end
create_table "u2f_registrations", force: :cascade do |t|
create_table "u2f_registrations", id: :serial, force: :cascade do |t|
t.text "certificate"
t.string "key_handle"
t.string "public_key"
......@@ -3078,7 +3078,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["user_id"], name: "index_u2f_registrations_on_user_id", using: :btree
end
create_table "uploads", force: :cascade do |t|
create_table "uploads", id: :serial, force: :cascade do |t|
t.bigint "size", null: false
t.string "path", limit: 511, null: false
t.string "checksum", limit: 64
......@@ -3095,7 +3095,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["uploader", "path"], name: "index_uploads_on_uploader_and_path", using: :btree
end
create_table "user_agent_details", force: :cascade do |t|
create_table "user_agent_details", id: :serial, force: :cascade do |t|
t.string "user_agent", null: false
t.string "ip_address", null: false
t.integer "subject_id", null: false
......@@ -3106,14 +3106,14 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["subject_id", "subject_type"], name: "index_user_agent_details_on_subject_id_and_subject_type", using: :btree
end
create_table "user_callouts", force: :cascade do |t|
create_table "user_callouts", id: :serial, force: :cascade do |t|
t.integer "feature_name", null: false
t.integer "user_id", null: false
t.index ["user_id", "feature_name"], name: "index_user_callouts_on_user_id_and_feature_name", unique: true, using: :btree
t.index ["user_id"], name: "index_user_callouts_on_user_id", using: :btree
end
create_table "user_custom_attributes", force: :cascade do |t|
create_table "user_custom_attributes", id: :serial, force: :cascade do |t|
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "user_id", null: false
......@@ -3130,7 +3130,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["user_id"], name: "index_user_interacted_projects_on_user_id", using: :btree
end
create_table "user_preferences", force: :cascade do |t|
create_table "user_preferences", id: :serial, force: :cascade do |t|
t.integer "user_id", null: false
t.integer "issue_notes_filter", limit: 2, default: 0, null: false
t.integer "merge_request_notes_filter", limit: 2, default: 0, null: false
......@@ -3146,7 +3146,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["user_id"], name: "index_user_preferences_on_user_id", unique: true, using: :btree
end
create_table "user_statuses", primary_key: "user_id", force: :cascade do |t|
create_table "user_statuses", primary_key: "user_id", id: :serial, force: :cascade do |t|
t.integer "cached_markdown_version"
t.string "emoji", default: "speech_balloon", null: false
t.string "message", limit: 100
......@@ -3154,7 +3154,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["user_id"], name: "index_user_statuses_on_user_id", using: :btree
end
create_table "user_synced_attributes_metadata", force: :cascade do |t|
create_table "user_synced_attributes_metadata", id: :serial, force: :cascade do |t|
t.boolean "name_synced", default: false
t.boolean "email_synced", default: false
t.boolean "location_synced", default: false
......@@ -3163,7 +3163,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["user_id"], name: "index_user_synced_attributes_metadata_on_user_id", unique: true, using: :btree
end
create_table "users", force: :cascade do |t|
create_table "users", id: :serial, force: :cascade do |t|
t.string "email", default: "", null: false
t.string "encrypted_password", default: "", null: false
t.string "reset_password_token"
......@@ -3267,7 +3267,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["username"], name: "index_users_on_username_trigram", using: :gin, opclasses: {"username"=>"gin_trgm_ops"}
end
create_table "users_ops_dashboard_projects", id: :bigserial, force: :cascade do |t|
create_table "users_ops_dashboard_projects", force: :cascade do |t|
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
t.integer "user_id", null: false
......@@ -3276,7 +3276,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["user_id", "project_id"], name: "index_users_ops_dashboard_projects_on_user_id_and_project_id", unique: true, using: :btree
end
create_table "users_star_projects", force: :cascade do |t|
create_table "users_star_projects", id: :serial, force: :cascade do |t|
t.integer "project_id", null: false
t.integer "user_id", null: false
t.datetime "created_at"
......@@ -3285,7 +3285,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["user_id", "project_id"], name: "index_users_star_projects_on_user_id_and_project_id", unique: true, using: :btree
end
create_table "vulnerability_feedback", force: :cascade do |t|
create_table "vulnerability_feedback", id: :serial, force: :cascade do |t|
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
t.integer "feedback_type", limit: 2, null: false
......@@ -3303,7 +3303,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["project_id", "category", "feedback_type", "project_fingerprint"], name: "vulnerability_feedback_unique_idx", unique: true, using: :btree
end
create_table "vulnerability_identifiers", id: :bigserial, force: :cascade do |t|
create_table "vulnerability_identifiers", force: :cascade do |t|
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
t.integer "project_id", null: false
......@@ -3315,7 +3315,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["project_id", "fingerprint"], name: "index_vulnerability_identifiers_on_project_id_and_fingerprint", unique: true, using: :btree
end
create_table "vulnerability_occurrence_identifiers", id: :bigserial, force: :cascade do |t|
create_table "vulnerability_occurrence_identifiers", force: :cascade do |t|
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
t.bigint "occurrence_id", null: false
......@@ -3324,7 +3324,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["occurrence_id", "identifier_id"], name: "index_vulnerability_occurrence_identifiers_on_unique_keys", unique: true, using: :btree
end
create_table "vulnerability_occurrence_pipelines", id: :bigserial, force: :cascade do |t|
create_table "vulnerability_occurrence_pipelines", force: :cascade do |t|
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
t.bigint "occurrence_id", null: false
......@@ -3333,7 +3333,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["pipeline_id"], name: "index_vulnerability_occurrence_pipelines_on_pipeline_id", using: :btree
end
create_table "vulnerability_occurrences", id: :bigserial, force: :cascade do |t|
create_table "vulnerability_occurrences", force: :cascade do |t|
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
t.integer "severity", limit: 2, null: false
......@@ -3354,7 +3354,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["uuid"], name: "index_vulnerability_occurrences_on_uuid", unique: true, using: :btree
end
create_table "vulnerability_scanners", id: :bigserial, force: :cascade do |t|
create_table "vulnerability_scanners", force: :cascade do |t|
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
t.integer "project_id", null: false
......@@ -3363,7 +3363,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["project_id", "external_id"], name: "index_vulnerability_scanners_on_project_id_and_external_id", unique: true, using: :btree
end
create_table "web_hook_logs", force: :cascade do |t|
create_table "web_hook_logs", id: :serial, force: :cascade do |t|
t.integer "web_hook_id", null: false
t.string "trigger"
t.string "url"
......@@ -3380,7 +3380,7 @@ ActiveRecord::Schema.define(version: 20190408163745) do
t.index ["web_hook_id"], name: "index_web_hook_logs_on_web_hook_id", using: :btree
end
create_table "web_hooks", force: :cascade do |t|
create_table "web_hooks", id: :serial, force: :cascade do |t|
t.integer "project_id"
t.datetime "created_at"
t.datetime "updated_at"
......
......@@ -5,13 +5,13 @@ module Ci
class Pipeline < ApplicationRecord
self.table_name = "ci_sources_pipelines"
belongs_to :project, class_name: Project
belongs_to :pipeline, class_name: Ci::Pipeline, inverse_of: :source_pipeline
belongs_to :project, class_name: "Project"
belongs_to :pipeline, class_name: "Ci::Pipeline", inverse_of: :source_pipeline
belongs_to :source_project, class_name: Project, foreign_key: :source_project_id
belongs_to :source_job, class_name: CommitStatus, foreign_key: :source_job_id
belongs_to :source_bridge, class_name: Ci::Bridge, foreign_key: :source_job_id
belongs_to :source_pipeline, class_name: Ci::Pipeline, foreign_key: :source_pipeline_id
belongs_to :source_project, class_name: "Project", foreign_key: :source_project_id
belongs_to :source_job, class_name: "CommitStatus", foreign_key: :source_job_id
belongs_to :source_bridge, class_name: "Ci::Bridge", foreign_key: :source_job_id
belongs_to :source_pipeline, class_name: "Ci::Pipeline", foreign_key: :source_pipeline_id
validates :project, presence: true
validates :pipeline, presence: true
......
......@@ -13,7 +13,7 @@ module EE
serialize :yaml_variables, ::Gitlab::Serializer::Ci::Variables
# rubocop:enable Cop/ActiveRecordSerialize
has_many :sourced_pipelines, class_name: ::Ci::Sources::Pipeline,
has_many :sourced_pipelines, class_name: "::Ci::Sources::Pipeline",
foreign_key: :source_job_id
state_machine :status do
......
......@@ -21,7 +21,7 @@ module EE
delegate :service_specification, to: :runner_session, allow_nil: true
has_many :sourced_pipelines,
class_name: ::Ci::Sources::Pipeline,
class_name: "::Ci::Sources::Pipeline",
foreign_key: :source_job_id
end
......
......@@ -17,8 +17,8 @@ module EE
has_many :vulnerabilities_occurrence_pipelines, class_name: 'Vulnerabilities::OccurrencePipeline'
has_many :vulnerabilities, source: :occurrence, through: :vulnerabilities_occurrence_pipelines, class_name: 'Vulnerabilities::Occurrence'
has_one :source_pipeline, class_name: ::Ci::Sources::Pipeline, inverse_of: :pipeline
has_many :sourced_pipelines, class_name: ::Ci::Sources::Pipeline, foreign_key: :source_pipeline_id
has_one :source_pipeline, class_name: "::Ci::Sources::Pipeline", inverse_of: :pipeline
has_many :sourced_pipelines, class_name: "::Ci::Sources::Pipeline", foreign_key: :source_pipeline_id
has_one :triggered_by_pipeline, through: :source_pipeline, source: :source_pipeline
has_one :source_job, through: :source_pipeline, source: :source_job
......
......@@ -269,7 +269,7 @@ module EE
end
def has_ancestor?(epic)
ancestors.exists?(epic)
ancestors.exists?(epic.id)
end
def hierarchy
......
......@@ -45,12 +45,12 @@ module EE
has_many :users_ops_dashboard_projects
has_many :ops_dashboard_projects, through: :users_ops_dashboard_projects, source: :project
has_many :group_saml_identities, -> { where.not(saml_provider_id: nil) }, source: :identities, class_name: ::Identity
has_many :group_saml_identities, -> { where.not(saml_provider_id: nil) }, source: :identities, class_name: "::Identity"
# Protected Branch Access
has_many :protected_branch_merge_access_levels, dependent: :destroy, class_name: ::ProtectedBranch::MergeAccessLevel # rubocop:disable Cop/ActiveRecordDependent
has_many :protected_branch_push_access_levels, dependent: :destroy, class_name: ::ProtectedBranch::PushAccessLevel # rubocop:disable Cop/ActiveRecordDependent
has_many :protected_branch_unprotect_access_levels, dependent: :destroy, class_name: ::ProtectedBranch::UnprotectAccessLevel # rubocop:disable Cop/ActiveRecordDependent
has_many :protected_branch_merge_access_levels, dependent: :destroy, class_name: "::ProtectedBranch::MergeAccessLevel" # rubocop:disable Cop/ActiveRecordDependent
has_many :protected_branch_push_access_levels, dependent: :destroy, class_name: "::ProtectedBranch::PushAccessLevel" # rubocop:disable Cop/ActiveRecordDependent
has_many :protected_branch_unprotect_access_levels, dependent: :destroy, class_name: "::ProtectedBranch::UnprotectAccessLevel" # rubocop:disable Cop/ActiveRecordDependent
has_many :smartcard_identities
......
......@@ -21,7 +21,7 @@ class PushRule < ApplicationRecord
belongs_to :project
validates :project, presence: true, unless: "is_sample?"
validates :project, presence: true, unless: :is_sample?
validates :max_file_size, numericality: { greater_than_or_equal_to: 0, only_integer: true }
validates(*REGEX_COLUMNS, untrusted_regexp: true)
......
......@@ -18,7 +18,7 @@ ActiveRecord::Schema.define(version: 20190314201959) do
create_table "event_log_states", primary_key: "event_id", id: :bigint, force: :cascade do |t|
end
create_table "file_registry", force: :cascade do |t|
create_table "file_registry", id: :serial, force: :cascade do |t|
t.string "file_type", null: false
t.integer "file_id", null: false
t.bigint "bytes"
......@@ -34,7 +34,7 @@ ActiveRecord::Schema.define(version: 20190314201959) do
t.index ["success"], name: "index_file_registry_on_success", using: :btree
end
create_table "job_artifact_registry", force: :cascade do |t|
create_table "job_artifact_registry", id: :serial, force: :cascade do |t|
t.datetime_with_timezone "created_at"
t.datetime_with_timezone "retry_at"
t.bigint "bytes"
......@@ -48,7 +48,7 @@ ActiveRecord::Schema.define(version: 20190314201959) do
t.index ["success"], name: "index_job_artifact_registry_on_success", using: :btree
end
create_table "project_registry", force: :cascade do |t|
create_table "project_registry", id: :serial, force: :cascade do |t|
t.integer "project_id", null: false
t.datetime "last_repository_synced_at"
t.datetime "last_repository_successful_sync_at"
......
......@@ -124,7 +124,7 @@ module Gitlab
def format(vulnerability, definitions)
definitions.each do |keys, value|
if vulnerability.values_at(*Array(keys)).all?(&:present?)
return value % vulnerability.with_indifferent_access
return value % vulnerability.symbolize_keys
end
end
......
......@@ -6,7 +6,7 @@
"author_id": { "type": "integer" },
"group_id": { "type": ["integer", "null"] },
"title": { "type": "string" },
"lock_version": { "type": ["string", "null"] },
"lock_version": { "type": ["integer", "null"] },
"description": { "type": ["string" , "null"] },
"confidential": { "type": "boolean" },
"milestone_id": { "type": ["string", "null"] },
......
......@@ -3,7 +3,7 @@ require 'spec_helper'
describe ::Applications::CreateService do
let(:user) { create(:user) }
let(:params) { attributes_for(:application) }
let(:request) { ActionController::TestRequest.new({ remote_ip: "127.0.0.1" }, ActionController::TestSession.new) }
let(:request) { ActionController::TestRequest.new({ remote_ip: "127.0.0.1" }, ActionController::TestSession.new, nil) }
subject { described_class.new(user, params) }
......
......@@ -26,11 +26,7 @@ module Gitlab
subscribe('sql.active_record') do |_, start, finish, _, data|
if Gitlab::SafeRequestStore.store[:peek_enabled]
# data[:cached] is only available starting from Rails 5.1.0
# https://github.com/rails/rails/blob/v5.1.0/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb#L113
# Before that, data[:name] was set to 'CACHE'
# https://github.com/rails/rails/blob/v4.2.9/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb#L80
unless data.fetch(:cached, data[:name] == 'CACHE')
unless data[:cached]
track_query(data[:sql].strip, data[:binds], start, finish)
end
end
......
......@@ -113,7 +113,7 @@ module Gitlab
issues.full_search(query)
end
issues.reorder('updated_at DESC')
issues.reorder('issues.updated_at DESC')
end
# rubocop: enable CodeReuse/ActiveRecord
......@@ -121,7 +121,7 @@ module Gitlab
def milestones
milestones = Milestone.where(project_id: project_ids_relation)
milestones = milestones.search(query)
milestones.reorder('updated_at DESC')
milestones.reorder('milestones.updated_at DESC')
end
# rubocop: enable CodeReuse/ActiveRecord
......@@ -139,7 +139,7 @@ module Gitlab
merge_requests.full_search(query)
end
merge_requests.reorder('updated_at DESC')
merge_requests.reorder('merge_requests.updated_at DESC')
end
# rubocop: enable CodeReuse/ActiveRecord
......
......@@ -5,7 +5,7 @@
"iid": { "type": "integer" },
"author_id": { "type": "integer" },
"description": { "type": ["string", "null"] },
"lock_version": { "type": ["string", "null"] },
"lock_version": { "type": ["integer", "null"] },
"milestone_id": { "type": ["string", "null"] },
"title": { "type": "string" },
"moved_to_id": { "type": ["integer", "null"] },
......
......@@ -23,7 +23,7 @@
},
"task_status": { "type": "string" },
"task_status_short": { "type": "string" },
"lock_version": { "type": ["string", "null"] }
"lock_version": { "type": ["integer", "null"] }
},
"additionalProperties": false
}
......@@ -58,7 +58,7 @@ describe('MergeRequest', function() {
{
merge_request: {
description: '- [ ] Task List Item',
lock_version: undefined,
lock_version: 0,
update_task: { line_number: lineNumber, line_source: lineSource, index, checked },
},
},
......
......@@ -177,7 +177,7 @@ describe Gitlab::BackgroundMigration::DeserializeMergeRequestDiffsAndCommits, :m
end
before do
allow_any_instance_of(described_class::MergeRequestDiff::ActiveRecord_Relation)
allow_any_instance_of(ActiveRecord::Relation)
.to receive(:update_all).and_raise(exception)
end
......
......@@ -29,7 +29,7 @@ describe 'Import/Export attribute configuration' do
it 'has no new columns' do
relation_names.each do |relation_name|
relation_class = relation_class_for_name(relation_name)
relation_attributes = relation_class.new.attributes.keys
relation_attributes = relation_class.new.attributes.keys - relation_class.encrypted_attributes.keys.map(&:to_s)
current_attributes = parsed_attributes(relation_name, relation_attributes)
safe_attributes = safe_model_attributes[relation_class.to_s].dup || []
......
......@@ -73,9 +73,8 @@ describe Ci::Runner do
end
it 'fails to save a group assigned to a project runner even if the runner is already saved' do
group_runner
expect { create(:group, runners: [project_runner]) }
group.runners << project_runner
expect { group.save! }
.to raise_error(ActiveRecord::RecordInvalid)
end
end
......
......@@ -68,7 +68,7 @@ describe API::Runner, :clean_gitlab_redis_shared_state do
post api('/runners'), params: { token: group.runners_token }
expect(response).to have_http_status 201
expect(group.runners.size).to eq(1)
expect(group.runners.reload.size).to eq(1)
runner = Ci::Runner.first
expect(runner.token).not_to eq(registration_token)
expect(runner.token).not_to eq(group.runners_token)
......
......@@ -251,8 +251,8 @@ describe 'Rack Attack global throttles' do
let(:throttle_setting_prefix) { 'throttle_authenticated_web' }
context 'with the token in the query string' do
let(:get_args) { [rss_url(user), nil] }
let(:other_user_get_args) { [rss_url(other_user), nil] }
let(:get_args) { [rss_url(user), params: nil] }
let(:other_user_get_args) { [rss_url(other_user), params: nil] }
it_behaves_like 'rate-limited token-authenticated requests'
end
......
......@@ -210,6 +210,8 @@ describe Users::DestroyService do
describe "calls the before/after callbacks" do
it 'of project_members' do
expect_any_instance_of(ProjectMember).to receive(:run_callbacks).with(:find).once
expect_any_instance_of(ProjectMember).to receive(:run_callbacks).with(:initialize).once
expect_any_instance_of(ProjectMember).to receive(:run_callbacks).with(:destroy).once
service.execute(user)
......@@ -219,6 +221,8 @@ describe Users::DestroyService do
group_member = create(:group_member)
group_member.group.group_members.create(user: user, access_level: 40)
expect_any_instance_of(GroupMember).to receive(:run_callbacks).with(:find).once
expect_any_instance_of(GroupMember).to receive(:run_callbacks).with(:initialize).once
expect_any_instance_of(GroupMember).to receive(:run_callbacks).with(:destroy).once
service.execute(user)
......
......@@ -80,7 +80,7 @@ describe Users::MigrateToGhostUserService do
context "when record migration fails with a rollback exception" do
before do
expect_any_instance_of(MergeRequest::ActiveRecord_Associations_CollectionProxy)
expect_any_instance_of(ActiveRecord::Associations::CollectionProxy)
.to receive(:update_all).and_raise(ActiveRecord::Rollback)
end
......
......@@ -17,7 +17,7 @@ module ActiveRecord
def callback(name, start, finish, message_id, values)
show_backtrace(values) if ENV['QUERY_RECORDER_DEBUG']
if values[:name]&.include?("CACHE") && skip_cached
if values[:cached] && skip_cached
@cached << values[:sql]
elsif !values[:name]&.include?("SCHEMA")
@log << values[:sql]
......
# frozen_string_literal: true
module TestRequestHelpers
def test_request(remote_ip: '127.0.0.1')
ActionController::TestRequest.new({ remote_ip: remote_ip }, ActionController::TestSession.new)
def test_request(remote_ip: '127.0.0.1', controller: nil)
ActionController::TestRequest.new({ remote_ip: remote_ip }, ActionController::TestSession.new, controller)
end
end
......@@ -45,7 +45,7 @@ shared_examples "migrating a deleted user's associated records to the ghost user
context "race conditions" do
context "when #{record_class_name} migration fails and is rolled back" do
before do
expect_any_instance_of(record_class::ActiveRecord_Associations_CollectionProxy)
expect_any_instance_of(ActiveRecord::Associations::CollectionProxy)
.to receive(:update_all).and_raise(ActiveRecord::Rollback)
end
......@@ -66,7 +66,7 @@ shared_examples "migrating a deleted user's associated records to the ghost user
context "when #{record_class_name} migration fails with a non-rollback exception" do
before do
expect_any_instance_of(record_class::ActiveRecord_Associations_CollectionProxy)
expect_any_instance_of(ActiveRecord::Associations::CollectionProxy)
.to receive(:update_all).and_raise(ArgumentError)
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment