-
Notifications
You must be signed in to change notification settings - Fork 242
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update db migration script to support pg_partman 5 (#3942)
Closes #3931 Signed-off-by: Sergio Castaño Arteaga <tegioz@icloud.com>
- Loading branch information
Showing
3 changed files
with
34 additions
and
18 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
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,34 @@ | ||
create schema partman; | ||
create extension pg_partman schema partman; | ||
|
||
do language plpgsql $$ | ||
declare | ||
v_pg_partman_version text; | ||
begin | ||
select extversion from pg_extension where extname = 'pg_partman' into v_pg_partman_version; | ||
case | ||
when starts_with(v_pg_partman_version, '4.') then | ||
perform partman.create_parent( | ||
'public.package_views', | ||
'day', | ||
'native', | ||
'monthly', | ||
p_start_partition := current_date::text | ||
); | ||
when starts_with(v_pg_partman_version, '5.') then | ||
perform partman.create_parent( | ||
'public.package_views', | ||
'day', | ||
'1 month', | ||
p_start_partition := current_date::text | ||
); | ||
else | ||
raise exception 'pg_partman version not supported'; | ||
end case; | ||
end | ||
$$; | ||
|
||
---- create above / drop below ---- | ||
|
||
drop extension pg_partman; | ||
drop schema partman cascade; |
This file was deleted.
Oops, something went wrong.