diff options
author | David Yip <yipdw@member.fsf.org> | 2017-11-27 11:29:04 -0600 |
---|---|---|
committer | David Yip <yipdw@member.fsf.org> | 2017-11-27 11:29:04 -0600 |
commit | e77c3996a513a45e5cad368b0053459f303c60cb (patch) | |
tree | 923411336e4207bb95c17c90c79f19dabb4d62e2 /db/migrate | |
parent | 5de42665d77431def632ca8fb8665082027c60a5 (diff) | |
parent | 1c5b0e333464d8da3de73e4886502c816cb8173e (diff) |
Merge remote-tracking branch 'origin/master' into gs-master
Diffstat (limited to 'db/migrate')
-rw-r--r-- | db/migrate/20171125024930_create_invites.rb | 15 | ||||
-rw-r--r-- | db/migrate/20171125031751_add_invite_id_to_users.rb | 5 |
2 files changed, 20 insertions, 0 deletions
diff --git a/db/migrate/20171125024930_create_invites.rb b/db/migrate/20171125024930_create_invites.rb new file mode 100644 index 000000000..bcf03bd72 --- /dev/null +++ b/db/migrate/20171125024930_create_invites.rb @@ -0,0 +1,15 @@ +class CreateInvites < ActiveRecord::Migration[5.1] + def change + create_table :invites do |t| + t.belongs_to :user, foreign_key: { on_delete: :cascade } + t.string :code, null: false, default: '' + t.datetime :expires_at, null: true, default: nil + t.integer :max_uses, null: true, default: nil + t.integer :uses, null: false, default: 0 + + t.timestamps + end + + add_index :invites, :code, unique: true + end +end diff --git a/db/migrate/20171125031751_add_invite_id_to_users.rb b/db/migrate/20171125031751_add_invite_id_to_users.rb new file mode 100644 index 000000000..16829f866 --- /dev/null +++ b/db/migrate/20171125031751_add_invite_id_to_users.rb @@ -0,0 +1,5 @@ +class AddInviteIdToUsers < ActiveRecord::Migration[5.1] + def change + add_reference :users, :invite, null: true, default: nil, foreign_key: { on_delete: :nullify }, index: false + end +end |