lemmy/migrations/2021-11-23-153753_add_invite_only_columns/up.sql
Dessalines be1389420b
Adding SQL format checking via pg_format / pgFormatter (#3740)
* SQL format checking, 1.

* SQL format checking, 2.

* SQL format checking, 3.

* SQL format checking, 4.

* SQL format checking, 5.

* Running pg_format

* Getting rid of comment.

* Upping pg_format version.

* Using git ls-files for sql format check.

* Fixing sql lints.

* Addressing PR comments.
2023-08-02 12:44:51 -04:00

27 lines
832 B
SQL

-- Add columns to site table
ALTER TABLE site
ADD COLUMN require_application boolean NOT NULL DEFAULT FALSE;
ALTER TABLE site
ADD COLUMN application_question text;
ALTER TABLE site
ADD COLUMN private_instance boolean NOT NULL DEFAULT FALSE;
-- Add pending to local_user
ALTER TABLE local_user
ADD COLUMN accepted_application boolean NOT NULL DEFAULT FALSE;
CREATE TABLE registration_application (
id serial PRIMARY KEY,
local_user_id int REFERENCES local_user ON UPDATE CASCADE ON DELETE CASCADE NOT NULL,
answer text NOT NULL,
admin_id int REFERENCES person ON UPDATE CASCADE ON DELETE CASCADE,
deny_reason text,
published timestamp NOT NULL DEFAULT now(),
UNIQUE (local_user_id)
);
CREATE INDEX idx_registration_application_published ON registration_application (published DESC);