@pgpmjs/import 0.10.2 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/esm/import.js CHANGED
@@ -411,6 +411,14 @@ export const importDumpRows = async (source, options = {}) => {
411
411
  : [], granularity, { naming: style, changeGranularity: options.changeGranularity });
412
412
  warnings.push(...restructured.warnings);
413
413
  const rows = [];
414
+ rows.push(...restructured.rows.map(row => ({
415
+ ...row,
416
+ content: reorderChangeStatements(row.content),
417
+ revert: reorderRevertStatements(row.revert)
418
+ })));
419
+ // Misc statements carry no identity of their own but may reference any
420
+ // object (CREATE MATERIALIZED VIEW, ALTER DEFAULT PRIVILEGES ..), so they
421
+ // deploy last and require every schema change.
414
422
  if (miscTexts.length > 0) {
415
423
  const miscSql = miscTexts.join('\n\n');
416
424
  const scripts = regenerateScripts(miscSql);
@@ -419,17 +427,12 @@ export const importDumpRows = async (source, options = {}) => {
419
427
  rows.push({
420
428
  name: MISC_CHANGE_PATH,
421
429
  deploy: MISC_CHANGE_PATH,
422
- deps: [],
430
+ deps: restructured.rows.map(row => row.deploy),
423
431
  content: miscSql,
424
432
  revert: scripts.revert.sql,
425
433
  verify: scripts.verify.sql
426
434
  });
427
435
  }
428
- rows.push(...restructured.rows.map(row => ({
429
- ...row,
430
- content: reorderChangeStatements(row.content),
431
- revert: reorderRevertStatements(row.revert)
432
- })));
433
436
  // Seed fixture changes, one per table, after the schema changes.
434
437
  const seedsByTable = new Map();
435
438
  for (const unit of dataUnits) {
package/import.d.ts CHANGED
@@ -16,8 +16,9 @@
16
16
  * warning; `withData` emits them as seed fixture changes (COPY data is
17
17
  * converted to INSERTs so it deploys through the pg driver);
18
18
  * - statements that classify to no object and attach to no host (roles,
19
- * default privileges, ...) land in a `misc/statements` change, first in
20
- * the plan, with a warning — never dropped silently.
19
+ * default privileges, ...) land in a `misc/statements` change, last in
20
+ * the plan and requiring every schema change, with a warning — never
21
+ * dropped silently.
21
22
  */
22
23
  import { PgpmRow } from '@pgpmjs/ast';
23
24
  import { PathStyle } from '@pgpmjs/naming-spec';
package/import.js CHANGED
@@ -415,6 +415,14 @@ const importDumpRows = async (source, options = {}) => {
415
415
  : [], granularity, { naming: style, changeGranularity: options.changeGranularity });
416
416
  warnings.push(...restructured.warnings);
417
417
  const rows = [];
418
+ rows.push(...restructured.rows.map(row => ({
419
+ ...row,
420
+ content: reorderChangeStatements(row.content),
421
+ revert: reorderRevertStatements(row.revert)
422
+ })));
423
+ // Misc statements carry no identity of their own but may reference any
424
+ // object (CREATE MATERIALIZED VIEW, ALTER DEFAULT PRIVILEGES ..), so they
425
+ // deploy last and require every schema change.
418
426
  if (miscTexts.length > 0) {
419
427
  const miscSql = miscTexts.join('\n\n');
420
428
  const scripts = (0, transform_1.regenerateScripts)(miscSql);
@@ -423,17 +431,12 @@ const importDumpRows = async (source, options = {}) => {
423
431
  rows.push({
424
432
  name: exports.MISC_CHANGE_PATH,
425
433
  deploy: exports.MISC_CHANGE_PATH,
426
- deps: [],
434
+ deps: restructured.rows.map(row => row.deploy),
427
435
  content: miscSql,
428
436
  revert: scripts.revert.sql,
429
437
  verify: scripts.verify.sql
430
438
  });
431
439
  }
432
- rows.push(...restructured.rows.map(row => ({
433
- ...row,
434
- content: reorderChangeStatements(row.content),
435
- revert: reorderRevertStatements(row.revert)
436
- })));
437
440
  // Seed fixture changes, one per table, after the schema changes.
438
441
  const seedsByTable = new Map();
439
442
  for (const unit of dataUnits) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pgpmjs/import",
3
- "version": "0.10.2",
3
+ "version": "0.11.0",
4
4
  "author": "Constructive <developers@constructive.io>",
5
5
  "description": "pgpm import — pgpm-itize arbitrary SQL dumps (pg_dump output, raw .sql) through the dials pipeline",
6
6
  "main": "index.js",
@@ -44,7 +44,7 @@
44
44
  "dependencies": {
45
45
  "@pgpmjs/ast": "^0.16.0",
46
46
  "@pgpmjs/naming-spec": "^0.6.2",
47
- "@pgpmjs/transform": "^0.30.2"
47
+ "@pgpmjs/transform": "^0.32.0"
48
48
  },
49
- "gitHead": "d648f64e352075ee1a8abe9c412ba49ff80823dc"
49
+ "gitHead": "6b91a1ede28d946df665e8b63cb750e6342ebd11"
50
50
  }