diff --git a/PostText.pl b/PostText.pl index b5e53e7..1ff8125 100755 --- a/PostText.pl +++ b/PostText.pl @@ -34,4 +34,6 @@ get '/view', sub ($c) { app->secrets(app->config->{'secrets'}) || die $@; +app->pg->migrations->from_dir('migrations')->migrate(); + app->start(); diff --git a/migrations/1/down.sql b/migrations/1/down.sql index e69de29..0c8b7cd 100644 --- a/migrations/1/down.sql +++ b/migrations/1/down.sql @@ -0,0 +1 @@ +DROP TABLE threads; diff --git a/migrations/1/up.sql b/migrations/1/up.sql index e69de29..54e760d 100644 --- a/migrations/1/up.sql +++ b/migrations/1/up.sql @@ -0,0 +1,9 @@ +CREATE TABLE IF NOT EXISTS threads ( + thread_id SERIAL PRIMARY KEY, + thread_date TIMESTAMPTZ DEFAULT now(), + thread_author VARCHAR(64), + thread_title VARCHAR(256), + thread_body VARCHAR(4096), + hidden_status BOOLEAN NOT NULL, + flagged_status BOOLEAN NOT NULL +);