rake-db 2.4.30 → 2.4.33

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/dist/index.mjs CHANGED
@@ -444,6 +444,9 @@ const indexesToQuery = (up, { schema, name }, indexes) => {
444
444
  `INCLUDE (${toArray(options.include).map((column) => `"${column}"`).join(", ")})`
445
445
  );
446
446
  }
447
+ if (options.nullsNotDistinct) {
448
+ sql.push(`NULLS NOT DISTINCT`);
449
+ }
447
450
  if (options.with) {
448
451
  sql.push(`WITH (${options.with})`);
449
452
  }
@@ -1166,6 +1169,7 @@ const createMigrationInterface = (tx, up, options) => {
1166
1169
  adapter.arrays = (q, types) => {
1167
1170
  return wrapWithLog(log, q, () => arrays.call(adapter, q, types));
1168
1171
  };
1172
+ Object.assign(adapter, { silentQuery: query, silentArrays: arrays });
1169
1173
  const db = createDb$1({ adapter });
1170
1174
  const { prototype: proto } = MigrationBase;
1171
1175
  for (const key of Object.getOwnPropertyNames(proto)) {
@@ -1429,14 +1433,14 @@ const queryExists = (db, sql) => {
1429
1433
  };
1430
1434
 
1431
1435
  const saveMigratedVersion = async (db, version, config) => {
1432
- await db.query(
1436
+ await db.silentArrays(
1433
1437
  `INSERT INTO ${quoteWithSchema({
1434
1438
  name: config.migrationsTable
1435
1439
  })} VALUES ('${version}')`
1436
1440
  );
1437
1441
  };
1438
1442
  const removeMigratedVersion = async (db, version, config) => {
1439
- await db.query(
1443
+ await db.silentArrays(
1440
1444
  `DELETE FROM ${quoteWithSchema({
1441
1445
  name: config.migrationsTable
1442
1446
  })} WHERE version = '${version}'`
@@ -1937,6 +1941,7 @@ ORDER BY c.ordinal_position`
1937
1941
  )
1938
1942
  FROM unnest(i.indkey[indnkeyatts:]) AS j(e)
1939
1943
  ) AS "include",
1944
+ (to_jsonb(i.*)->'indnullsnotdistinct')::bool AS "nullsNotDistinct",
1940
1945
  NULLIF(pg_catalog.array_to_string(
1941
1946
  ic.reloptions || array(SELECT 'toast.' || x FROM pg_catalog.unnest(tc.reloptions) x),
1942
1947
  ', '
@@ -2433,6 +2438,7 @@ const pushTableAst = (ctx, ast, data, domains, table, pendingTables, innerConstr
2433
2438
  using: index.using === "btree" ? void 0 : index.using,
2434
2439
  unique: index.isUnique,
2435
2440
  include: index.include,
2441
+ nullsNotDistinct: index.nullsNotDistinct,
2436
2442
  with: index.with,
2437
2443
  tablespace: index.tablespace,
2438
2444
  where: index.where
@@ -2485,6 +2491,7 @@ const pushTableAst = (ctx, ast, data, domains, table, pendingTables, innerConstr
2485
2491
  using: index.using === "btree" ? void 0 : index.using,
2486
2492
  unique: index.isUnique,
2487
2493
  include: index.include,
2494
+ nullsNotDistinct: index.nullsNotDistinct,
2488
2495
  with: index.with,
2489
2496
  tablespace: index.tablespace,
2490
2497
  where: index.where