feature #19: add article fixtures
This commit is contained in:
27
resources/sql/fixtures/article.sql
Normal file
27
resources/sql/fixtures/article.sql
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
do
|
||||||
|
$$
|
||||||
|
declare
|
||||||
|
_tags text[] = $tags$
|
||||||
|
{
|
||||||
|
"nature", "green", "sky",
|
||||||
|
"nuclear", "oil", "black",
|
||||||
|
"love", "human", "scuirel"
|
||||||
|
}
|
||||||
|
$tags$;
|
||||||
|
begin
|
||||||
|
delete from article;
|
||||||
|
insert into article (version_id, created_by_id, title, annonymous, content, description, tags)
|
||||||
|
select
|
||||||
|
uuid_generate_v4(),
|
||||||
|
z.id,
|
||||||
|
'title' || row_number() over (),
|
||||||
|
row_number() over () % 3 = 0,
|
||||||
|
'content' || row_number() over (),
|
||||||
|
'description' || row_number() over (),
|
||||||
|
_tags[(row_number() over () % 5):(row_number() over () % 9)]
|
||||||
|
from citizen z;
|
||||||
|
|
||||||
|
raise notice 'article fixtures done';
|
||||||
|
end;
|
||||||
|
$$;
|
||||||
|
|
||||||
Reference in New Issue
Block a user