diff --git a/manage/cmd/migration/scripts/4_add_instance_invites.sql b/manage/cmd/migration/scripts/4_add_instance_invites.sql new file mode 100644 index 0000000..37786a5 --- /dev/null +++ b/manage/cmd/migration/scripts/4_add_instance_invites.sql @@ -0,0 +1,12 @@ +CREATE TABLE IF NOT EXISTS instance_invites ( + code text PRIMARY KEY, + + created_at timestamp without time zone default (now() at time zone 'utc'), + + temporary bool DEFAULT false, + expires_at timestamp without time zone, + + uses bigint DEFAULT 0, + + max_uses bigint DEFAULT -1 +); diff --git a/schema.sql b/schema.sql index 81a5fd9..8aca85a 100644 --- a/schema.sql +++ b/schema.sql @@ -40,6 +40,21 @@ INSERT INTO user_conn_apps (id, name) VALUES (9, 'Skype'); INSERT INTO user_conn_apps (id, name) VALUES (10, 'League of Legends'); +CREATE TABLE IF NOT EXISTS instance_invites ( + code text PRIMARY KEY, + + created_at timestamp without time zone default (now() at time zone 'utc'), + + temporary bool DEFAULT false, + expires_at timestamp without time zone, + + uses bigint DEFAULT 0, + + -- -1 means infinite uses + max_uses bigint DEFAULT -1 +); + + CREATE TABLE IF NOT EXISTS icons ( -- can be 'user', 'guild', 'emoji' scope text NOT NULL,