Skip to content
Source
Sign inSign up
fuko/trytanstackdb.com
Open History to see the last commit

migrations.json

27 lines2.2 KB

1[
2 {
3 "sql": [
4 "CREATE TABLE \"boards\" (\n\t\"id\" text PRIMARY KEY NOT NULL,\n\t\"name\" text NOT NULL,\n\t\"description\" text,\n\t\"created_at\" date NOT NULL,\n\t\"project_id\" text NOT NULL\n);\n",
5 "\nCREATE TABLE \"projects\" (\n\t\"id\" text PRIMARY KEY NOT NULL,\n\t\"name\" text NOT NULL,\n\t\"description\" text NOT NULL,\n\t\"created_at\" date NOT NULL,\n\tCONSTRAINT \"projects_name_unique\" UNIQUE(\"name\")\n);\n",
6 "\nCREATE TABLE \"seed_script_runs\" (\n\t\"id\" text PRIMARY KEY NOT NULL,\n\t\"created_at\" date NOT NULL,\n\t\"state\" text\n);\n",
7 "\nCREATE TABLE \"todo_items\" (\n\t\"id\" text PRIMARY KEY NOT NULL,\n\t\"title\" text NOT NULL,\n\t\"description\" text,\n\t\"created_at\" date NOT NULL,\n\t\"board_id\" text NOT NULL,\n\t\"priority\" integer DEFAULT 0,\n\t\"position\" text NOT NULL\n);\n",
8 "\nCREATE TABLE \"users\" (\n\t\"id\" text PRIMARY KEY NOT NULL,\n\t\"name\" text NOT NULL,\n\t\"age\" integer NOT NULL,\n\t\"email\" text NOT NULL,\n\tCONSTRAINT \"users_email_unique_tempdbid\" UNIQUE(\"email\")\n);\n",
9 "\nALTER TABLE \"boards\" ADD CONSTRAINT \"boards_project_id_projects_id_fk\" FOREIGN KEY (\"project_id\") REFERENCES \"public\".\"projects\"(\"id\") ON DELETE cascade ON UPDATE no action;",
10 "\nALTER TABLE \"todo_items\" ADD CONSTRAINT \"todo_items_board_id_boards_id_fk\" FOREIGN KEY (\"board_id\") REFERENCES \"public\".\"boards\"(\"id\") ON DELETE cascade ON UPDATE no action;",
11 "\nCREATE INDEX \"todo_items_board_id_position_idx\" ON \"todo_items\" USING btree (\"board_id\",\"position\");"
12 ],
13 "bps": true,
14 "folderMillis": 1766184598553,
15 "hash": "34b95068a8520477abc224439403ce87853814c878b1e4457492528b98cbe70b"
16 },
17 {
18 "sql": [
19 "ALTER TABLE \"todo_items\" ADD COLUMN \"project_id\" text NOT NULL;",
20 "\nALTER TABLE \"todo_items\" ADD CONSTRAINT \"todo_items_project_id_projects_id_fk\" FOREIGN KEY (\"project_id\") REFERENCES \"public\".\"projects\"(\"id\") ON DELETE cascade ON UPDATE no action;",
21 "\nCREATE INDEX \"todo_items_project_id_idx\" ON \"todo_items\" USING btree (\"project_id\");"
22 ],
23 "bps": true,
24 "folderMillis": 1767455245894,
25 "hash": "6f5679430929920907927eacc8252c4256cd9bf75c1b568cd164b906d6e9403d"
26 }