Skip to content

Commit 1c6f7fe

Browse files
committed
foreign key
1 parent 2c3a3f3 commit 1c6f7fe

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

coderd/database/migrations/000293_user_configs.up.sql

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
CREATE TABLE IF NOT EXISTS user_configs (
2-
user_id uuid NOT NULL,
3-
key varchar(256) NOT NULL,
4-
value text NOT NULL
2+
user_id uuid NOT NULL,
3+
key varchar(256) NOT NULL,
4+
value text NOT NULL,
5+
6+
PRIMARY KEY (user_id, key),
7+
FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE
58
);
69

710
ALTER TABLE ONLY user_configs

0 commit comments

Comments
 (0)