Hello,
I’m still not sure if I understand good. For example let’s have two models with two different entities. All change script will be:
ALTER TABLE [Entity2] DROP
COLUMN [Attribute2]
go
ALTER TABLE [Entity2] ADD
[Attribute1] Char(1) NULL
go
ALTER TABLE [Entity1] ALTER COLUMN [Attribute1] Char(1) NULL
go
So it is one change script, but there are three alter statements, that modify two tables. This example is for MS SQL Server, because I don’t know your platform. It can be important to know it.
I understand, that you want to generate some INSERT statement. Below are variants that I have in my mind.
-
INSERT INTO LogTable … //Information about model versions
go
ALTER TABLE [Entity2] DROP
COLUMN [Attribute2]
go
ALTER TABLE [Entity2] ADD
[Attribute1] Char(1) NULL
go
ALTER TABLE [Entity1] ALTER COLUMN [Attribute1] Char(1) NULL
go
-
INSERT INTO LogTable … //Information About Entity2
go
ALTER TABLE [Entity2] DROP
COLUMN [Attribute2]
go
ALTER TABLE [Entity2] ADD
[Attribute1] Char(1) NULL
go
INSERT INTO LogTable … //Information About Entity1
go
ALTER TABLE [Entity1] ALTER COLUMN [Attribute1] Char(1) NULL
go
-
INSERT INTO LogTable … //Information About Drop Column in Entity2
go
ALTER TABLE [Entity2] DROP
COLUMN [Attribute2]
go
INSERT INTO LogTable … //Information About Create Column in Entity2
go
ALTER TABLE [Entity2] ADD
[Attribute1] Char(1) NULL
go
INSERT INTO LogTable … //Information About Entity1
go
ALTER TABLE [Entity1] ALTER COLUMN [Attribute1] Char(1) NULL
go
Version 1 is possible. I don’t know if version 2 or 3 are possible too, I know only that it will be very difficult in current version.
Regards
Daril