Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose #schema_creation methods #45806

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -1448,6 +1448,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 @@ -1542,10 +1548,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