Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f6fffc2

Browse files
committed
Update CHANGELOG and README
Improves the description of execute_statements() function
1 parent ee28933 commit f6fffc2

File tree

3 files changed

+19
-12
lines changed

3 files changed

+19
-12
lines changed

CHANGELOG.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,30 @@
55
- Add `mssql_migrator` to the README.
66

77
- Add support for migrating partial indexes using a new `where_clause` column
8-
in the `indexes` foreign table.
8+
in the `indexes` foreign table.
99
Patch by Florent Jardin.
1010

11-
- Factor out `db_migrate_indexes` from `db_migrate_constraints`.
11+
- Factor out `db_migrate_indexes` from `db_migrate_constraints`.
1212
Patch by Florent Jardin.
1313

1414
- Add a regression test suite based on pgTAP.
1515
Patch by Florent Jardin.
1616

17+
- Add low-level function `execute_statements()` used by others methods to
18+
populate `log_migrate` table on failed statements.
19+
Patch by Florent Jardin
20+
1721
## Bugfixes: ##
1822

19-
- Call the translation function on expressions in the partitioning key.
23+
- Call the translation function on expressions in the partitioning key.
2024
Patch by Florent Jardin.
2125

22-
- Call the translation function on index expressions.
26+
- Call the translation function on index expressions.
2327
Patch by Florent Jardin.
2428

2529
# Version 1.0.0, released 2023-02-08 #
2630

2731
## Enhancements: ##
2832

29-
- Add support for migrating partitioned tables.
33+
- Add support for migrating partitioned tables.
3034
Patch by Florent Jardin.

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -903,19 +903,22 @@ Parameters:
903903

904904
- `operation` (type `text`, required): arbitrary operation description
905905

906-
- `schema` (type `name`, required): schema of the statement related object
906+
- `schema` (type `name`, required): schema of the statements related object
907907

908908
- `object_name` (type `name`, required): name of the relation concerned by the
909-
statement
909+
statements
910910

911911
- `statements` (type `text[]`, required): statements to execute in the same
912912
subtransaction
913913

914914
- `pgstage_schema` (type `name`, default `pgsql_stage`): name of the Postgres
915915
staging schema where the `migrate_log` table has been created
916916

917-
This function executes a SQL statement with logging errors into `migrate_log`
918-
table and returns `false` on failure.
917+
This function iterates through an array of SQL statements and executes them
918+
inside a subtransaction. If one fails, it raises a detailed warning and inserts
919+
the failed statement and its context into `migrate_log` table and all previous
920+
successful statements in the subtransaction are rollbacked.
921+
Returns `false` on failure.
919922

920923
Plugin API
921924
==========

db_migrator--1.1.0.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ BEGIN
135135
IF subpartition_count > 0 THEN
136136
LOOP
137137
/* create the subpartition */
138-
statements := statements ||
138+
statements := statements ||
139139
format(
140140
'CREATE TABLE %1$I.%3$I PARTITION OF %1$I.%2$I %4$s',
141141
v_schema, v_partition, v_subpartition,
@@ -181,12 +181,12 @@ BEGIN
181181

182182
/* move the data if desired */
183183
IF with_data THEN
184-
statements := statements ||
184+
statements := statements ||
185185
format('INSERT INTO %I.%I SELECT * FROM %I.%I', schema, table_name, schema, ft);
186186
END IF;
187187

188188
/* drop the foreign table */
189-
statements := statements ||
189+
statements := statements ||
190190
format('DROP FOREIGN TABLE %I.%I', schema, ft);
191191

192192
IF NOT execute_statements(

0 commit comments

Comments
 (0)