Initial commit with basic DB layout
This commit is contained in:
3
migrations/2023-01-03-134423_create_user/down.sql
Normal file
3
migrations/2023-01-03-134423_create_user/down.sql
Normal file
@@ -0,0 +1,3 @@
|
||||
-- This file should undo anything in `up.sql`
|
||||
DROP TABLE UserFollows;
|
||||
DROP TABLE Users;
|
||||
20
migrations/2023-01-03-134423_create_user/up.sql
Normal file
20
migrations/2023-01-03-134423_create_user/up.sql
Normal file
@@ -0,0 +1,20 @@
|
||||
-- Your SQL goes here
|
||||
|
||||
CREATE TABLE Users (
|
||||
id VARCHAR(31) PRIMARY KEY, -- Appwrite User ID
|
||||
username VARCHAR(64) NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE UserFollows (
|
||||
id SERIAL PRIMARY KEY,
|
||||
follower VARCHAR(31)
|
||||
REFERENCES Users(id)
|
||||
ON UPDATE CASCADE
|
||||
ON DELETE CASCADE
|
||||
NOT NULL,
|
||||
following VARCHAR(31)
|
||||
REFERENCES Users(id)
|
||||
ON UPDATE CASCADE
|
||||
ON DELETE CASCADE
|
||||
NOT NULL
|
||||
);
|
||||
Reference in New Issue
Block a user