Incorrect deferred handling with Postgres #40953
Unanswered
markuskooche
asked this question in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I created a table according to the following principle:
It should not be possible to use the same
sequence
at the same post twice.I have written this on the migration as follows:
However, it should be possible to swap the sequences.
Therefore, you need to use a transaction, which looks like this in plain SQL:
You have to create the UNIQUE key as follows:
However, this is exactly where the problem is. You can easily apply this to a primary key with the following function:
This works because it is already observed in the primary keys.
https://github.com/laravel/framework/blob/9.x/src/Illuminate/Database/Schema/ForeignKeyDefinition.php#L8
framework/src/Illuminate/Database/Schema/Grammars/PostgresGrammar.php
Lines 217 to 241 in 4c7cd8c
However, not with the UNIQUE Keys.
framework/src/Illuminate/Database/Schema/Grammars/PostgresGrammar.php
Lines 146 to 160 in 4c7cd8c
It would be great if this could then also be called quite simply as follows:
Beta Was this translation helpful? Give feedback.
All reactions