You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When creating a .unique constraint using the unique(on:name:) method, the constraint name will use the given name value, rather than an automatically generated one.
When attempting to delete the unique constraint in revert(on:) using the deleteUnique(on:) method, it will attempt to delete the constraint with an automatically generated name from the unique keys, rather than the custom name provided in the unique(on:name:) method - which causes the migration revert to fail.
To Reproduce
Create a new migration
Add a .unique constraint using .unique(on:name:)
In the revert(on:) method, call .deleteUnique(on:)
Run swift run migrate -y
Run swift run migrate --revert -y
You will see the following error:
$ vapor run migrate --revert -y
Migrate Command: Revert
The following migration(s) will be reverted:
- App.Tool.Seed on default
- App.Tool.MakeToolUnique on default
- App.Tool.AddMaker on default
- App.Tool.Create on default
Would you like to continue?
y/n> yes
[ WARNING ] previousError(server: constraint "uq:tools.name+tools.maker" of relation "tools" does not exist (ATExecDropConstraint))
Swift/ErrorType.swift:200: Fatal error: Error raised at top level: previousError(server: constraint "uq:tools.name+tools.maker" of relation "tools" does not exist (ATExecDropConstraint))
The text was updated successfully, but these errors were encountered:
When creating a
.unique
constraint using theunique(on:name:)
method, the constraint name will use the givenname
value, rather than an automatically generated one.When attempting to delete the unique constraint in
revert(on:)
using thedeleteUnique(on:)
method, it will attempt to delete the constraint with an automatically generated name from the unique keys, rather than the custom name provided in theunique(on:name:)
method - which causes the migration revert to fail.To Reproduce
.unique
constraint using.unique(on:name:)
revert(on:)
method, call.deleteUnique(on:)
swift run migrate -y
swift run migrate --revert -y
You will see the following error:
The text was updated successfully, but these errors were encountered: