{"record":{"id":"aaaa449e423a83bf","repo":"elsa-workflows/elsa-core","slug":"sqlite-physicalization-supports-dedicated-relational-tables","errorCode":null,"errorMessage":"SQLite physicalization supports dedicated relational tables only.","messagePattern":"SQLite physicalization supports dedicated relational tables only\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/modules/Elsa.Persistence.VNext.Sqlite/Physicalization/SqlitePhysicalizationPlanner.cs","lineNumber":12,"sourceCode":"using System.Text.RegularExpressions;\nusing Elsa.Persistence.VNext;\nusing Elsa.Persistence.VNext.Physicalization;\n\nnamespace Elsa.Persistence.VNext.Sqlite.Physicalization;\n\npublic partial class SqlitePhysicalizationPlanner : IPhysicalizationPlanner\n{\n    public PhysicalizationPlan Plan(PersistenceSchema schema, StoragePhysicalizationPolicy policy)\n    {\n        if (policy.Target != PhysicalizationTarget.DedicatedRelationalTable)\n            throw new InvalidOperationException(\"SQLite physicalization supports dedicated relational tables only.\");\n\n        var storageUnit = PhysicalizationPolicyValidator.GetStorageUnit(schema, policy);\n        var tableName = Quote(policy.PhysicalName ?? policy.StorageUnit);\n        var fieldColumns = storageUnit.Fields\n            .Where(field => field.Name != \"Id\")\n            .Select(field => $\"    {Quote(field.Name)} TEXT NULL\");\n        var columns = string.Join(\",\\n\", fieldColumns);\n        var separator = string.IsNullOrWhiteSpace(columns) ? string.Empty : \",\\n\";\n        var operations = new List<PhysicalizationOperation>\n        {\n            new(\n                \"CreateTable\",\n                $\"Create dedicated SQLite table {tableName} for {policy.StorageUnit}.\",\n                $\"\"\"\n                CREATE TABLE IF NOT EXISTS {tableName} (\n                    Id TEXT NOT NULL PRIMARY KEY,\n                    Content TEXT NOT NULL,\n                    Version INTEGER NOT NULL,","sourceCodeStart":1,"sourceCodeEnd":30,"githubUrl":"https://github.com/elsa-workflows/elsa-core/blob/fe9217bdfa0e27f0e09e45006eb6898f616e513d/src/modules/Elsa.Persistence.VNext.Sqlite/Physicalization/SqlitePhysicalizationPlanner.cs#L1-L30","documentation":"SqlitePhysicalizationPlanner.Plan can only generate a plan that maps each storage unit to its own dedicated relational table. When the physicalization policy requests any other target, the planner refuses because SQLite code generation in this module is implemented only for the DedicatedRelationalTable strategy.","triggerScenarios":"Calling Plan(schema, policy) where policy.Target is set to anything other than PhysicalizationTarget.DedicatedRelationalTable, e.g. a default-constructed StoragePhysicalizationPolicy or one copied from a provider-agnostic config shared with other database backends.","commonSituations":"Reusing a physicalization policy object configured for a SQL Server/PostgreSQL provider that supports multiple targets; forgetting to set policy.Target explicitly so a non-SQLite default is used; running the same schema deployment code against multiple providers.","solutions":["Set policy.Target = PhysicalizationTarget.DedicatedRelationalTable before calling Plan.","Use a different persistence provider package if you need non-dedicated-table physicalization targets.","Guard the policy target in deployment code and switch providers or targets per database engine."],"exampleFix":"// before\nvar policy = new StoragePhysicalizationPolicy { StorageUnit = \"WorkflowInstances\" };\nvar plan = planner.Plan(schema, policy);\n// after\nvar policy = new StoragePhysicalizationPolicy { StorageUnit = \"WorkflowInstances\", Target = PhysicalizationTarget.DedicatedRelationalTable };\nvar plan = planner.Plan(schema, policy);","handlingStrategy":"validation","validationCode":"if (policy.Target != PhysicalizationTarget.DedicatedRelationalTable)\n    throw new ArgumentException($\"SQLite requires Target=DedicatedRelationalTable, got {policy.Target}.\", nameof(policy));","typeGuard":null,"tryCatchPattern":"try { var plan = planner.Plan(schema, policy); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"dedicated relational tables only\")) { /* fall back to a relational provider or fix target */ }","preventionTips":["Always set policy.Target explicitly when targeting SQLite.","Centralize provider-specific policy construction in one factory.","Unit-test plan generation per provider target."],"tags":["sqlite","persistence","physicalization","unsupported-target"],"backgroundTag":"unsupported-config-value","analyzedSha":"fe9217bdfa0e27f0e09e45006eb6898f616e513d","analyzedAt":"2026-09-13T20:32:34.702Z","contentChangedAt":"2026-09-13T20:32:34.702Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}