Skip to content

Sqlite migration fails with "default value of column is not constant" #539

Open
@thomasjm

Description

@thomasjm

I'm finding that Sqlite migrations that use the defaultTo_ function don't work. I think it's because they try to use a wildcard to insert the default value.

I made a full repro here: https://github.com/thomasjm/beam-sqlite-default-repro

Here's what happens when you run it (formatted slightly for readability):

CREATE TABLE "repro"("id" INTEGER PRIMARY KEY AUTOINCREMENT, 
             "ref_count" INTEGER DEFAULT (?) NOT NULL );                                                                                                            
-- With values: [SQLInteger 0]                                                                                                                                                                                      
beam-sqlite-default-repro-exe: SQLite3 returned ErrorError while attempting to perform prepare 
"CREATE TABLE \"repro\"(\"id\" INTEGER PRIMARY KEY AUTOINCREMENT, 
              \"ref_count\" INTEGER DEFAULT (?) NOT NULL )": 
default value of column [ref_count] is not constant

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions