@lucidcms/core
Version:
The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.
1 lines • 1.83 kB
Source Map (JSON)
{"version":3,"file":"remove-table-query.mjs","names":["constants"],"sources":["../../../../src/libs/collection/migration/remove-table-query.ts"],"sourcesContent":["import constants from \"../../../constants/constants.js\";\nimport logger from \"../../../libs/logger/index.js\";\nimport type { ServiceFn } from \"../../../types.js\";\nimport { copy } from \"../../i18n/index.js\";\nimport type { TableMigration } from \"./types.js\";\n\nconst removeTableQuery: ServiceFn<\n\t[\n\t\t{\n\t\t\tmigration: TableMigration;\n\t\t},\n\t],\n\tundefined\n> = async (context, data) => {\n\ttry {\n\t\tawait context.db.client.schema\n\t\t\t.dropTable(data.migration.tableName)\n\t\t\t.ifExists()\n\t\t\t.execute();\n\n\t\tlogger.debug({\n\t\t\tmessage: `Table with the name of '${data.migration.tableName}' has been dropped`,\n\t\t\tscope: constants.logScopes.migrations,\n\t\t});\n\n\t\treturn {\n\t\t\tdata: undefined,\n\t\t\terror: undefined,\n\t\t};\n\t} catch (err) {\n\t\treturn {\n\t\t\tdata: undefined,\n\t\t\terror: {\n\t\t\t\tmessage: copy(\n\t\t\t\t\t\"server:core.collections.migration.table.remove.failed.message\",\n\t\t\t\t\t{\n\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\ttableName: data.migration.tableName,\n\t\t\t\t\t\t\terrorMessage: err instanceof Error ? err.message : String(err),\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t),\n\t\t\t},\n\t\t};\n\t}\n};\n\nexport default removeTableQuery;\n"],"mappings":"iIAMA,MAAM,EAOF,MAAO,EAAS,IAAS,CAC5B,GAAI,CAWH,OAVA,MAAM,EAAQ,GAAG,OAAO,OACtB,UAAU,EAAK,UAAU,SAAS,CAAC,CACnC,SAAS,CAAC,CACV,QAAQ,EAEV,EAAO,MAAM,CACZ,QAAS,2BAA2B,EAAK,UAAU,UAAU,oBAC7D,MAAOA,EAAU,UAAU,UAC5B,CAAC,EAEM,CACN,KAAM,IAAA,GACN,MAAO,IAAA,EACR,CACD,OAAS,EAAK,CACb,MAAO,CACN,KAAM,IAAA,GACN,MAAO,CACN,QAAS,EACR,gEACA,CACC,KAAM,CACL,UAAW,EAAK,UAAU,UAC1B,aAAc,aAAe,MAAQ,EAAI,QAAU,OAAO,CAAG,CAC9D,CACD,CACD,CACD,CACD,CACD,CACD"}