Create Tag tables and Add Tag endpoint
This commit is contained in:
3
migrations/2021-09-02-000740_create_tags/down.sql
Normal file
3
migrations/2021-09-02-000740_create_tags/down.sql
Normal file
@@ -0,0 +1,3 @@
|
||||
DROP TABLE tags;
|
||||
DROP TABLE tagged_photo;
|
||||
|
||||
11
migrations/2021-09-02-000740_create_tags/up.sql
Normal file
11
migrations/2021-09-02-000740_create_tags/up.sql
Normal file
@@ -0,0 +1,11 @@
|
||||
CREATE TABLE tags (
|
||||
id INTEGER PRIMARY KEY NOT NULL,
|
||||
name TEXT NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE tagged_photo (
|
||||
id INTEGER PRIMARY KEY NOT NULL,
|
||||
photo_name TEXT NOT NULL,
|
||||
tag_id INTEGER NOT NULL,
|
||||
CONSTRAINT tagid FOREIGN KEY (tag_id) REFERENCES tags (id) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
);
|
||||
Reference in New Issue
Block a user