@momentumcms/migrations 0.5.3 → 0.5.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momentumcms/migrations",
3
- "version": "0.5.3",
3
+ "version": "0.5.5",
4
4
  "description": "Database migration system for Momentum CMS",
5
5
  "license": "MIT",
6
6
  "main": "./src/index.cjs",
@@ -213,6 +213,14 @@ function resolveMigrationConfig(config) {
213
213
  };
214
214
  }
215
215
 
216
+ // libs/core/src/lib/versions/version.types.ts
217
+ function hasVersionDrafts(collection) {
218
+ const v = collection.versions;
219
+ if (!v || typeof v === "boolean")
220
+ return false;
221
+ return !!v.drafts;
222
+ }
223
+
216
224
  // libs/migrations/src/lib/schema/schema-snapshot.ts
217
225
  var import_node_crypto = require("node:crypto");
218
226
  var INTERNAL_TABLES = /* @__PURE__ */ new Set(["_momentum_migrations", "_momentum_seeds", "_globals"]);
@@ -388,14 +396,6 @@ function mapOnDelete(onDelete, required) {
388
396
  function getTableName(collection) {
389
397
  return collection.dbName ?? collection.slug;
390
398
  }
391
- function hasVersionDrafts(collection) {
392
- const versions = collection.versions;
393
- if (!versions)
394
- return false;
395
- if (typeof versions === "boolean")
396
- return false;
397
- return !!versions.drafts;
398
- }
399
399
  function isCollectionConfig(value) {
400
400
  return typeof value === "object" && value !== null && "slug" in value && "fields" in value;
401
401
  }
@@ -448,6 +448,13 @@ function buildAutoColumns(collection, dialect) {
448
448
  defaultValue: "'draft'",
449
449
  isPrimaryKey: false
450
450
  });
451
+ columns.push({
452
+ name: "scheduledPublishAt",
453
+ type: dialect === "postgresql" ? "TIMESTAMPTZ" : "TEXT",
454
+ nullable: true,
455
+ defaultValue: null,
456
+ isPrimaryKey: false
457
+ });
451
458
  }
452
459
  const softDeleteCol = getSoftDeleteField(collection);
453
460
  if (softDeleteCol) {
@@ -211,6 +211,14 @@ function resolveMigrationConfig(config) {
211
211
  };
212
212
  }
213
213
 
214
+ // libs/core/src/lib/versions/version.types.ts
215
+ function hasVersionDrafts(collection) {
216
+ const v = collection.versions;
217
+ if (!v || typeof v === "boolean")
218
+ return false;
219
+ return !!v.drafts;
220
+ }
221
+
214
222
  // libs/migrations/src/lib/schema/schema-snapshot.ts
215
223
  import { createHash } from "node:crypto";
216
224
  var INTERNAL_TABLES = /* @__PURE__ */ new Set(["_momentum_migrations", "_momentum_seeds", "_globals"]);
@@ -386,14 +394,6 @@ function mapOnDelete(onDelete, required) {
386
394
  function getTableName(collection) {
387
395
  return collection.dbName ?? collection.slug;
388
396
  }
389
- function hasVersionDrafts(collection) {
390
- const versions = collection.versions;
391
- if (!versions)
392
- return false;
393
- if (typeof versions === "boolean")
394
- return false;
395
- return !!versions.drafts;
396
- }
397
397
  function isCollectionConfig(value) {
398
398
  return typeof value === "object" && value !== null && "slug" in value && "fields" in value;
399
399
  }
@@ -446,6 +446,13 @@ function buildAutoColumns(collection, dialect) {
446
446
  defaultValue: "'draft'",
447
447
  isPrimaryKey: false
448
448
  });
449
+ columns.push({
450
+ name: "scheduledPublishAt",
451
+ type: dialect === "postgresql" ? "TIMESTAMPTZ" : "TEXT",
452
+ nullable: true,
453
+ defaultValue: null,
454
+ isPrimaryKey: false
455
+ });
449
456
  }
450
457
  const softDeleteCol = getSoftDeleteField(collection);
451
458
  if (softDeleteCol) {
package/src/index.cjs CHANGED
@@ -630,6 +630,14 @@ var MediaCollection = defineCollection({
630
630
  }
631
631
  });
632
632
 
633
+ // libs/core/src/lib/versions/version.types.ts
634
+ function hasVersionDrafts(collection) {
635
+ const v = collection.versions;
636
+ if (!v || typeof v === "boolean")
637
+ return false;
638
+ return !!v.drafts;
639
+ }
640
+
633
641
  // libs/migrations/src/lib/schema/collections-to-schema.ts
634
642
  function mapOnDelete(onDelete, required) {
635
643
  const effective = required && (!onDelete || onDelete === "set-null") ? "restrict" : onDelete;
@@ -645,14 +653,6 @@ function mapOnDelete(onDelete, required) {
645
653
  function getTableName(collection) {
646
654
  return collection.dbName ?? collection.slug;
647
655
  }
648
- function hasVersionDrafts(collection) {
649
- const versions = collection.versions;
650
- if (!versions)
651
- return false;
652
- if (typeof versions === "boolean")
653
- return false;
654
- return !!versions.drafts;
655
- }
656
656
  function isCollectionConfig(value) {
657
657
  return typeof value === "object" && value !== null && "slug" in value && "fields" in value;
658
658
  }
@@ -705,6 +705,13 @@ function buildAutoColumns(collection, dialect) {
705
705
  defaultValue: "'draft'",
706
706
  isPrimaryKey: false
707
707
  });
708
+ columns.push({
709
+ name: "scheduledPublishAt",
710
+ type: dialect === "postgresql" ? "TIMESTAMPTZ" : "TEXT",
711
+ nullable: true,
712
+ defaultValue: null,
713
+ isPrimaryKey: false
714
+ });
708
715
  }
709
716
  const softDeleteCol = getSoftDeleteField(collection);
710
717
  if (softDeleteCol) {
package/src/index.js CHANGED
@@ -565,6 +565,14 @@ var MediaCollection = defineCollection({
565
565
  }
566
566
  });
567
567
 
568
+ // libs/core/src/lib/versions/version.types.ts
569
+ function hasVersionDrafts(collection) {
570
+ const v = collection.versions;
571
+ if (!v || typeof v === "boolean")
572
+ return false;
573
+ return !!v.drafts;
574
+ }
575
+
568
576
  // libs/migrations/src/lib/schema/collections-to-schema.ts
569
577
  function mapOnDelete(onDelete, required) {
570
578
  const effective = required && (!onDelete || onDelete === "set-null") ? "restrict" : onDelete;
@@ -580,14 +588,6 @@ function mapOnDelete(onDelete, required) {
580
588
  function getTableName(collection) {
581
589
  return collection.dbName ?? collection.slug;
582
590
  }
583
- function hasVersionDrafts(collection) {
584
- const versions = collection.versions;
585
- if (!versions)
586
- return false;
587
- if (typeof versions === "boolean")
588
- return false;
589
- return !!versions.drafts;
590
- }
591
591
  function isCollectionConfig(value) {
592
592
  return typeof value === "object" && value !== null && "slug" in value && "fields" in value;
593
593
  }
@@ -640,6 +640,13 @@ function buildAutoColumns(collection, dialect) {
640
640
  defaultValue: "'draft'",
641
641
  isPrimaryKey: false
642
642
  });
643
+ columns.push({
644
+ name: "scheduledPublishAt",
645
+ type: dialect === "postgresql" ? "TIMESTAMPTZ" : "TEXT",
646
+ nullable: true,
647
+ defaultValue: null,
648
+ isPrimaryKey: false
649
+ });
643
650
  }
644
651
  const softDeleteCol = getSoftDeleteField(collection);
645
652
  if (softDeleteCol) {