parsonsmatt · GitHub

SQlite seems to ignore Unique Keys when there is a Primary Key.

This

share [mkPersist sqlSettings, mkSave "entityDefs"] [persistLowerCase|
Person
    name String
    creditcard Int
    Primary name
    UniqueA creditcard
|]

translates into
CREATE TABLE "person"("name" VARCHAR NOT NULL,"creditcard" INTEGER NOT NULL, PRIMARY KEY ("name"))

while after the fix
CREATE TABLE "person"("name" VARCHAR NOT NULL,"creditcard" INTEGER NOT NULL, PRIMARY KEY ("name"),CONSTRAINT "unique_a" UNIQUE ("creditcard"))

Before submitting your PR, check that you've:

After submitting your PR:

  • Update the Changelog.md file with a link to your PR
  • Check that CI passes (or if it fails, for reasons unrelated to your change, like CI timeouts)

Read the original on github.com ↗