-
|
I am slowly trying to move an APP from 0.x to 1.x, which includes switching from aerich to native migration tool. I have encountered a problem that I am not sure how to solve trying to add a JSON field that defaults to empty list or dictFor example I have this model I want to add another field to this model
Even if I have set a default of I can mitigate by setting |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
|
(1) is less maintenance and matches what you already did with aerich. |
Beta Was this translation helpful? Give feedback.
-
The new built in migration generate a Migration class like this, so I am not sure how to add a db level default, it is possible to give another hint? |
Beta Was this translation helpful? Give feedback.
-
|
Thank you @vsdudakov, I have now read the documentation further and figure out how to do it There are two more documentation that I needed:
I tweaked the statement printed by I ended up with which does what I want. I wish tortoise would add something like |
Beta Was this translation helpful? Give feedback.
Thank you @vsdudakov, I have now read the documentation further and figure out how to do it
There are two more documentation that I needed:
tortoise sqlmigratePrint the SQL for a migration without executing it. https://tortoise.github.io/migration.html#sqlmigrateI tweaked the statement printed by
tortoise sqlmigrateand then write backward statement myself (because "--backwards" give a long list of SQL statement that looks like doing things in slower way)I ended up with