Skip to content

Instantly share code, notes, and snippets.

@danielevans
Created June 20, 2020 21:54
Show Gist options
  • Save danielevans/49a2438b70466e8f5f940332a8efed95 to your computer and use it in GitHub Desktop.
Save danielevans/49a2438b70466e8f5f940332a8efed95 to your computer and use it in GitHub Desktop.
Migration Example in Rails
class CreateGames < ActiveRecord::Migration[5.2]
def change
create_table :games do |t|
t.integer :player_count
t.integer :board_count
t.string :rotation
t.datetime :starts_at
t.string :commongame_reference
t.timestamps
end
end
end
Column | Type | Collation | Nullable | Default
----------------------+-----------------------------+-----------+----------+-----------------------------------
id | bigint | | not null | nextval('games_id_seq'::regclass)
board_count | integer | | |
rotation | character varying | | |
starts_at | timestamp without time zone | | |
commongame_reference | character varying | | |
created_at | timestamp without time zone | | not null |
updated_at | timestamp without time zone | | not null |
Indexes:
"games_pkey" PRIMARY KEY, btree (id)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment