You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Insight can handle most types of schema upgrades automatically, particularly throughout the development cycle of a project. There are a few situations where it needs some help.
Updating Tables
Insight.Database.Schema 2.0 now supports column-level database changes. So adding/dropping/changing a column or constraint should work automatically.
If you want to rename a column, with v2.2.4 and later, you can use the WAS syntax:
CREATETABLEMyTable (
[ID] [int],
[RenamedColumn] [int] NOT NULL, -- [RenamedColumn] WAS [OldColumnName]
)
When Insight detects that RenamedColumn is not there, and OldColumnName is, it will execute a rename on the column. (Note that it will still rebuild any constraints on the column, because it thinks it has changed.)
If you renamed a column multiple times, you can list multiple old versions and Insight will pick the appropriate one. (Yes, it's possible for you to make a mess of things with this if you go crazy).
CREATETABLEMyTable (
[ID] [int],
[RenamedColumn] [int] NOT NULL,
-- [RenamedColumn] WAS [OldColumnName1]-- [RenamedColumn] WAS [OldColumnName2]
)