Skip to content

Commit fc930e8

Browse files
committed
feat(database): add status and user_id columns to logout table
1 parent 9ed81a0 commit fc930e8

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
-- +goose Up
2+
-- +goose StatementBegin
3+
ALTER TABLE public.logout
4+
ADD COLUMN status smallint DEFAULT 1,
5+
ADD COLUMN user_id int8;
6+
7+
ALTER TABLE public.logout
8+
ADD CONSTRAINT fk_logout_user FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE SET NULL;
9+
10+
ALTER TABLE public.logout
11+
ADD CONSTRAINT chk_logout_status CHECK (status IN (0, 1));
12+
-- +goose StatementEnd
13+
14+
-- +goose Down
15+
-- +goose StatementBegin
16+
ALTER TABLE public.logout
17+
DROP CONSTRAINT IF EXISTS fk_logout_user;
18+
ALTER TABLE public.logout
19+
DROP CONSTRAINT IF EXISTS chk_logout_status;
20+
21+
ALTER TABLE public.logout
22+
DROP COLUMN IF EXISTS user_id,
23+
DROP COLUMN IF EXISTS status;
24+
-- +goose StatementEnd

0 commit comments

Comments
 (0)