I'm experimenting at the moment with applying changes from a PDM to the database, ready to advise a client on the best way to roll back database changes they didn't like. There are a number of options when Applying Model Changes to the database that look useful in this activity, but the generated SQL doesn't do everything the documentation implies that it ought to do. Specifically, there are no statements generated to move data from the backup tables it creates.
In the dialogue 'Apply Model Changes to Database', I can tell PD to create backup tables:
Here's how the documentation describes the purpose of the 'Backup tables' option:
Specifies that any existing table will be copied to a temporary backup during the modification, and then restored to the updated tables. If this option is not selected, then all existing data will be erased.
The generated SQL statements rename the existing table to a temporary name, then re-create the table. There are no statements generated to transfer the data from the temporary tables to the new tables.
Is the documentation making false promises, or is this a bug? If it's an empty promise, my client is going to be very disappointed, as the options shown above will result in the following SQL, some of which is pointless without statements to transfer the data. In this example, I renamed TABLE_1 to THIS_TABLE_HAS_BEEN_RENAMED:
drop table if exists tmp_TABLE_1;
alter table TABLE_1 rename tmp_TABLE_1;
/*==============================================================*/
/* Table: THIS_TABLE_HAS_BEEN_RENAMED */
/*==============================================================*/
create table THIS_TABLE_HAS_BEEN_RENAMED
(
COLUMN_1 char(11) null,
COLUMN_2 numeric(8) null
);
drop table if exists tmp_TABLE_1;
Are we expected to add our own SQL to transfer the data?