remove_belongs_to

remove_belongs_to(table_name, ref_name, options = {}) Instance Public methods Alias for: remove_reference

native_database_types

native_database_types() Instance Public methods Returns a hash of mappings from the abstract data types to the native database types. See ActiveRecord::ConnectionAdapters::TableDefinition#column for details on the recognized abstract data types.

initialize_schema_migrations_table

initialize_schema_migrations_table() Instance Public methods Should not be called normally, but this operation is non-destructive. The migrations module handles this automatically.

index_name_exists?

index_name_exists?(table_name, index_name, default) Instance Public methods Verifies the existence of an index with a given name. The default argument is returned if the underlying implementation does not define the indexes method, as there's no way to determine the correct answer in that case.

index_exists?

index_exists?(table_name, column_name, options = {}) Instance Public methods Checks to see if an index exists on a table for a given index definition. # Check an index exists index_exists?(:suppliers, :company_id) # Check an index on multiple columns exists index_exists?(:suppliers, [:company_id, :company_type]) # Check a unique index exists index_exists?(:suppliers, :company_id, unique: true) # Check an index with a custom name exists index_exists?(:suppliers, :company_id, name

drop_table

drop_table(table_name, options = {}) Instance Public methods Drops a table from the database. Although this command ignores options and the block if one is given, it can be helpful to provide these in a migration's change method so it can be reverted. In that case, options and the block will be used by create_table.

drop_join_table

drop_join_table(table_1, table_2, options = {}) Instance Public methods Drops the join table specified by the given arguments. See create_join_table for details. Although this command ignores the block if one is given, it can be helpful to provide one in a migration's change method so it can be reverted. In that case, the block will be used by create_join_table.

create_table

create_table(table_name, options = {}) Instance Public methods Creates a new table with the name table_name. table_name may either be a String or a Symbol. There are two ways to work with create_table. You can use the block form or the regular form, like this: Block form # create_table() passes a TableDefinition object to the block. # This form will not only create the table, but also columns for the # table. create_table(:suppliers) do |t| t.column :name, :string, limit: 60 #

create_join_table

create_join_table(table_1, table_2, options = {}) Instance Public methods Creates a new join table with the name created using the lexical order of the first two arguments. These arguments can be a String or a Symbol. # Creates a table called 'assemblies_parts' with no id. create_join_table(:assemblies, :parts) You can pass a options hash can include the following keys: :table_name Sets the table name overriding the default :column_options Any extra options you want appende

columns

columns(table_name) Instance Public methods Returns an array of Column objects for the table specified by table_name. See the concrete implementation for details on the expected parameter values.