zed/crates/collab/migrations/20220518151305_add_invites_to_users.sql
Nathan Sobo cfb31067a5 Add invite codes / counts to users table
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-05-18 09:56:37 -06:00

8 lines
262 B
SQL

ALTER TABLE users
ADD invite_code VARCHAR(64),
ADD invite_count INTEGER NOT NULL DEFAULT 0,
ADD inviter_id INTEGER REFERENCES users (id),
ADD created_at TIMESTAMP NOT NULL DEFAULT NOW();
CREATE UNIQUE INDEX "index_invite_code_users" ON "users" ("invite_code");