From 5d6f9e613ce5e6320594d54505e3473f7e83e3b2 Mon Sep 17 00:00:00 2001 From: Fabrice Lecomte Date: Thu, 25 Jul 2019 18:47:17 +0200 Subject: [PATCH] feature #3: create table constitution --- resources/sql/migrations/0000-init.down.sql | 4 +++- resources/sql/migrations/0000-init.up.sql | 19 +++++++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/resources/sql/migrations/0000-init.down.sql b/resources/sql/migrations/0000-init.down.sql index 683caae..5682408 100644 --- a/resources/sql/migrations/0000-init.down.sql +++ b/resources/sql/migrations/0000-init.down.sql @@ -1,4 +1,6 @@ drop trigger generate_version_number_trigger on article; drop table article; drop function generate_version_number(regclass, uuid); -drop function set_version_number(); \ No newline at end of file +drop function set_version_number(); +drop trigger generate_version_number_trigger on constitution; +drop table constitution; \ No newline at end of file diff --git a/resources/sql/migrations/0000-init.up.sql b/resources/sql/migrations/0000-init.up.sql index 6607a36..0f7702f 100644 --- a/resources/sql/migrations/0000-init.up.sql +++ b/resources/sql/migrations/0000-init.up.sql @@ -17,17 +17,32 @@ $$; create table article ( id uuid default uuid_generate_v4() not null, + created_at timestamptz default now() not null, version_id uuid default uuid_generate_v4() not null, version_number int not null, title text not null, annonymous boolean default false not null, content text not null, description text, - tags varchar(32)[] default '{}' not null, - created_at timestamptz default now() not null + tags varchar(32)[] default '{}' not null ); CREATE TRIGGER generate_version_number_trigger BEFORE INSERT ON article EXECUTE PROCEDURE set_version_number(); + +create table constitution +( + id uuid default uuid_generate_v4() not null, + created_at timestamptz default now() not null, + version_id uuid default uuid_generate_v4() not null, + version_number int not null, + title text not null, + annonymous boolean default false not null +); + +CREATE TRIGGER generate_version_number_trigger + BEFORE INSERT + ON constitution +EXECUTE PROCEDURE set_version_number(); \ No newline at end of file