@@ -9,7 +9,7 @@ create table if not exists _const (
99truncate table _const ;
1010insert into _const values -- counts in prod 2022/02
1111 (' accounts' , 50 ), -- 50k -- number of rh_accounts
12- (' systems' , 10 ), -- 750k -- number of system_inventory rows (each with system_patch)
12+ (' systems' , 7500 ), -- 750k -- number of system_inventory rows (each with system_patch)
1313 (' advisories' , 320 ), -- 50k -- number of advisory_metadata
1414 (' repos' , 350 ), -- 55k -- number of repos
1515 (' package_names' , 300 ), -- 58k -- number of package_name
@@ -95,12 +95,14 @@ do $$
9595 acc_id int ;
9696 new_id bigint ;
9797 ji int ;
98+ workspace_ids uuid[];
9899 begin
99100 select val into wanted from _const where key = ' systems' ;
100101 select val into progress from _const where key = ' progress_pct' ;
101102 select count (* ) into rh_accounts from rh_account;
102103 json_data := array(select data from _json order by id);
103104 json_hash := array(select hash from _json order by id);
105+ workspace_ids := array(select uuid_generate_v4() from generate_series(1 , 3 ));
104106 while cnt < wanted loop
105107 gen_uuid := uuid_generate_v4();
106108 rnd := random();
@@ -110,10 +112,12 @@ do $$
110112 ji := trunc(rnd* 3 )+ 1 ;
111113 insert into system_inventory
112114 (inventory_id, display_name, rh_account_id, vmaas_json, json_checksum,
113- last_upload, arch, tags, created, os_name, os_major, rhsm_version)
115+ last_upload, arch, tags, created, os_name, os_major, rhsm_version,
116+ workspace_id, workspace_name)
114117 values
115118 (gen_uuid, gen_uuid::text , acc_id, json_data[ji], json_hash[ji],
116- rnd_date2, ' x86_64' , ' []' ::jsonb, rnd_date1, ' RHEL' , 8 , ' 8.0' )
119+ rnd_date2, ' x86_64' , ' []' ::jsonb, rnd_date1, ' RHEL' , 8 , ' 8.0' ,
120+ workspace_ids[cnt%3 + 1 ], workspace_ids[cnt%3 + 1 ]::text )
117121 returning id into new_id;
118122 insert into system_patch
119123 (rh_account_id, system_id, last_evaluation,
0 commit comments