Fixture not delete table content before apply

This commit is contained in:
2020-06-01 13:52:48 +02:00
parent 7874f5cec4
commit a6c36c542e
9 changed files with 0 additions and 24 deletions

View File

@@ -4,7 +4,6 @@ declare
_password text := crypt('azerty', gen_salt('bf', 8)); _password text := crypt('azerty', gen_salt('bf', 8));
multiple int = coalesce(current_setting('fixture.quantity.multiple', true), '50')::int; multiple int = coalesce(current_setting('fixture.quantity.multiple', true), '50')::int;
begin begin
delete from "user";
insert into "user" (id, username, password, blocked_at, roles) insert into "user" (id, username, password, blocked_at, roles)
select select
uuid_in(md5('user'||rn::text)::cstring), uuid_in(md5('user'||rn::text)::cstring),

View File

@@ -1,7 +1,6 @@
do do
$$ $$
begin begin
delete from citizen;
insert into citizen (id, name, birthday, user_id, vote_anonymous, follow_anonymous, email) insert into citizen (id, name, birthday, user_id, vote_anonymous, follow_anonymous, email)
select select
uuid_in(md5('citizen'||row_number() over ()::text)::cstring), uuid_in(md5('citizen'||row_number() over ()::text)::cstring),

View File

@@ -8,9 +8,6 @@ declare
} }
$roles$; $roles$;
begin begin
delete from citizen_in_workgroup;
delete from workgroup;
insert into workgroup (id, created_by_id, name, description, anonymous) insert into workgroup (id, created_by_id, name, description, anonymous)
select select
uuid_in(md5('workgroup'||rn::text)::cstring), uuid_in(md5('workgroup'||rn::text)::cstring),

View File

@@ -11,9 +11,6 @@ declare
_citizen_count int = (select count(z) from citizen z); _citizen_count int = (select count(z) from citizen z);
_workgroup_count int = (select count(w) from workgroup w); _workgroup_count int = (select count(w) from workgroup w);
begin begin
delete from article_relations;
delete from article;
insert into article (id, version_id, created_by_id, workgroup_id, title, anonymous, content, description, tags, created_at, draft) insert into article (id, version_id, created_by_id, workgroup_id, title, anonymous, content, description, tags, created_at, draft)
select select
uuid_in(md5('article'||row_number() over ())::cstring), uuid_in(md5('article'||row_number() over ())::cstring),

View File

@@ -3,10 +3,6 @@ $$
declare declare
article_count int = (select count(*) from article); article_count int = (select count(*) from article);
begin begin
delete from article_in_title;
delete from title;
delete from constitution;
insert into constitution (id, version_id, created_by_id, title, anonymous, created_at) insert into constitution (id, version_id, created_by_id, title, anonymous, created_at)
select select
uuid_in(md5('constitution'||row_number() over ())::cstring), uuid_in(md5('constitution'||row_number() over ())::cstring),

View File

@@ -3,8 +3,6 @@ $$
declare declare
article_count int = (select count(*) from article); article_count int = (select count(*) from article);
begin begin
delete from follow;
insert into follow_article (id, created_by_id, target_id) insert into follow_article (id, created_by_id, target_id)
select select
uuid_in(md5('follow_article'||row_number() over ())::cstring), uuid_in(md5('follow_article'||row_number() over ())::cstring),

View File

@@ -3,8 +3,6 @@ $$
declare declare
article_count int = (select count(*) from article); article_count int = (select count(*) from article);
begin begin
delete from comment;
insert into comment_on_article (id, created_by_id, target_id, content) insert into comment_on_article (id, created_by_id, target_id, content)
select select
uuid_in(md5('comment_on_article'||row_number() over ())::cstring), uuid_in(md5('comment_on_article'||row_number() over ())::cstring),

View File

@@ -3,11 +3,6 @@ $$
declare declare
article_count int = (select count(*) from article); article_count int = (select count(*) from article);
begin begin
delete from vote_for_article;
delete from vote_for_constitution;
delete from vote_for_comment_on_article;
delete from vote_for_comment_on_constitution;
insert into vote_for_article (id, created_by_id, target_id, note, anonymous) insert into vote_for_article (id, created_by_id, target_id, note, anonymous)
select select
uuid_in(md5('vote_for_article'||row_number() over ())::cstring), uuid_in(md5('vote_for_article'||row_number() over ())::cstring),

View File

@@ -3,9 +3,6 @@ $$
declare declare
article_count int = (select count(*) from article); article_count int = (select count(*) from article);
begin begin
delete from opinion_on_article;
delete from opinion_choice;
insert into opinion_choice (id, name, target) insert into opinion_choice (id, name, target)
select select
uuid_in(md5('opinion_choice'||row_number() over ())::cstring), uuid_in(md5('opinion_choice'||row_number() over ())::cstring),