Skip to content

SQLite error 19: UNIQUE constraint failed in Reminders example preview mode #319

Description

@jcmourey

Description

seedSampleData() is called from appDatabase() when in preview mode.
Also, in preview mode: seedSampleData is called from the Seed Data Toolbar button
This causes SQLite to fail from attempting to add duplicate data.

Checklist

  • I have determined whether this bug is also reproducible in a vanilla SwiftUI project.
  • I have determined whether this bug is also reproducible in a vanilla GRDB project.
  • If possible, I've reproduced the issue using the main branch of this package.
  • This issue hasn't been addressed in an existing GitHub issue or discussion.

Expected behavior

Not really a big deal, but since it is a demo project that should probably as clean as possible, seedSampleData should probably get called from one or the other place, not both.

Actual behavior

🟣 Reminders/RemindersLists.swift:146: Caught error: SQLite error 19: UNIQUE constraint failed: tags.title - while executing INSERT INTO "tags" ("title") VALUES (?), (?), (?), (?), (?), (?), (?)

Reproducing project

No response

SQLiteData version information

No response

Sharing version information

No response

GRDB version information

No response

Destination operating system

No response

Xcode version information

No response

Swift Compiler version information

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions