-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add partitioned column to pgmq_meta (#97)
* Add 'partitioned' attribute to pgmq_meta * Use strum for Display * Use boolean column * add migration * update migration * Update pgmq--0.21.0--0.22.0.sql
- Loading branch information
1 parent
f8ae3e8
commit 25cd795
Showing
8 changed files
with
41 additions
and
12 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
Empty file.
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,23 @@ | ||
DO $$ | ||
DECLARE | ||
qname TEXT; | ||
BEGIN | ||
ALTER TABLE pgmq_meta ADD COLUMN is_partitioned BOOLEAN; | ||
|
||
IF 'pg_partman' NOT IN (SELECT extname FROM pg_extension) THEN | ||
UPDATE pgmq_meta SET is_partitioned = false; | ||
ELSE | ||
FOR qname IN (SELECT queue_name FROM pgmq_meta) | ||
LOOP | ||
-- If qname is in public.part_config it must be a partitioned table. | ||
IF format('public.pgmq_%1$I', qname) IN (SELECT parent_table FROM public.part_config) THEN | ||
UPDATE pgmq_meta SET is_partitioned = true WHERE queue_name = qname; | ||
ELSE | ||
UPDATE pgmq_meta SET is_partitioned = false WHERE queue_name = qname; | ||
END IF; | ||
END LOOP; | ||
END IF; | ||
|
||
ALTER TABLE pgmq_meta ALTER COLUMN is_partitioned SET NOT NULL; | ||
END $$; | ||
|
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
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