From 64e3fb0134f92ff743d7acc72db4c2b3f863ed67 Mon Sep 17 00:00:00 2001 From: Fabrice Lecomte Date: Wed, 18 Mar 2020 02:18:10 +0100 Subject: [PATCH] Add script to launch SQL test --- .idea/runConfigurations/SQL_Tests.xml | 13 +++++++++++++ src/main/resources/sql/fixtures/08-vote.sql | 2 +- src/main/resources/sql/fixtures/09-opinion.sql | 2 -- .../sql/functions/article/find_article_by_id.sql | 2 +- .../sql/functions/article/find_articles.sql | 3 --- .../article/find_articles_versions_by_id.sql | 2 +- .../find_articles_versions_by_version_id.sql | 2 +- .../article/find_last_article_by_version_id.sql | 1 - .../sql/functions/article/upsert_article.sql | 1 - .../sql/functions/citizen/find_citizen_by_email.sql | 1 - .../sql/functions/citizen/find_citizen_by_id.sql | 1 - .../citizen/find_citizen_by_id_with_user.sql | 1 - .../functions/citizen/find_citizen_by_user_id.sql | 1 - .../functions/citizen/find_citizen_by_username.sql | 1 - .../sql/functions/citizen/find_citizens.sql | 2 +- .../functions/citizen/insert_citizen_with_user.sql | 1 - .../sql/functions/citizen/upsert_citizen.sql | 1 - .../resources/sql/functions/comment/comment.sql | 1 - .../sql/functions/comment/edit_comment.sql | 4 ---- .../sql/functions/comment/find_comment_by_id.sql | 2 +- .../functions/comment/find_comments_by_citizen.sql | 2 -- .../functions/comment/find_comments_by_parent.sql | 2 -- .../functions/comment/find_comments_by_target.sql | 2 +- .../constitution/create_title_in_constitution.sql | 1 - .../constitution/find_constitution_by_id.sql | 1 - .../constitution/find_constitution_title_by_id.sql | 1 - .../constitution/find_constitution_titles_by_id.sql | 2 -- .../functions/constitution/find_constitutions.sql | 2 -- .../functions/constitution/upsert_constitution.sql | 2 -- .../resources/sql/functions/follow/find_follow.sql | 2 -- .../follow/find_follows_article_by_citizen.sql | 2 -- .../follow/find_follows_article_by_target.sql | 5 ----- .../functions/follow/find_follows_by_citizen.sql | 1 - .../follow/find_follows_constitution_by_citizen.sql | 2 +- src/main/resources/sql/functions/follow/follow.sql | 1 - .../resources/sql/functions/follow/unfollow.sql | 1 - .../sql/functions/helpers/find_reference_by_id.sql | 4 ---- .../sql/functions/opinion/count_opinion.sql | 4 ---- .../sql/functions/opinion/find_citizen_opinions.sql | 2 -- .../opinion/find_citizen_opinions_by_target_id.sql | 2 +- .../opinion/find_citizen_opinions_by_target_ids.sql | 4 ---- .../sql/functions/opinion/find_opinion_by_id.sql | 2 +- .../functions/opinion/find_opinion_by_opinion.sql | 2 +- .../functions/opinion/find_opinion_choice_by_id.sql | 4 ---- .../sql/functions/opinion/find_opinion_choices.sql | 4 ---- .../sql/functions/opinion/upsert_opinion.sql | 1 - .../sql/functions/opinion/upsert_opinion_choice.sql | 1 - .../sql/functions/user/change_user_password.sql | 1 - .../resources/sql/functions/user/check_user.sql | 1 - .../sql/functions/user/find_user_by_id.sql | 1 - .../sql/functions/user/find_user_by_username.sql | 1 - .../resources/sql/functions/user/insert_user.sql | 1 - .../resources/sql/functions/vote/count_vote.sql | 4 ---- .../vote/find_citizen_votes_by_target_ids.sql | 2 +- .../sql/functions/vote/find_votes_by_citizen.sql | 2 +- src/main/resources/sql/functions/vote/vote.sql | 1 - .../functions/workgroup/add_workgroup_members.sql | 2 +- .../functions/workgroup/find_workgroup_by_id.sql | 2 +- .../functions/workgroup/find_workgroup_members.sql | 2 +- .../sql/functions/workgroup/find_workgroups.sql | 3 --- .../workgroup/remove_workgroup_members.sql | 1 - .../workgroup/update_workgroup_members.sql | 1 - .../sql/functions/workgroup/upsert_workgroup.sql | 1 - src/test/sql/constitution.sql | 3 --- src/test/sql/fixtures/fixture_article.sql | 2 +- src/test/sql/fixtures/fixture_citizen.sql | 2 +- src/test/sql/fixtures/fixture_user.sql | 2 +- src/test/sql/fixtures/fixture_workgroup.sql | 2 +- src/test/sql/opinion.sql | 1 - src/test/test.sh | 6 ++++++ 70 files changed, 39 insertions(+), 108 deletions(-) create mode 100644 .idea/runConfigurations/SQL_Tests.xml create mode 100644 src/test/test.sh diff --git a/.idea/runConfigurations/SQL_Tests.xml b/.idea/runConfigurations/SQL_Tests.xml new file mode 100644 index 0000000..9472e2c --- /dev/null +++ b/.idea/runConfigurations/SQL_Tests.xml @@ -0,0 +1,13 @@ + + + + \ No newline at end of file diff --git a/src/main/resources/sql/fixtures/08-vote.sql b/src/main/resources/sql/fixtures/08-vote.sql index ba1252d..ccf37a3 100644 --- a/src/main/resources/sql/fixtures/08-vote.sql +++ b/src/main/resources/sql/fixtures/08-vote.sql @@ -7,7 +7,7 @@ begin delete from vote_for_constitution; delete from vote_for_comment_on_article; delete from vote_for_comment_on_constitution; -raise notice '%', article_count; + insert into vote_for_article (id, created_by_id, target_id, note, anonymous) select uuid_in(md5('vote_for_article'||row_number() over ())::cstring), diff --git a/src/main/resources/sql/fixtures/09-opinion.sql b/src/main/resources/sql/fixtures/09-opinion.sql index 7791ea5..9665b52 100644 --- a/src/main/resources/sql/fixtures/09-opinion.sql +++ b/src/main/resources/sql/fixtures/09-opinion.sql @@ -25,8 +25,6 @@ begin join (select *, row_number() over () rn from article) a using (rn); end loop; - raise notice '% opinion inserted', (select count(*) from opinion_on_article); - raise notice 'opinions fixtures done'; end; $$; diff --git a/src/main/resources/sql/functions/article/find_article_by_id.sql b/src/main/resources/sql/functions/article/find_article_by_id.sql index 0707434..1092a35 100644 --- a/src/main/resources/sql/functions/article/find_article_by_id.sql +++ b/src/main/resources/sql/functions/article/find_article_by_id.sql @@ -18,4 +18,4 @@ begin end; $$; --- drop function if exists find_article_by_id(uuid, out json); + diff --git a/src/main/resources/sql/functions/article/find_articles.sql b/src/main/resources/sql/functions/article/find_articles.sql index 8c6f032..564298e 100644 --- a/src/main/resources/sql/functions/article/find_articles.sql +++ b/src/main/resources/sql/functions/article/find_articles.sql @@ -60,6 +60,3 @@ begin ) as t; end; $$; - --- drop function if exists find_articles(text, json, text, text, int, int); --- select find_article_by_id('d91aa0cd-61d6-83cc-41bb-8d5656e130f7'); \ No newline at end of file diff --git a/src/main/resources/sql/functions/article/find_articles_versions_by_id.sql b/src/main/resources/sql/functions/article/find_articles_versions_by_id.sql index 0483b34..d871538 100644 --- a/src/main/resources/sql/functions/article/find_articles_versions_by_id.sql +++ b/src/main/resources/sql/functions/article/find_articles_versions_by_id.sql @@ -15,4 +15,4 @@ begin end; $$; --- drop function if exists find_articles_versions_by_id(uuid, int, int, out json); + diff --git a/src/main/resources/sql/functions/article/find_articles_versions_by_version_id.sql b/src/main/resources/sql/functions/article/find_articles_versions_by_version_id.sql index 31ffdce..022d539 100644 --- a/src/main/resources/sql/functions/article/find_articles_versions_by_version_id.sql +++ b/src/main/resources/sql/functions/article/find_articles_versions_by_version_id.sql @@ -25,4 +25,4 @@ begin end; $$; --- drop function if exists find_articles_versions_by_version_id(uuid, int, int, out json); + diff --git a/src/main/resources/sql/functions/article/find_last_article_by_version_id.sql b/src/main/resources/sql/functions/article/find_last_article_by_version_id.sql index d0c8d31..c891154 100644 --- a/src/main/resources/sql/functions/article/find_last_article_by_version_id.sql +++ b/src/main/resources/sql/functions/article/find_last_article_by_version_id.sql @@ -21,4 +21,3 @@ begin end; $$; --- drop function if exists find_last_article_by_version_id(uuid, inout json); \ No newline at end of file diff --git a/src/main/resources/sql/functions/article/upsert_article.sql b/src/main/resources/sql/functions/article/upsert_article.sql index fd925ba..9b69688 100644 --- a/src/main/resources/sql/functions/article/upsert_article.sql +++ b/src/main/resources/sql/functions/article/upsert_article.sql @@ -64,4 +64,3 @@ begin end; $$; --- drop procedure if exists upsert_article(inout json); \ No newline at end of file diff --git a/src/main/resources/sql/functions/citizen/find_citizen_by_email.sql b/src/main/resources/sql/functions/citizen/find_citizen_by_email.sql index ef3bb40..6784f4c 100644 --- a/src/main/resources/sql/functions/citizen/find_citizen_by_email.sql +++ b/src/main/resources/sql/functions/citizen/find_citizen_by_email.sql @@ -12,4 +12,3 @@ begin end; $$; --- drop function if exists find_citizen_by_email(text, out json); \ No newline at end of file diff --git a/src/main/resources/sql/functions/citizen/find_citizen_by_id.sql b/src/main/resources/sql/functions/citizen/find_citizen_by_id.sql index 6284a0f..d45896b 100644 --- a/src/main/resources/sql/functions/citizen/find_citizen_by_id.sql +++ b/src/main/resources/sql/functions/citizen/find_citizen_by_id.sql @@ -14,4 +14,3 @@ begin end; $$; --- drop function if exists find_citizen_by_id(uuid, inout json); \ No newline at end of file diff --git a/src/main/resources/sql/functions/citizen/find_citizen_by_id_with_user.sql b/src/main/resources/sql/functions/citizen/find_citizen_by_id_with_user.sql index d65b757..2bd3d32 100644 --- a/src/main/resources/sql/functions/citizen/find_citizen_by_id_with_user.sql +++ b/src/main/resources/sql/functions/citizen/find_citizen_by_id_with_user.sql @@ -14,4 +14,3 @@ begin end; $$; --- drop function if exists find_citizen_by_id_with_user(uuid, inout json); \ No newline at end of file diff --git a/src/main/resources/sql/functions/citizen/find_citizen_by_user_id.sql b/src/main/resources/sql/functions/citizen/find_citizen_by_user_id.sql index 001a5ee..9f990cc 100644 --- a/src/main/resources/sql/functions/citizen/find_citizen_by_user_id.sql +++ b/src/main/resources/sql/functions/citizen/find_citizen_by_user_id.sql @@ -14,4 +14,3 @@ begin end; $$; --- drop function if exists find_citizen_by_user_id(uuid, inout json); \ No newline at end of file diff --git a/src/main/resources/sql/functions/citizen/find_citizen_by_username.sql b/src/main/resources/sql/functions/citizen/find_citizen_by_username.sql index 0e54d2a..a540249 100644 --- a/src/main/resources/sql/functions/citizen/find_citizen_by_username.sql +++ b/src/main/resources/sql/functions/citizen/find_citizen_by_username.sql @@ -15,4 +15,3 @@ begin end; $$; --- drop function if exists find_citizen_by_username(text, out json); \ No newline at end of file diff --git a/src/main/resources/sql/functions/citizen/find_citizens.sql b/src/main/resources/sql/functions/citizen/find_citizens.sql index 065b141..1220b59 100644 --- a/src/main/resources/sql/functions/citizen/find_citizens.sql +++ b/src/main/resources/sql/functions/citizen/find_citizens.sql @@ -41,4 +41,4 @@ begin end; $$; --- drop function if exists find_citizens(text, text, text, int, int); + diff --git a/src/main/resources/sql/functions/citizen/insert_citizen_with_user.sql b/src/main/resources/sql/functions/citizen/insert_citizen_with_user.sql index bdf1bf3..3119896 100644 --- a/src/main/resources/sql/functions/citizen/insert_citizen_with_user.sql +++ b/src/main/resources/sql/functions/citizen/insert_citizen_with_user.sql @@ -30,4 +30,3 @@ begin end; $$; --- drop function if exists create_citizen_with_user(inout json); \ No newline at end of file diff --git a/src/main/resources/sql/functions/citizen/upsert_citizen.sql b/src/main/resources/sql/functions/citizen/upsert_citizen.sql index 7eec961..9bf51b3 100644 --- a/src/main/resources/sql/functions/citizen/upsert_citizen.sql +++ b/src/main/resources/sql/functions/citizen/upsert_citizen.sql @@ -27,4 +27,3 @@ begin end; $$; --- drop function if exists upsert_citizen(inout json); \ No newline at end of file diff --git a/src/main/resources/sql/functions/comment/comment.sql b/src/main/resources/sql/functions/comment/comment.sql index 7288577..803515b 100644 --- a/src/main/resources/sql/functions/comment/comment.sql +++ b/src/main/resources/sql/functions/comment/comment.sql @@ -21,4 +21,3 @@ begin end; $$; --- drop function if exists comment(regclass, uuid, uuid, text, uuid); \ No newline at end of file diff --git a/src/main/resources/sql/functions/comment/edit_comment.sql b/src/main/resources/sql/functions/comment/edit_comment.sql index 18d1249..f68039e 100644 --- a/src/main/resources/sql/functions/comment/edit_comment.sql +++ b/src/main/resources/sql/functions/comment/edit_comment.sql @@ -7,7 +7,3 @@ begin where c.id = _id; end; $$; - --- drop function if exists edit_comment(uuid, text); - --- select edit_comment('b0422e48-687f-bea7-b45f-b6b301246e97', 'plop4') \ No newline at end of file diff --git a/src/main/resources/sql/functions/comment/find_comment_by_id.sql b/src/main/resources/sql/functions/comment/find_comment_by_id.sql index fdbafdc..95ac3a6 100644 --- a/src/main/resources/sql/functions/comment/find_comment_by_id.sql +++ b/src/main/resources/sql/functions/comment/find_comment_by_id.sql @@ -18,4 +18,4 @@ begin end; $$; --- drop function if exists find_comment_by_id(uuid, out json); + diff --git a/src/main/resources/sql/functions/comment/find_comments_by_citizen.sql b/src/main/resources/sql/functions/comment/find_comments_by_citizen.sql index 900d3d9..fcbec84 100644 --- a/src/main/resources/sql/functions/comment/find_comments_by_citizen.sql +++ b/src/main/resources/sql/functions/comment/find_comments_by_citizen.sql @@ -37,5 +37,3 @@ begin ) as t; end; $$; - --- drop function if exists find_comments_by_citizen(uuid, regclass, int, int); diff --git a/src/main/resources/sql/functions/comment/find_comments_by_parent.sql b/src/main/resources/sql/functions/comment/find_comments_by_parent.sql index fca1991..830873f 100644 --- a/src/main/resources/sql/functions/comment/find_comments_by_parent.sql +++ b/src/main/resources/sql/functions/comment/find_comments_by_parent.sql @@ -24,5 +24,3 @@ begin ) as t; end; $$; - --- drop function if exists find_comments_by_parent(uuid, int, int); diff --git a/src/main/resources/sql/functions/comment/find_comments_by_target.sql b/src/main/resources/sql/functions/comment/find_comments_by_target.sql index e8b5879..8cdb562 100644 --- a/src/main/resources/sql/functions/comment/find_comments_by_target.sql +++ b/src/main/resources/sql/functions/comment/find_comments_by_target.sql @@ -34,4 +34,4 @@ begin end; $$; --- drop function if exists find_comments_by_target(uuid, int, int); + diff --git a/src/main/resources/sql/functions/constitution/create_title_in_constitution.sql b/src/main/resources/sql/functions/constitution/create_title_in_constitution.sql index 548d98e..99195de 100644 --- a/src/main/resources/sql/functions/constitution/create_title_in_constitution.sql +++ b/src/main/resources/sql/functions/constitution/create_title_in_constitution.sql @@ -29,4 +29,3 @@ begin end; $$; --- drop function if exists create_title_in_constitution(out json); \ No newline at end of file diff --git a/src/main/resources/sql/functions/constitution/find_constitution_by_id.sql b/src/main/resources/sql/functions/constitution/find_constitution_by_id.sql index e830051..0faaeba 100644 --- a/src/main/resources/sql/functions/constitution/find_constitution_by_id.sql +++ b/src/main/resources/sql/functions/constitution/find_constitution_by_id.sql @@ -16,4 +16,3 @@ begin end; $$; --- drop function if exists find_constitution_by_id(uuid, out json); \ No newline at end of file diff --git a/src/main/resources/sql/functions/constitution/find_constitution_title_by_id.sql b/src/main/resources/sql/functions/constitution/find_constitution_title_by_id.sql index d4296b9..b816174 100644 --- a/src/main/resources/sql/functions/constitution/find_constitution_title_by_id.sql +++ b/src/main/resources/sql/functions/constitution/find_constitution_title_by_id.sql @@ -21,4 +21,3 @@ begin end; $$; --- drop function if exists find_constitution_title_by_id(uuid, out json); \ No newline at end of file diff --git a/src/main/resources/sql/functions/constitution/find_constitution_titles_by_id.sql b/src/main/resources/sql/functions/constitution/find_constitution_titles_by_id.sql index 8f1e695..f616378 100644 --- a/src/main/resources/sql/functions/constitution/find_constitution_titles_by_id.sql +++ b/src/main/resources/sql/functions/constitution/find_constitution_titles_by_id.sql @@ -16,5 +16,3 @@ begin ) as t; end; $$; - --- drop function if exists find_constitution_titles_by_id(uuid, out json); \ No newline at end of file diff --git a/src/main/resources/sql/functions/constitution/find_constitutions.sql b/src/main/resources/sql/functions/constitution/find_constitutions.sql index 66dde45..4f02ae0 100644 --- a/src/main/resources/sql/functions/constitution/find_constitutions.sql +++ b/src/main/resources/sql/functions/constitution/find_constitutions.sql @@ -39,5 +39,3 @@ begin ) as t; end; $$; - --- drop function if exists find_constitutions(text, text, text, int, int); diff --git a/src/main/resources/sql/functions/constitution/upsert_constitution.sql b/src/main/resources/sql/functions/constitution/upsert_constitution.sql index 4968c73..8f9ac9a 100644 --- a/src/main/resources/sql/functions/constitution/upsert_constitution.sql +++ b/src/main/resources/sql/functions/constitution/upsert_constitution.sql @@ -52,5 +52,3 @@ begin select find_constitution_by_id(new_id) into resource; end; $$; - --- drop function if exists upsert_constitution(inout json); \ No newline at end of file diff --git a/src/main/resources/sql/functions/follow/find_follow.sql b/src/main/resources/sql/functions/follow/find_follow.sql index 412bb69..ab9fbd1 100644 --- a/src/main/resources/sql/functions/follow/find_follow.sql +++ b/src/main/resources/sql/functions/follow/find_follow.sql @@ -21,5 +21,3 @@ begin select resource is not null into following; end; $$; - --- drop function if exists find_follow(uuid, uuid); diff --git a/src/main/resources/sql/functions/follow/find_follows_article_by_citizen.sql b/src/main/resources/sql/functions/follow/find_follows_article_by_citizen.sql index 1d7f3d5..1d6f0c3 100644 --- a/src/main/resources/sql/functions/follow/find_follows_article_by_citizen.sql +++ b/src/main/resources/sql/functions/follow/find_follows_article_by_citizen.sql @@ -22,5 +22,3 @@ begin ) as t; end; $$; - --- drop function if exists find_follows_article_by_citizen(uuid, int, int); diff --git a/src/main/resources/sql/functions/follow/find_follows_article_by_target.sql b/src/main/resources/sql/functions/follow/find_follows_article_by_target.sql index 99408c0..fb08b76 100644 --- a/src/main/resources/sql/functions/follow/find_follows_article_by_target.sql +++ b/src/main/resources/sql/functions/follow/find_follows_article_by_target.sql @@ -30,8 +30,3 @@ begin ) as t; end $$; - --- drop function if exists find_follows_article_by_target(uuid, int, int); --- select * from find_follows_article_by_target('32518c76-5c58-3cd1-00cd-7f9d0bb872cd', 20, 0); --- select * from find_follows_article_by_target('24a373f4-c321-4006-8d05-3c50f95a561b', 100, 0); --- SELECT * FROM find_follows_article_by_target ("_target_id" := '24a373f4-c321-4006-8d05-3c50f95a561b'::uuid, "offset" := 0::int, "limit" := 300::int) \ No newline at end of file diff --git a/src/main/resources/sql/functions/follow/find_follows_by_citizen.sql b/src/main/resources/sql/functions/follow/find_follows_by_citizen.sql index 5022b4a..8166627 100644 --- a/src/main/resources/sql/functions/follow/find_follows_by_citizen.sql +++ b/src/main/resources/sql/functions/follow/find_follows_by_citizen.sql @@ -23,4 +23,3 @@ begin end; $$; --- drop function if exists find_follows_by_citizen(uuid, int, int); diff --git a/src/main/resources/sql/functions/follow/find_follows_constitution_by_citizen.sql b/src/main/resources/sql/functions/follow/find_follows_constitution_by_citizen.sql index e4d86a8..538f8ca 100644 --- a/src/main/resources/sql/functions/follow/find_follows_constitution_by_citizen.sql +++ b/src/main/resources/sql/functions/follow/find_follows_constitution_by_citizen.sql @@ -23,4 +23,4 @@ begin end; $$; --- drop function if exists find_follows_constitution_by_citizen(uuid, int, int); + diff --git a/src/main/resources/sql/functions/follow/follow.sql b/src/main/resources/sql/functions/follow/follow.sql index 5f845d1..d989251 100644 --- a/src/main/resources/sql/functions/follow/follow.sql +++ b/src/main/resources/sql/functions/follow/follow.sql @@ -20,4 +20,3 @@ begin end; $$; --- drop function if exists follow(regclass, uuid, uuid); \ No newline at end of file diff --git a/src/main/resources/sql/functions/follow/unfollow.sql b/src/main/resources/sql/functions/follow/unfollow.sql index 14c4853..14c88fc 100644 --- a/src/main/resources/sql/functions/follow/unfollow.sql +++ b/src/main/resources/sql/functions/follow/unfollow.sql @@ -37,4 +37,3 @@ begin end; $$; --- drop function if exists unfollow(regclass, uuid, uuid); \ No newline at end of file diff --git a/src/main/resources/sql/functions/helpers/find_reference_by_id.sql b/src/main/resources/sql/functions/helpers/find_reference_by_id.sql index 709c59a..cd5fa03 100644 --- a/src/main/resources/sql/functions/helpers/find_reference_by_id.sql +++ b/src/main/resources/sql/functions/helpers/find_reference_by_id.sql @@ -23,7 +23,3 @@ begin resource = resource::jsonb || jsonb_build_object('reference', _reference); end $$; - --- drop function if exists find_reference_by_id(uuid, regclass, out json); - --- select find_reference_by_id('8944221c-3766-f952-7064-9f229c288049'::uuid, 'constitution'::regclass) \ No newline at end of file diff --git a/src/main/resources/sql/functions/opinion/count_opinion.sql b/src/main/resources/sql/functions/opinion/count_opinion.sql index 5675ce1..eccb272 100644 --- a/src/main/resources/sql/functions/opinion/count_opinion.sql +++ b/src/main/resources/sql/functions/opinion/count_opinion.sql @@ -21,7 +21,3 @@ begin resource = coalesce(agg, empty); end; $$; - --- drop function if exists count_opinion(uuid); - --- select * from count_opinion('d91aa0cd-61d6-83cc-41bb-8d5656e130f7'); \ No newline at end of file diff --git a/src/main/resources/sql/functions/opinion/find_citizen_opinions.sql b/src/main/resources/sql/functions/opinion/find_citizen_opinions.sql index 02567e5..467205b 100644 --- a/src/main/resources/sql/functions/opinion/find_citizen_opinions.sql +++ b/src/main/resources/sql/functions/opinion/find_citizen_opinions.sql @@ -44,5 +44,3 @@ begin ) t; end $$; - --- select * from find_citizen_opinions('6434f4f9-f570-f22a-c134-8668350651ff', null, null, 2, 2); diff --git a/src/main/resources/sql/functions/opinion/find_citizen_opinions_by_target_id.sql b/src/main/resources/sql/functions/opinion/find_citizen_opinions_by_target_id.sql index 5150ad2..4268690 100644 --- a/src/main/resources/sql/functions/opinion/find_citizen_opinions_by_target_id.sql +++ b/src/main/resources/sql/functions/opinion/find_citizen_opinions_by_target_id.sql @@ -27,4 +27,4 @@ begin end; $$; --- drop function if exists find_citizen_votes_by_target_ids(uuid, uuid[], regclass); + diff --git a/src/main/resources/sql/functions/opinion/find_citizen_opinions_by_target_ids.sql b/src/main/resources/sql/functions/opinion/find_citizen_opinions_by_target_ids.sql index 926b8c6..03d0cb7 100644 --- a/src/main/resources/sql/functions/opinion/find_citizen_opinions_by_target_ids.sql +++ b/src/main/resources/sql/functions/opinion/find_citizen_opinions_by_target_ids.sql @@ -24,7 +24,3 @@ begin ) t; end; $$; - --- drop function if exists find_citizen_votes_by_target_ids(uuid, uuid[], regclass); - --- select * from find_citizen_opinions_by_target_ids('045b6e9e-5a9e-d9b0-75d4-e51f0bc6cd21', '{32a18b25-507d-49d8-5168-7675fb6a7b8c, 429bfd8c-ebc2-09ac-227f-28bcdaa91d84, 550f4543-35a3-9910-e493-70d26b931473}') \ No newline at end of file diff --git a/src/main/resources/sql/functions/opinion/find_opinion_by_id.sql b/src/main/resources/sql/functions/opinion/find_opinion_by_id.sql index 1e6c19c..48408d9 100644 --- a/src/main/resources/sql/functions/opinion/find_opinion_by_id.sql +++ b/src/main/resources/sql/functions/opinion/find_opinion_by_id.sql @@ -19,4 +19,4 @@ begin end; $$; --- drop function if exists find_opinion_by_id(uuid, out json); + diff --git a/src/main/resources/sql/functions/opinion/find_opinion_by_opinion.sql b/src/main/resources/sql/functions/opinion/find_opinion_by_opinion.sql index 7aef3d2..4e5e4f3 100644 --- a/src/main/resources/sql/functions/opinion/find_opinion_by_opinion.sql +++ b/src/main/resources/sql/functions/opinion/find_opinion_by_opinion.sql @@ -24,4 +24,4 @@ begin end; $$; --- drop function if exists find_opinion_by_opinion(json); + diff --git a/src/main/resources/sql/functions/opinion/find_opinion_choice_by_id.sql b/src/main/resources/sql/functions/opinion/find_opinion_choice_by_id.sql index 89acb19..2e4b8db 100644 --- a/src/main/resources/sql/functions/opinion/find_opinion_choice_by_id.sql +++ b/src/main/resources/sql/functions/opinion/find_opinion_choice_by_id.sql @@ -9,7 +9,3 @@ begin and (ol.id = _id); end; $$; - --- drop function if exists find_opinion_choice_by_id(); - --- select find_opinion_choice_by_id('8c6cb3cc-cac5-93ad-312e-6bd87d9916d9'); \ No newline at end of file diff --git a/src/main/resources/sql/functions/opinion/find_opinion_choices.sql b/src/main/resources/sql/functions/opinion/find_opinion_choices.sql index 22cc273..32b5ac1 100644 --- a/src/main/resources/sql/functions/opinion/find_opinion_choices.sql +++ b/src/main/resources/sql/functions/opinion/find_opinion_choices.sql @@ -18,7 +18,3 @@ begin ) t; end; $$; - --- drop function if exists find_opinions(); - --- select find_opinion_choices('{}'); diff --git a/src/main/resources/sql/functions/opinion/upsert_opinion.sql b/src/main/resources/sql/functions/opinion/upsert_opinion.sql index 2a2ada3..f90e179 100644 --- a/src/main/resources/sql/functions/opinion/upsert_opinion.sql +++ b/src/main/resources/sql/functions/opinion/upsert_opinion.sql @@ -20,4 +20,3 @@ begin end; $$; --- drop function if exists upsert_opinion(json); \ No newline at end of file diff --git a/src/main/resources/sql/functions/opinion/upsert_opinion_choice.sql b/src/main/resources/sql/functions/opinion/upsert_opinion_choice.sql index 496ae37..f2ddced 100644 --- a/src/main/resources/sql/functions/opinion/upsert_opinion_choice.sql +++ b/src/main/resources/sql/functions/opinion/upsert_opinion_choice.sql @@ -17,4 +17,3 @@ begin end; $$; --- drop function if exists upsert_opinion_choice(json); \ No newline at end of file diff --git a/src/main/resources/sql/functions/user/change_user_password.sql b/src/main/resources/sql/functions/user/change_user_password.sql index eaa915e..e1e8593 100644 --- a/src/main/resources/sql/functions/user/change_user_password.sql +++ b/src/main/resources/sql/functions/user/change_user_password.sql @@ -9,4 +9,3 @@ begin end; $$; --- drop function if exists change_user_password(json); \ No newline at end of file diff --git a/src/main/resources/sql/functions/user/check_user.sql b/src/main/resources/sql/functions/user/check_user.sql index 2297b31..8cfcec0 100644 --- a/src/main/resources/sql/functions/user/check_user.sql +++ b/src/main/resources/sql/functions/user/check_user.sql @@ -15,4 +15,3 @@ begin end; $$; --- drop function if exists check_user(text, text, out json); \ No newline at end of file diff --git a/src/main/resources/sql/functions/user/find_user_by_id.sql b/src/main/resources/sql/functions/user/find_user_by_id.sql index 99fdaa1..bfc2b3c 100644 --- a/src/main/resources/sql/functions/user/find_user_by_id.sql +++ b/src/main/resources/sql/functions/user/find_user_by_id.sql @@ -9,4 +9,3 @@ begin end; $$; --- drop function if exists find_user_by_id(uuid, out json); \ No newline at end of file diff --git a/src/main/resources/sql/functions/user/find_user_by_username.sql b/src/main/resources/sql/functions/user/find_user_by_username.sql index 60ab0d8..8578931 100644 --- a/src/main/resources/sql/functions/user/find_user_by_username.sql +++ b/src/main/resources/sql/functions/user/find_user_by_username.sql @@ -9,4 +9,3 @@ begin end; $$; --- drop function if exists find_user_by_username(text, out json); \ No newline at end of file diff --git a/src/main/resources/sql/functions/user/insert_user.sql b/src/main/resources/sql/functions/user/insert_user.sql index 6135f66..1b50dd6 100644 --- a/src/main/resources/sql/functions/user/insert_user.sql +++ b/src/main/resources/sql/functions/user/insert_user.sql @@ -17,4 +17,3 @@ begin end; $$; --- drop function if exists insert_user(inout json); \ No newline at end of file diff --git a/src/main/resources/sql/functions/vote/count_vote.sql b/src/main/resources/sql/functions/vote/count_vote.sql index 6e507b3..14d1bfe 100644 --- a/src/main/resources/sql/functions/vote/count_vote.sql +++ b/src/main/resources/sql/functions/vote/count_vote.sql @@ -36,7 +36,3 @@ begin jsonb_build_object('percent', percent); end; $$; - --- drop function if exists count_vote(uuid); - --- select * from count_vote('ced1563f-ecf5-4f11-8518-8aeceff3c13a'); \ No newline at end of file diff --git a/src/main/resources/sql/functions/vote/find_citizen_votes_by_target_ids.sql b/src/main/resources/sql/functions/vote/find_citizen_votes_by_target_ids.sql index 2c978d5..421321f 100644 --- a/src/main/resources/sql/functions/vote/find_citizen_votes_by_target_ids.sql +++ b/src/main/resources/sql/functions/vote/find_citizen_votes_by_target_ids.sql @@ -29,4 +29,4 @@ begin end; $$; --- drop function if exists find_citizen_votes_by_target_ids(uuid, uuid[], regclass); + diff --git a/src/main/resources/sql/functions/vote/find_votes_by_citizen.sql b/src/main/resources/sql/functions/vote/find_votes_by_citizen.sql index 981cc1f..69816e4 100644 --- a/src/main/resources/sql/functions/vote/find_votes_by_citizen.sql +++ b/src/main/resources/sql/functions/vote/find_votes_by_citizen.sql @@ -37,4 +37,4 @@ begin end; $$; --- drop function if exists find_votes_by_citizen(uuid, regclass, int, int); + diff --git a/src/main/resources/sql/functions/vote/vote.sql b/src/main/resources/sql/functions/vote/vote.sql index 45ce410..e9ce156 100644 --- a/src/main/resources/sql/functions/vote/vote.sql +++ b/src/main/resources/sql/functions/vote/vote.sql @@ -38,4 +38,3 @@ begin end; $$; --- drop function if exists vote(regclass,uuid,uuid,integer,boolean); \ No newline at end of file diff --git a/src/main/resources/sql/functions/workgroup/add_workgroup_members.sql b/src/main/resources/sql/functions/workgroup/add_workgroup_members.sql index 152ceb8..8425fd4 100644 --- a/src/main/resources/sql/functions/workgroup/add_workgroup_members.sql +++ b/src/main/resources/sql/functions/workgroup/add_workgroup_members.sql @@ -14,4 +14,4 @@ begin end; $$; --- drop procedure if exists update_workgroup_members(in uuid, inout json); + diff --git a/src/main/resources/sql/functions/workgroup/find_workgroup_by_id.sql b/src/main/resources/sql/functions/workgroup/find_workgroup_by_id.sql index 7b8173d..ff93e0e 100644 --- a/src/main/resources/sql/functions/workgroup/find_workgroup_by_id.sql +++ b/src/main/resources/sql/functions/workgroup/find_workgroup_by_id.sql @@ -18,5 +18,5 @@ begin end; $$; --- drop function if exists find_workgroup_by_id(uuid, out json); + -- select * from find_workgroup_by_id('d011ad4c-fa1b-40a3-593b-7816479ff33b') diff --git a/src/main/resources/sql/functions/workgroup/find_workgroup_members.sql b/src/main/resources/sql/functions/workgroup/find_workgroup_members.sql index 07915ac..60556f0 100644 --- a/src/main/resources/sql/functions/workgroup/find_workgroup_members.sql +++ b/src/main/resources/sql/functions/workgroup/find_workgroup_members.sql @@ -13,4 +13,4 @@ begin end; $$; --- drop function if exists find_workgroup_members(uuid, out json); + diff --git a/src/main/resources/sql/functions/workgroup/find_workgroups.sql b/src/main/resources/sql/functions/workgroup/find_workgroups.sql index 6a5c6c1..29f985d 100644 --- a/src/main/resources/sql/functions/workgroup/find_workgroups.sql +++ b/src/main/resources/sql/functions/workgroup/find_workgroups.sql @@ -54,6 +54,3 @@ begin ) as t; end; $$; - --- drop function if exists find_workgroups(text, json, text, text, int, int); --- select * from find_workgroups('49', "limit" := 2) \ No newline at end of file diff --git a/src/main/resources/sql/functions/workgroup/remove_workgroup_members.sql b/src/main/resources/sql/functions/workgroup/remove_workgroup_members.sql index a0ecd61..bd41c3b 100644 --- a/src/main/resources/sql/functions/workgroup/remove_workgroup_members.sql +++ b/src/main/resources/sql/functions/workgroup/remove_workgroup_members.sql @@ -14,4 +14,3 @@ begin end $$; --- drop procedure if exists remove_workgroup_members(in uuid, inout json); \ No newline at end of file diff --git a/src/main/resources/sql/functions/workgroup/update_workgroup_members.sql b/src/main/resources/sql/functions/workgroup/update_workgroup_members.sql index 6cd439d..6b1e36b 100644 --- a/src/main/resources/sql/functions/workgroup/update_workgroup_members.sql +++ b/src/main/resources/sql/functions/workgroup/update_workgroup_members.sql @@ -23,4 +23,3 @@ begin end; $$; --- drop procedure if exists update_workgroup_members(in uuid, inout json); \ No newline at end of file diff --git a/src/main/resources/sql/functions/workgroup/upsert_workgroup.sql b/src/main/resources/sql/functions/workgroup/upsert_workgroup.sql index 67c3ff0..6e8789c 100644 --- a/src/main/resources/sql/functions/workgroup/upsert_workgroup.sql +++ b/src/main/resources/sql/functions/workgroup/upsert_workgroup.sql @@ -31,4 +31,3 @@ begin end; $$; --- drop procedure if exists upsert_workgroup(inout json); \ No newline at end of file diff --git a/src/test/sql/constitution.sql b/src/test/sql/constitution.sql index ec1d6aa..c230209 100644 --- a/src/test/sql/constitution.sql +++ b/src/test/sql/constitution.sql @@ -30,6 +30,3 @@ begin raise notice 'constitution test pass'; end $$; - - --- select uuid_generate_v4(); \ No newline at end of file diff --git a/src/test/sql/fixtures/fixture_article.sql b/src/test/sql/fixtures/fixture_article.sql index 7d00617..ff35bb4 100644 --- a/src/test/sql/fixtures/fixture_article.sql +++ b/src/test/sql/fixtures/fixture_article.sql @@ -24,4 +24,4 @@ begin select (a->>'id')::uuid into _article_id from upsert_article(created_article) a; end if; end; -$$ \ No newline at end of file +$$; diff --git a/src/test/sql/fixtures/fixture_citizen.sql b/src/test/sql/fixtures/fixture_citizen.sql index 5c400f9..00c6df8 100644 --- a/src/test/sql/fixtures/fixture_citizen.sql +++ b/src/test/sql/fixtures/fixture_citizen.sql @@ -21,4 +21,4 @@ begin select upsert_citizen(created_citizen) into created_citizen; _citizen_id := created_citizen->>'id'; end -$$ \ No newline at end of file +$$; diff --git a/src/test/sql/fixtures/fixture_user.sql b/src/test/sql/fixtures/fixture_user.sql index 8c0aa3f..e7e61d0 100644 --- a/src/test/sql/fixtures/fixture_user.sql +++ b/src/test/sql/fixtures/fixture_user.sql @@ -15,4 +15,4 @@ begin select insert_user(created_user) into created_user; user_id := created_user->>'id'; end -$$ \ No newline at end of file +$$; diff --git a/src/test/sql/fixtures/fixture_workgroup.sql b/src/test/sql/fixtures/fixture_workgroup.sql index cdf029c..a2178e3 100644 --- a/src/test/sql/fixtures/fixture_workgroup.sql +++ b/src/test/sql/fixtures/fixture_workgroup.sql @@ -26,4 +26,4 @@ begin select upsert_workgroup(created_workgroup) into created_workgroup; assert created_workgroup->>'description' is not null, 'description should not be null'; end; -$$ \ No newline at end of file +$$; diff --git a/src/test/sql/opinion.sql b/src/test/sql/opinion.sql index 41b6fe2..a8a4378 100644 --- a/src/test/sql/opinion.sql +++ b/src/test/sql/opinion.sql @@ -83,7 +83,6 @@ begin assert(select (a#>>'{opinions, Opinion1}')::int = 1 from find_article_by_id((created_article->>'id')::uuid) a), 'the article must be have a opinion'; - raise notice '%', opinion2; assert(select (opinion2#>>'{choice, id}')::uuid = opinion_choice2_id), 'opinion2 is not inserted'; assert(select (opinion2#>>'{choice, name}') = 'Opinion2'), 'no name for opinion2'; diff --git a/src/test/test.sh b/src/test/test.sh new file mode 100644 index 0000000..393242e --- /dev/null +++ b/src/test/test.sh @@ -0,0 +1,6 @@ +#bin/bash +echo "Start tests" +cat ../main/resources/sql/functions/*/*.sql ../main/resources/sql/migrations/*.sql ./sql/fixtures/*.sql ./sql/*.sql > ./allSQL.sql +docker exec -i postgresql_dc-project psql test test -q -b -v "ON_ERROR_STOP=1" < ./allSQL.sql +rm ./allSQL.sql +#sleep 20 \ No newline at end of file