From fda7152c77e39c2d2f7b0a77aab3f09244b086fe Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Sun, 26 Apr 2015 22:37:00 -0700 Subject: [PATCH] start schema --- db/dbconf.yml | 3 +++ db/migrations/20150426212641_initial_schema.sql | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 db/dbconf.yml create mode 100644 db/migrations/20150426212641_initial_schema.sql diff --git a/db/dbconf.yml b/db/dbconf.yml new file mode 100644 index 0000000..5c0e1dd --- /dev/null +++ b/db/dbconf.yml @@ -0,0 +1,3 @@ +development: + driver: postgres + open: user=transmet dbname=transmet password=asdfasdf diff --git a/db/migrations/20150426212641_initial_schema.sql b/db/migrations/20150426212641_initial_schema.sql new file mode 100644 index 0000000..e9c33c2 --- /dev/null +++ b/db/migrations/20150426212641_initial_schema.sql @@ -0,0 +1,16 @@ + +-- +goose Up +-- SQL in section 'Up' is executed when this migration is applied + +CREATE TABLE tags(tag_id SERIAL PRIMARY KEY, name varchar(255), parent_id INTEGER DEFAULT NULL, PRIMARY KEY(tag_id)); + +CREATE TABLE news(news_id INTEGER NOT NULL, url varchar(255), title varchar(255), tag_id integer REFERENCES tags, timestamp timestamp, description text, PRIMARY KEY(timestamp)); + +CREATE TABLE users(username VARCHAR(128), password VARCHAR(128), PRIMARY KEY(username)); + +-- +goose Down +-- SQL section 'Down' is executed when this migration is rolled back + +DROP TABLE tags; +DROP TABLE news; +DROP TABLE users;