From 6eb3991a52962b86a154cdfc425a7aad4a678d93 Mon Sep 17 00:00:00 2001 From: Fabrice Lecomte Date: Tue, 30 Jul 2019 09:50:29 +0200 Subject: [PATCH] refactoring #19: rename fixture files --- resources/sql/fixtures/{user.sql => 01-user.sql} | 0 resources/sql/fixtures/{citizen.sql => 02-citizen.sql} | 0 resources/sql/fixtures/{workgroup.sql => 03-workgroup.sql} | 0 resources/sql/fixtures/{article.sql => 04-article.sql} | 0 .../sql/fixtures/{constitution.sql => 05-constitution.sql} | 0 resources/sql/fixtures/{follow.sql => 06-follow.sql} | 0 resources/sql/fixtures/{comment.sql => 07-comment.sql} | 0 resources/sql/fixtures/{vote.sql => 08-vote.sql} | 0 resources/sql/functions/helpers/random_between.sql | 7 +++++++ 9 files changed, 7 insertions(+) rename resources/sql/fixtures/{user.sql => 01-user.sql} (100%) rename resources/sql/fixtures/{citizen.sql => 02-citizen.sql} (100%) rename resources/sql/fixtures/{workgroup.sql => 03-workgroup.sql} (100%) rename resources/sql/fixtures/{article.sql => 04-article.sql} (100%) rename resources/sql/fixtures/{constitution.sql => 05-constitution.sql} (100%) rename resources/sql/fixtures/{follow.sql => 06-follow.sql} (100%) rename resources/sql/fixtures/{comment.sql => 07-comment.sql} (100%) rename resources/sql/fixtures/{vote.sql => 08-vote.sql} (100%) create mode 100644 resources/sql/functions/helpers/random_between.sql diff --git a/resources/sql/fixtures/user.sql b/resources/sql/fixtures/01-user.sql similarity index 100% rename from resources/sql/fixtures/user.sql rename to resources/sql/fixtures/01-user.sql diff --git a/resources/sql/fixtures/citizen.sql b/resources/sql/fixtures/02-citizen.sql similarity index 100% rename from resources/sql/fixtures/citizen.sql rename to resources/sql/fixtures/02-citizen.sql diff --git a/resources/sql/fixtures/workgroup.sql b/resources/sql/fixtures/03-workgroup.sql similarity index 100% rename from resources/sql/fixtures/workgroup.sql rename to resources/sql/fixtures/03-workgroup.sql diff --git a/resources/sql/fixtures/article.sql b/resources/sql/fixtures/04-article.sql similarity index 100% rename from resources/sql/fixtures/article.sql rename to resources/sql/fixtures/04-article.sql diff --git a/resources/sql/fixtures/constitution.sql b/resources/sql/fixtures/05-constitution.sql similarity index 100% rename from resources/sql/fixtures/constitution.sql rename to resources/sql/fixtures/05-constitution.sql diff --git a/resources/sql/fixtures/follow.sql b/resources/sql/fixtures/06-follow.sql similarity index 100% rename from resources/sql/fixtures/follow.sql rename to resources/sql/fixtures/06-follow.sql diff --git a/resources/sql/fixtures/comment.sql b/resources/sql/fixtures/07-comment.sql similarity index 100% rename from resources/sql/fixtures/comment.sql rename to resources/sql/fixtures/07-comment.sql diff --git a/resources/sql/fixtures/vote.sql b/resources/sql/fixtures/08-vote.sql similarity index 100% rename from resources/sql/fixtures/vote.sql rename to resources/sql/fixtures/08-vote.sql diff --git a/resources/sql/functions/helpers/random_between.sql b/resources/sql/functions/helpers/random_between.sql new file mode 100644 index 0000000..76e81dd --- /dev/null +++ b/resources/sql/functions/helpers/random_between.sql @@ -0,0 +1,7 @@ +CREATE OR REPLACE FUNCTION random_between(low INT ,high INT) + RETURNS INT AS +$$ +BEGIN + RETURN floor(random()* (high-low + 1) + low); +END; +$$ language 'plpgsql' STRICT; \ No newline at end of file