restore data for single table in v3+

0
Hi, what's the best way to restore the data from one single table to the db in v3+. In pre-v3 versions I was able to drop the table, restart the app and restore the data to that table only but in v3 I don't seem to have the flixibility to do that. I've tried restoring using the restore dialog but kept getting error, sometimes with just " an error occurred" type message which doesn't help finguring out out is wrong. Nothing in logs either. Is there a specific set of items I need to "tick" in PgAdmin to back the 8.4 DB? I've tried quite a few combinations and never managed to get the restore to work. The reason for the table restore is due to the DB already being live and at times is safer just to restore one or two tables rather then the whole lot. LR.
asked
3 answers
1

Copied from https://world.mendix.com/display/refguide3/Moving+from+2.5+to+3.0:

Important Change: Synchronization

In 3.0 significant improvements have been made in the way the Runtime synchronizes the domain model with the database containing user data. In short, it means that user data will be retained in more cases. However, there are some consequences that you have to be aware of.

Do not manually edit the database

  • The structure of the domain model is now saved in special system tables. These are introduced to allow the Runtime server to keep a better track of how all the entities, associations etc. relate to each other in that specific version of the application. This does mean however that you cannot simply make manual changes to the database structure as this would result in a mismatch between the system tables and the actual application data tables.

In short, dropping a table entirely is a bad idea. You don't have to drop a table to delete or restore data anyway, you could just delete rows. Even manually deleting rows from a table could get you into trouble though, for example in the case of autonumbers that will maintain their value even if there are no rows.

Stuff like this should be handled by the Runtime server itself. I recommend importing the data in another way, such as with the database replication module.

answered
0

just an idea;

Can you explain what prevents you from deleting and re-importing your data through a Mendix Microflow?

Very alternatively: did you consider deploying your app with that one entity (that your table depends on) deleted, which will delete your table. Then re-deploy with the entity again, you might export-import it to ensure the same config. That would, I guess, create a new blanc table. The next step would be to import your table from the last backup/restore point you have. I guess, if performance and context allows it, you can use a standard Mendix import or a batch procedure from the community commons?

Just an idea, might be a hell of a job if there are lots of dependencies...

answered
0

I think truncate and insert commands are quite safe to reload your table, as they both make no structural changes. However, do note that your objects cannot have any associations or inheritance (incoming or outgoing), otherwise the unresolvable foreign keys will exists if you just truncate a single table. Data integrity can only be guaranteed if you do not alter the database directly but use Mendix

answered