From a remote Docker target I created database seeds as initial content and schema on a new target.
First problem I came across is that it’s not possible to select all tables and create a single seed containing the full schema and all data, so seeds have to be created table by table.
Secondly, the import doesn’t work on my other target and also not on my local development target (Docker), because of reference field dependencies.
Therefore I tried to change the On Update and On Delete properties to Cascade (also tried other options), but also applying this change returns an error. Please see the knex file and error message below:
Okay, but these tables do exist already, that's the weird thing about it.
How can I do this when the seeds I want to use from the remote target already contain these reference fields?
The database was created on a local development target long time ago and then used as initial schema and data on the remote target.
The tables are created one by one and reference fields were added later on, after saving the new table first. However, the changed have been reset in the meantime and removed as well. So how can I copy the remote target's schema and data to the local target now?
I am still stuck with these problems and it appears they are not all reference field based.
I do understand that reference fields can only be imported/migrated/created if the reference table exists and took that into account, so that’s not the issue. The issues I do still have are:
Can’t edit reference fields’ On Update and On Delete values
Tables/fields can’t be removed
Imports of seeds on existing or of new tables doesn’t work.
All of the above actions I tried in 1 single change but still the errors are shown.
So again I am asking for help on this since I tried everything within my knowledge to find a solution already.
Exploring the database schema with 3rd party software shows that the Delete Rule and Update Rule differ from the rules shown by Wappler. Could that be causing issues?
I tried changing these rules from the 3rd party software by the way to see if that helps, but that’s not possible unfortunately.
Seeds were created from remote target and trying to import them to local target.
No reference fields involved, super simple cms table contains 3 string columns only.
With pgAdmin you can connect to your live database and explore the exact native structure. It is a very handy tool. So check the definition of you table like:
I did this already with a tool called DBeaver.
The schema and all tables are exactly identical, so that’s also not the issue.
I ended up rebuilding the database schema on a new local target, because so much seemed to be wrong with it. The fact that a simple update on On Delete and On Update properties of reference fields was not even possible anymore underlines that, don’t you think?
Thanks for your help anyways.
BTW: It’s necessary to refresh tables every time changes have been applied. Maybe changes tables or the complete schema could be refreshed automatically after changes are applied? Just a suggestion.
I did a full rebuild from within Wappler, which solved the issues.
However, still some properties are not read well by Wappler’s database manager. On Delete and OnUpdate properties were all set, but still displayed as set to No Action, which is not the case for sure (also checked with DBeaver).
And still if any changes are made, I have to refresh the schema or table manually to see the applied changes and be able to apply new changes.