Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also includes some update infrastructure changes. Main difference is that sql/updates/ scripts are now split into pre- and post- files. This is needed because table updates need to happen before reloading functions (some functions checked for accessing right schema at definition time). Meanwhile trigger updates need to happen after since triggers must refer to valid functions at definition time.
- Loading branch information
Showing
7 changed files
with
64 additions
and
15 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
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,9 @@ | ||
Folder for update SQL-scripts named oldversion--newversion (0.1.0--0.1.1) | ||
It is assumed that there is only one file matching the newversion. | ||
Folder for update SQL-scripts named pre-oldversion--newversion or post-oldversion--newversion | ||
|
||
pre files are run before reloading the functions. These should include new | ||
tables, constraints, indexes, etc. | ||
|
||
post functions are run after reloading the functions. These include | ||
any entities depending on functions-- e.g. triggers. | ||
|
||
It is assumed that there is only one file for pre or post matching the newversion. |
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,3 @@ | ||
CREATE EVENT TRIGGER ddl_drop_trigger | ||
ON sql_drop | ||
EXECUTE PROCEDURE _timescaledb_internal.ddl_process_drop_trigger(); |
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,17 @@ | ||
ALTER TABLE _timescaledb_catalog.hypertable ADD UNIQUE (id, schema_name); | ||
|
||
ALTER TABLE _timescaledb_catalog.hypertable_index | ||
DROP CONSTRAINT hypertable_index_hypertable_id_fkey, | ||
ADD CONSTRAINT hypertable_index_hypertable_id_fkey | ||
FOREIGN KEY (hypertable_id, main_schema_name) | ||
REFERENCES _timescaledb_catalog.hypertable(id, schema_name) | ||
ON UPDATE CASCADE | ||
ON DELETE CASCADE; | ||
|
||
ALTER TABLE _timescaledb_catalog.chunk_index | ||
DROP CONSTRAINT chunk_index_main_schema_name_fkey, | ||
ADD CONSTRAINT chunk_index_main_schema_name_fkey | ||
FOREIGN KEY (main_schema_name, main_index_name) | ||
REFERENCES _timescaledb_catalog.hypertable_index(main_schema_name, main_index_name) | ||
ON UPDATE CASCADE | ||
ON DELETE CASCADE; |
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 |
---|---|---|
@@ -1,2 +1,11 @@ | ||
\d+ _timescaledb_catalog.hypertable; | ||
\d+ _timescaledb_catalog.hypertable_index; | ||
\d+ _timescaledb_catalog.*; | ||
\df+ _timescaledb_internal.*; | ||
\dy | ||
|
||
SELECT count(*) | ||
FROM pg_depend | ||
WHERE refclassid = 'pg_extension'::regclass | ||
AND refobjid = (SELECT oid FROM pg_extension WHERE extname = 'timescaledb'); | ||
|
||
-- The list of tables configured to be dumped. | ||
SELECT unnest(extconfig)::regclass::text c from pg_extension where extname='timescaledb' ORDER BY c; |