Skip to content

Commit b5b4829

Browse files
committed
Enforce dropping columns as part of pre-deployment script
Now that we have established a pre-deployment script (1124443) we can use it to address issues not effectively addressed by schema comparison. Notably, schema comparison won't drop columns that have data in them. As such, we can drop the legacy `Topics.Stack_Top` (8ba3514) and `Attributes.DateModified` (2b981f2) columns, which were previously removed from the schema.
1 parent 105cfdd commit b5b4829

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

OnTopic.Data.Sql.Database/Scripts/Upgrade from OnTopic 4 to OnTopic 5.sql

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,29 @@
55
-- prior to running migrations.
66
--------------------------------------------------------------------------------------------------------------------------------
77

8+
--------------------------------------------------------------------------------------------------------------------------------
9+
-- DROP COLUMNS
10+
--------------------------------------------------------------------------------------------------------------------------------
11+
-- Migrations won't drop columns that have data in them. The following drop columns that are no longer needed. This also drops
12+
-- stored procedures that reference those columns—with the knowledge that their replacements will be recreated by the
13+
-- migrations.
14+
--------------------------------------------------------------------------------------------------------------------------------
15+
16+
ALTER
17+
TABLE Topics
18+
DROP
19+
COLUMN Stack_Top;
20+
21+
ALTER
22+
TABLE Attributes
23+
DROP
24+
CONSTRAINT DF_Attributes_DateModified;
25+
26+
ALTER
27+
TABLE Attributes
28+
DROP
29+
COLUMN DateModified;
30+
831
--------------------------------------------------------------------------------------------------------------------------------
932
-- MIGRATE CORE ATTRIBUTES
1033
--------------------------------------------------------------------------------------------------------------------------------

0 commit comments

Comments
 (0)