Class: Gitlab::Database::GitlabSchemaInfo

Inherits:
Struct
  • Object
show all
Defined in:
lib/gitlab/database/gitlab_schema_info.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeGitlabSchemaInfo

Returns a new instance of GitlabSchemaInfo.



17
18
19
20
21
22
23
24
25
26
# File 'lib/gitlab/database/gitlab_schema_info.rb', line 17

def initialize(*)
  super
  self.name = name.to_sym
  self.allow_cross_joins = add_table_specific_allows(
    :joins, convert_array_to_hash(allow_cross_joins))
  self.allow_cross_transactions = add_table_specific_allows(
    :transactions, convert_array_to_hash(allow_cross_transactions))
  self.allow_cross_foreign_keys = add_table_specific_allows(
    :foreign_keys, convert_array_to_hash(allow_cross_foreign_keys))
end

Instance Attribute Details

#allow_cross_foreign_keysObject

Returns the value of attribute allow_cross_foreign_keys

Returns:

  • the current value of allow_cross_foreign_keys



5
6
7
# File 'lib/gitlab/database/gitlab_schema_info.rb', line 5

def allow_cross_foreign_keys
  @allow_cross_foreign_keys
end

#allow_cross_joinsObject

Returns the value of attribute allow_cross_joins

Returns:

  • the current value of allow_cross_joins



5
6
7
# File 'lib/gitlab/database/gitlab_schema_info.rb', line 5

def allow_cross_joins
  @allow_cross_joins
end

#allow_cross_transactionsObject

Returns the value of attribute allow_cross_transactions

Returns:

  • the current value of allow_cross_transactions



5
6
7
# File 'lib/gitlab/database/gitlab_schema_info.rb', line 5

def allow_cross_transactions
  @allow_cross_transactions
end

#descriptionObject

Returns the value of attribute description

Returns:

  • the current value of description



5
6
7
# File 'lib/gitlab/database/gitlab_schema_info.rb', line 5

def description
  @description
end

#disallow_sequencesObject

Returns the value of attribute disallow_sequences

Returns:

  • the current value of disallow_sequences



5
6
7
# File 'lib/gitlab/database/gitlab_schema_info.rb', line 5

def disallow_sequences
  @disallow_sequences
end

#file_pathObject

Returns the value of attribute file_path

Returns:

  • the current value of file_path



5
6
7
# File 'lib/gitlab/database/gitlab_schema_info.rb', line 5

def file_path
  @file_path
end

#nameObject

Returns the value of attribute name

Returns:

  • the current value of name



5
6
7
# File 'lib/gitlab/database/gitlab_schema_info.rb', line 5

def name
  @name
end

#require_sharding_keyObject

Returns the value of attribute require_sharding_key

Returns:

  • the current value of require_sharding_key



5
6
7
# File 'lib/gitlab/database/gitlab_schema_info.rb', line 5

def require_sharding_key
  @require_sharding_key
end

#sharding_root_tablesObject

Returns the value of attribute sharding_root_tables

Returns:

  • the current value of sharding_root_tables



5
6
7
# File 'lib/gitlab/database/gitlab_schema_info.rb', line 5

def sharding_root_tables
  @sharding_root_tables
end

Class Method Details

.load_file(yaml_file) ⇒ Object



28
29
30
31
# File 'lib/gitlab/database/gitlab_schema_info.rb', line 28

def self.load_file(yaml_file)
  content = YAML.load_file(yaml_file)
  new(**content.deep_symbolize_keys.merge(file_path: yaml_file))
end

Instance Method Details

#allow_cross_foreign_keys?(table_schemas, all_tables) ⇒ Boolean

Returns:



41
42
43
# File 'lib/gitlab/database/gitlab_schema_info.rb', line 41

def allow_cross_foreign_keys?(table_schemas, all_tables)
  allowed_for?(allow_cross_foreign_keys, table_schemas, all_tables)
end

#allow_cross_joins?(table_schemas, all_tables) ⇒ Boolean

Returns:



33
34
35
# File 'lib/gitlab/database/gitlab_schema_info.rb', line 33

def allow_cross_joins?(table_schemas, all_tables)
  allowed_for?(allow_cross_joins, table_schemas, all_tables)
end

#allow_cross_transactions?(table_schemas, all_tables) ⇒ Boolean

Returns:



37
38
39
# File 'lib/gitlab/database/gitlab_schema_info.rb', line 37

def allow_cross_transactions?(table_schemas, all_tables)
  allowed_for?(allow_cross_transactions, table_schemas, all_tables)
end