-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b63ac6d
commit 3ceca94
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
DO $$ | ||
DECLARE | ||
temprow record; | ||
BEGIN | ||
FOR temprow IN | ||
SELECT max(id)+1 AS next_value, test_id, tenant_id | ||
FROM test_runs | ||
GROUP BY test_id, tenant_id | ||
LOOP | ||
EXECUTE format('CREATE SEQUENCE IF NOT EXISTS runs_test_%s_seq START WITH %s', | ||
MD5(FORMAT('%s%s', temprow.test_id, temprow.tenant_id)), temprow.next_value); | ||
END LOOP; | ||
|
||
FOR temprow IN | ||
SELECT max(id::int)+1 AS next_value, test_suite_id, tenant_id | ||
FROM test_suite_runs | ||
GROUP BY test_suite_id, tenant_id | ||
LOOP | ||
EXECUTE format('CREATE SEQUENCE IF NOT EXISTS runs_test_suite_%s_seq START WITH %s', | ||
MD5(FORMAT('%s%s', temprow.test_suite_id, temprow.tenant_id)), temprow.next_value); | ||
END LOOP; | ||
END $$; |