Adds migrations for new models
This commit is contained in:
parent
96fc234068
commit
5a75fd94bb
3 changed files with 25 additions and 1 deletions
|
|
@ -6,4 +6,4 @@ CREATE table user (
|
||||||
);
|
);
|
||||||
|
|
||||||
-- +migrate Down
|
-- +migrate Down
|
||||||
DROP TABLE users;
|
DROP TABLE user;
|
||||||
|
|
|
||||||
11
internal/database/migrations/2_feed.sql
Normal file
11
internal/database/migrations/2_feed.sql
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
-- +migrate Up
|
||||||
|
CREATE table feed (
|
||||||
|
id INTEGER PRIMARY KEY,
|
||||||
|
name text NOT NULL,
|
||||||
|
url text NOT NULL UNIQUE,
|
||||||
|
userId text NOT NULL,
|
||||||
|
FOREIGN KEY (userId) REFERENCES user(id)
|
||||||
|
);
|
||||||
|
|
||||||
|
-- +migrate Down
|
||||||
|
DROP TABLE feed;
|
||||||
13
internal/database/migrations/3_article.sql
Normal file
13
internal/database/migrations/3_article.sql
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
-- +migrate Up
|
||||||
|
CREATE table article (
|
||||||
|
id INTEGER PRIMARY KEY,
|
||||||
|
name text NOT NULL,
|
||||||
|
url text NOT NULL UNIQUE,
|
||||||
|
read INTEGER DEFAULT 0,
|
||||||
|
readAt text,
|
||||||
|
feedId INTEGER,
|
||||||
|
FOREIGN KEY (feedId) REFERENCES feed(id)
|
||||||
|
);
|
||||||
|
|
||||||
|
-- +migrate Down
|
||||||
|
DROP TABLE article;
|
||||||
Loading…
Add table
Add a link
Reference in a new issue