• (see #column for usage)
  • #drop_column
  • #rename_column (the first argument is the old name, while the second is the new name)
  • #add_index (see #index for usage)
  • #add_primary_key (see #primary_key for usage)
  • #add_foreign_key (see for usage)
  • #add_constraint (see #constraint for usage)
  • #drop_constraint (accepts the name of the constraint as argument)
  • #add_unique_constraint
  • #set_column_default (accepts the name of the column and the default value as comma separated args)
  • #set_column_type (accepts the name of the column and the new type as comma separated args)
  • #set_column_not_null (accepts the name of the column)
  • To add a unique constraint use add_unique_constraint(:column_name)

Some methods can be used without block. Those methods accept the name of the target table as first argument, then the other args.

  • #add_column
  • #drop_column
  • #rename_column
  • #add_index
  • #drop_index
  • #set_column_type

Tables can be renamed via #rename_table. It accepts the old name and the new name as arguments.

Safe operation can be performed via #drop_table?. It drops the table only if it exists.