Created
September 10, 2021 21:05
-
-
Save RomanTurner/a3e331bfd78d7b31a77b5c2b369c3d02 to your computer and use it in GitHub Desktop.
A list of types you can use in the Rails migration dsl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def change | |
create_table :table do |t| | |
t.column # adds an ordinary column. Ex: t.column(:name, :string) | |
t.index # adds a new index. | |
t.timestamps | |
t.change # changes the column definition. Ex: t.change(:name, :string, :limit => 80) | |
t.change_default # changes the column default value. | |
t.rename # changes the name of the column. | |
t.references | |
t.belongs_to #alias for references | |
t.string | |
t.text | |
t.integer | |
t.float | |
t.decimal | |
t.datetime | |
t.text | |
t.timestamp | |
t.time | |
t.date | |
t.binary | |
t.boolean | |
t.remove | |
t.remove_references | |
t.remove_belongs_to | |
t.remove_index | |
t.remove_timestamps | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment