UNPKG

@lucidcms/core

Version:

The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.

1 lines 1.14 kB
{"version":3,"file":"foreign-keys-equal.mjs","names":[],"sources":["../../../../src/libs/collection/helpers/foreign-keys-equal.ts"],"sourcesContent":["import type { CollectionSchemaColumn } from \"../../../libs/collection/schema/types.js\";\nimport type { InferredColumn } from \"../../../types.js\";\n\n/**\n * Determines if two foreign keys are equal between the collection/brick columns FK and the DB Adapters inferred column FK\n */\nconst foreignKeysEqual = (\n\tnewKey?: CollectionSchemaColumn[\"foreignKey\"],\n\texistingKey?:\n\t\t| CollectionSchemaColumn[\"foreignKey\"]\n\t\t| InferredColumn[\"foreignKey\"],\n): boolean => {\n\tif (!newKey && !existingKey) return true;\n\tif (!newKey || !existingKey) return false;\n\n\treturn (\n\t\tnewKey.table === existingKey.table &&\n\t\tnewKey.column === existingKey.column &&\n\t\tnewKey.onDelete === existingKey.onDelete &&\n\t\tnewKey.onUpdate === existingKey.onUpdate\n\t);\n};\n\nexport default foreignKeysEqual;\n"],"mappings":"AAMA,MAAM,GACL,EACA,IAII,CAAC,GAAU,CAAC,EAAoB,GAChC,CAAC,GAAU,CAAC,EAAoB,GAGnC,EAAO,QAAU,EAAY,OAC7B,EAAO,SAAW,EAAY,QAC9B,EAAO,WAAa,EAAY,UAChC,EAAO,WAAa,EAAY"}