-
-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Schema apply with char 36 becomes varchar 36 #20428
Comments
This is still a huge issue, every new env is setting up the schema with varchar, even though the |
Found the source of the issue in
Removing this fixes the issue. Leave our char and varchar as is :) |
Turns out, removing the block only converted all the should be uuid fields to varchar making them also msmatch their char id fields. So to fix this I created a PR that results in a better matching schema file to what will be applied to the db. |
Arg! What a mess, it works now on initial db schema create, but only if I remove the code block mentioned above, and event still when you take a snapshot of the newly created db, then the snapshot is again different than it was used to create it, which it should be. ZXC -> In should result in ZXC -> OUT. But seems like certain rules are either not being exported such as CONSTRAINTS ON UPDATE. |
Describe the Bug
So we have noticed some inconsistencies between different environments when importing the schema, causing havoc when ever we try to sync the schema.
We start of with a schema containing a foreign key that has the following schema:
Specifically this part is important:
When we apply this schema to a fresh database right after bootstrapping Directus, the column ends up being varchar(36) leading to the next time we export the database that the schema gets updated to
varchar(36)
which on another environment seems to break.During investigation I found that some foreign keys are added aschar(36)
and upon looking at what differs, the only property that was different wasis_nullable: true
. This might be the reason but further tests are needed.After testing more and changing the
is_nullable
property, it did not seem to affect the final state. The same foreign keys would still map to eithervarchar(36)
orchar(36)
To Reproduce
Add/edit two field such that it matches the above type and max length, BUT set one of them to
is_nullable: false
and the other totrue
Apply the schema on a fresh database after Directus
bootstrap
ensure the columns is created with the correct typechar(36)
andnullable
setting.Note the nullable issue itself is tracked here: #20418
Directus Version
10.6-10.7
Hosting Strategy
Self-Hosted (Docker Image)
The text was updated successfully, but these errors were encountered: