nextjs-cms 0.8.4 → 0.8.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-sections.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/update-sections.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"update-sections.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/update-sections.ts"],"names":[],"mappings":"AA8lCA,wBAAsB,cAAc,CAAC,SAAS,UAAQ,iBAoBrD"}
|
|
@@ -557,12 +557,20 @@ const main = async (s) => {
|
|
|
557
557
|
/**
|
|
558
558
|
* Generate the Drizzle schema for the table
|
|
559
559
|
*/
|
|
560
|
+
// Filter out unique constraints that exactly match the primary key columns,
|
|
561
|
+
// since primary keys already enforce uniqueness
|
|
562
|
+
const pkNames = new Set(s.db.primaryKey.map((f) => f.name));
|
|
563
|
+
const schemaUniqueConstraints = s.db.unique?.filter((u) => {
|
|
564
|
+
if (u.columns.length !== pkNames.size)
|
|
565
|
+
return true;
|
|
566
|
+
return !u.columns.every((c) => pkNames.has(c.name));
|
|
567
|
+
});
|
|
560
568
|
const drizzleSchema = generateDrizzleSchema({
|
|
561
569
|
name: s.db.table,
|
|
562
570
|
fields: s.fieldConfigs,
|
|
563
571
|
identifier: s.db.identifier,
|
|
564
572
|
index: s.db.index,
|
|
565
|
-
unique:
|
|
573
|
+
unique: schemaUniqueConstraints?.length ? schemaUniqueConstraints : undefined,
|
|
566
574
|
}, caseStyleFns);
|
|
567
575
|
drizzleTableSchemas.push(drizzleSchema.schema);
|
|
568
576
|
drizzleSchema.drizzleImports.forEach((type) => drizzleImports.add(type));
|