Increase article fixtures
This commit is contained in:
@@ -74,7 +74,7 @@ object ArticlesPaths {
|
|||||||
val tags: List<String> = emptyList(),
|
val tags: List<String> = emptyList(),
|
||||||
val draft: Boolean = false,
|
val draft: Boolean = false,
|
||||||
val versionId: UUID?,
|
val versionId: UUID?,
|
||||||
val workgroup: WorkgroupRef?
|
val workgroup: WorkgroupRef? = null
|
||||||
)
|
)
|
||||||
|
|
||||||
private val workgroupRepository: WorkgroupRepository by inject()
|
private val workgroupRepository: WorkgroupRepository by inject()
|
||||||
|
|||||||
@@ -13,19 +13,19 @@ declare
|
|||||||
begin
|
begin
|
||||||
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'||rn)::cstring),
|
||||||
uuid_in(md5('article_v'||row_number() over () % (_citizen_count / 2))::cstring),
|
uuid_in(md5('article_v'||rn % ((_citizen_count * 50) / 2))::cstring),
|
||||||
z.id,
|
z.id,
|
||||||
case when row_number() over () % 2 = 0 then w.id end,
|
case when rn % 2 = 0 then w.id end,
|
||||||
'title' || row_number() over (),
|
'title' || rn,
|
||||||
row_number() over () % 3 = 0,
|
rn % 3 = 0,
|
||||||
'content' || row_number() over (),
|
'content' || rn,
|
||||||
'description' || row_number() over (),
|
'description' || rn,
|
||||||
_tags[(row_number() over () % 5):(row_number() over () % 9)],
|
_tags[(rn % 5):(rn % 9)],
|
||||||
now() + (row_number() over () * interval '7 minute 3 second'),
|
now() + (rn * interval '7 minute 3 second'),
|
||||||
(row_number() over () % 7) = 0
|
(rn % 7) = 0
|
||||||
from (select *, row_number() over () rn from citizen z) z
|
from (select *, row_number() over () rn from citizen z, lateral generate_series(1, 50) g) z
|
||||||
join (select *, row_number() over () % _workgroup_count rn from workgroup) w using (rn);
|
left join (select *, row_number() over () % _workgroup_count rn from workgroup) w using (rn);
|
||||||
|
|
||||||
insert into article_relations (source_id, target_id, created_by_id, comment)
|
insert into article_relations (source_id, target_id, created_by_id, comment)
|
||||||
select
|
select
|
||||||
@@ -33,7 +33,7 @@ begin
|
|||||||
dest.id,
|
dest.id,
|
||||||
src.created_by_id,
|
src.created_by_id,
|
||||||
'comment' || rn
|
'comment' || rn
|
||||||
from (select *, row_number() over () rn from article, lateral generate_series(1, 5) g) src
|
from (select *, row_number() over () rn from article) src
|
||||||
join (select *, row_number() over () +5 rn from article) dest using (rn);
|
join (select *, row_number() over () +5 rn from article) dest using (rn);
|
||||||
|
|
||||||
raise notice 'article fixtures done';
|
raise notice 'article fixtures done';
|
||||||
|
|||||||
Reference in New Issue
Block a user