Rename table and preserve BOTH relationships and calcs/aggs?

We have a robust (150+ forms, 100+ tables) solution that we’re porting to another company we purchased.

We’re standardizing a lot of our data, making a need to rename tables and/or adjust columns, etc.

This is well within our expertise on the DB end, but Servoy is a hugely manual process to do this.

Is there a way change table names so that Servoy relationships/tabs and aggs / calc’s don’t die?

We can keep relationships/tabs alive and lose calcs /aggs OR vice versa, but can’t do both within Servoy’s current environment (3.5.5)

IE,

prefix_staff changed to company_staff - same columns for now.

When prefix_staff goes missing, all relationships and more have multiple problems.

Search and replace on methods are easy enough, but relationships have problems - if the table is missing and you go to edit it, no other tables show up in the drop down list - you have to REMOVE and create another.

This destroys all tabs built on the relationship.

If instead, the new table is created (externally or internally), and then forms / relationships are pointed to it, then delete the old table, it works ok EXCEPT you lose all calcs / aggs.

I’ve dug into the repository, and could generate some fun SQL to backtrack through element_id’s and properties to do a solution wide search and replace - but would rather not mess with this if possible.

Just wondering if anyone else has found a method to:

  1. Rename a table
  2. Preserve calcs / aggregates and relationships /tabs

Any ideas?

What would be a great feature is if on opening a solution, when Servoy kicks out an error for the table and relationships, it lets you POINT to another table and it re-points all the calcs / aggs and relationships.

This can be quite simple.

Create the new table.

Open the repository, select your release and you see a “Replace Table” button on the righthand side…

If you are planning really extensive restructuring/renaming in your database, and you have to do the work off-line on a copy of the data, take a look at the “migration” feature in Ruby-on-Rails. Used with Servoy this is a killer feature. As we develop and restucture we make all database changes as migrations including running custom SQL queries to clean up the data.

When development is complete, you can take the latest data and just run the migrations again… In our case the script makes 2000+ changes and takes 30 minutes to run… Works like a dream.

Thanks for pointing me to that :slight_smile:

Replace table works great :slight_smile: