haskell-beam / haskell-beam/beam

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

Open
#539 1 comment 1 reaction 0 assignees View on GitHub
bug
Dominant language
Haskell
Stars
635
Forks
193
PR merge metrics
No merged PRs in 30d

Description

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
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.