{"record":{"id":"12de4e58e60a11e7","repo":"n8n-io/n8n","slug":"sqlite-does-not-support-exclusion-constraints","errorCode":null,"errorMessage":"Sqlite does not support exclusion constraints.","messagePattern":"Sqlite does not support exclusion constraints\\.","errorType":"exception","errorClass":"TypeORMError","httpStatus":null,"severity":"error","filePath":"packages/@n8n/typeorm/src/driver/sqlite-abstract/AbstractSqliteQueryRunner.ts","lineNumber":889,"sourceCode":"\t\t\t: await this.getCachedTable(tableOrName);\n\n\t\t// clone original table and remove check constraints from cloned table\n\t\tconst changedTable = table.clone();\n\t\tcheckConstraints.forEach((checkConstraint) =>\n\t\t\tchangedTable.removeCheckConstraint(checkConstraint),\n\t\t);\n\n\t\tawait this.recreateTable(changedTable, table);\n\t}\n\n\t/**\n\t * Creates a new exclusion constraint.\n\t */\n\tasync createExclusionConstraint(\n\t\ttableOrName: Table | string,\n\t\texclusionConstraint: TableExclusion,\n\t): Promise<void> {\n\t\tthrow new TypeORMError(`Sqlite does not support exclusion constraints.`);\n\t}\n\n\t/**\n\t * Creates a new exclusion constraints.\n\t */\n\tasync createExclusionConstraints(\n\t\ttableOrName: Table | string,\n\t\texclusionConstraints: TableExclusion[],\n\t): Promise<void> {\n\t\tthrow new TypeORMError(`Sqlite does not support exclusion constraints.`);\n\t}\n\n\t/**\n\t * Drops exclusion constraint.\n\t */\n\tasync dropExclusionConstraint(\n\t\ttableOrName: Table | string,\n\t\texclusionOrName: TableExclusion | string,","sourceCodeStart":871,"sourceCodeEnd":907,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/typeorm/src/driver/sqlite-abstract/AbstractSqliteQueryRunner.ts#L871-L907","documentation":"SQLite does not support exclusion constraints (a PostgreSQL feature). AbstractSqliteQueryRunner.createExclusionConstraint() unconditionally throws TypeORMError on call. There is no way to make this work on SQLite.","triggerScenarios":"Calling queryRunner.createExclusionConstraint(...) on a SQLite DataSource, or an entity/migration declaring an exclusion constraint that TypeORM attempts to apply.","commonSituations":"Sharing entity definitions between a Postgres and a SQLite DataSource where the entity declares an exclusion constraint; test fixtures using SQLite for a PG-only schema.","solutions":["Remove exclusion constraints from any entity/migration used with SQLite.","Branch schema setup on driver type — only define exclusion constraints for Postgres.","Use a Postgres backing store if the exclusion constraint is a hard requirement."],"exampleFix":"// before\nawait queryRunner.createExclusionConstraint(table, exclConstraint);\n\n// after\nif (dataSource.options.type !== 'sqlite' && dataSource.options.type !== 'sqlite-pooled') {\n  await queryRunner.createExclusionConstraint(table, exclConstraint);\n}","handlingStrategy":"type-guard","validationCode":"function supportsExclusionConstraints(ds: DataSource): boolean {\n  return ds.options.type === 'postgres';\n}\n\nif (supportsExclusionConstraints(dataSource)) {\n  await queryRunner.createExclusionConstraint(table, excl);\n}","typeGuard":"const driverSupportsExclusion = (ds: DataSource): boolean =>\n  ds.options.type === 'postgres';","tryCatchPattern":null,"preventionTips":["Never declare exclusion constraints on entities shared with SQLite.","Branch schema setup on driver type.","Keep PG-only features behind a driver check."],"tags":["database","sqlite","constraints"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}