Skip to content

Commit

Permalink
Merge pull request #45806 from adrianna-chang-shopify/ac-expose-schem…
Browse files Browse the repository at this point in the history
…a-creation-objects

Expose `#schema_creation` methods
  • Loading branch information
eileencodes committed Aug 12, 2022
2 parents 0c21283 + be83bf4 commit 18da7b6
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 16 deletions.
Expand Up @@ -1442,6 +1442,12 @@ def use_foreign_keys?
supports_foreign_keys? && foreign_keys_enabled?
end

# Returns an instance of SchemaCreation, which can be used to visit a schema definition
# object and return DDL.
def schema_creation # :nodoc:
SchemaCreation.new(self)
end

private
def check_constraint_exists?(table_name, **options)
check_constraint_for(table_name, **options).present?
Expand Down Expand Up @@ -1536,10 +1542,6 @@ def rename_column_indexes(table_name, column_name, new_column_name)
end
end

def schema_creation
SchemaCreation.new(self)
end

def create_table_definition(name, **options)
TableDefinition.new(self, name, **options)
end
Expand Down
Expand Up @@ -125,6 +125,10 @@ def table_alias_length
256 # https://dev.mysql.com/doc/refman/en/identifiers.html
end

def schema_creation # :nodoc:
MySQL::SchemaCreation.new(self)
end

private
CHARSETS_OF_4BYTES_MAXLEN = ["utf8mb4", "utf16", "utf16le", "utf32"]

Expand All @@ -150,10 +154,6 @@ def default_row_format
@default_row_format
end

def schema_creation
MySQL::SchemaCreation.new(self)
end

def create_table_definition(name, **options)
MySQL::TableDefinition.new(self, name, **options)
end
Expand Down
Expand Up @@ -759,11 +759,11 @@ def foreign_key_column_for(table_name) # :nodoc:
super
end

private
def schema_creation
PostgreSQL::SchemaCreation.new(self)
end
def schema_creation # :nodoc:
PostgreSQL::SchemaCreation.new(self)
end

private
def create_table_definition(name, **options)
PostgreSQL::TableDefinition.new(self, name, **options)
end
Expand Down
Expand Up @@ -115,11 +115,11 @@ def create_schema_dumper(options)
SQLite3::SchemaDumper.create(self, options)
end

private
def schema_creation
SQLite3::SchemaCreation.new(self)
end
def schema_creation # :nodoc
SQLite3::SchemaCreation.new(self)
end

private
def create_table_definition(name, **options)
SQLite3::TableDefinition.new(self, name, **options)
end
Expand Down

0 comments on commit 18da7b6

Please sign in to comment.