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
With this column, I am using now() as the default.
Running dart run drift_dev schema steps after doing a dump generates the versions file, without the import for drift_postgres. Adding the import manually (which is a workaround I am willing to automate), the values of now() and getRandomUuid() do not adhere to the DriftAny type in the generated code. Here is a snippet of the generated code for a users table from the previous schema version which fails:
Thanks for the report! These issues sound fixable and I'll take a look, but you'll probably won't get far with step-by-step migrations on postgres:
The schema verification code used in tests does not support postgres (neither as a dialect nor can we reliably obtain the actual schema at runtime).
Step-by-step migrations run a user_version pragma after each step, which will not work on postgres.
In fact, most drift migration APIs (outside of creating tables) won't work on postgres. Migrator.alterTable certainly won't, for instance.
We should still fix this for users who are using custom types to share a database between postgres and sqlite3, but the migration tooling for Postgres is just fairly incomplete at the moment. At the moment, I suggest extracting your drift schema into a separate file (drift dev schema export!) and then use a dedicated migration tool for Postgres.
I have the following table
users
defined like:Notice I am using
getRandomUuid()
as the default. TheCreatedAt
mixin has the following:With this column, I am using
now()
as the default.Running
dart run drift_dev schema steps
after doing a dump generates the versions file, without the import fordrift_postgres
. Adding the import manually (which is a workaround I am willing to automate), the values ofnow()
andgetRandomUuid()
do not adhere to theDriftAny
type in the generated code. Here is a snippet of the generated code for ausers
table from the previous schema version which fails:Let me know if there's any more information I can provide
Environment information:
build.yaml
The text was updated successfully, but these errors were encountered: