diff --git a/SQLUpdates/SQLUpdates.sqlproj b/SQLUpdates/SQLUpdates.sqlproj index 44307b7..a2843a6 100644 --- a/SQLUpdates/SQLUpdates.sqlproj +++ b/SQLUpdates/SQLUpdates.sqlproj @@ -59,5 +59,6 @@ + \ No newline at end of file diff --git a/SQLUpdates/initVersion.sql b/SQLUpdates/initVersion.sql new file mode 100644 index 0000000..1de1387 --- /dev/null +++ b/SQLUpdates/initVersion.sql @@ -0,0 +1,15 @@ +IF OBJECT_ID('dbo.SchemaVersion', 'U') IS NULL +BEGIN + CREATE TABLE dbo.SchemaVersion ( + VersionNumber VARCHAR(20) NOT NULL PRIMARY KEY, + AppliedOn DATETIME2 NOT NULL DEFAULT GETDATE(), + AppliedBy VARCHAR(100) NOT NULL DEFAULT SUSER_SNAME(), + ScriptDescription VARCHAR(255) NULL + ); + PRINT 'Table dbo.SchemaVersion created successfully.'; +END +ELSE +BEGIN + PRINT 'Table dbo.SchemaVersion already exists.'; +END +GO \ No newline at end of file