Skip to content

No DEFERRABLE Constraint option #209

Description

@anonymouz4

Currently it isn't possible to declare a constraint, while making it DEFERRABLE or set a initial deferred state.

Workaround 1:

guard let db = database as? PostgresDatabase else {
	throw Abort(.internalServerError)
}
try db.simpleQuery("ALTER TABLE waitlist ADD  CONSTRAINT no_duplicate_ranks UNIQUE(waitlist_rank) DEFERRABLE;").wait()

Workaround 2:

// In create migration
.constraint(.custom("CONSTRAINT \"no_duplicate_ranks\" UNIQUE(waitlist_rank) DEFERRABLE"))

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions