Skip to content

Commit

Permalink
move sql
Browse files Browse the repository at this point in the history
  • Loading branch information
EdiWang committed Aug 31, 2024
1 parent da9177e commit 2f623b7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
17 changes: 17 additions & 0 deletions Deployment/mssql-migration.sql
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,20 @@ BEGIN
EXEC sp_executesql N'UPDATE Mention SET Worker = N''Pingback'''
END

-- v14.8
IF NOT EXISTS (SELECT * FROM sys.columns
WHERE Name = N'RouteLink' AND Object_ID = Object_ID(N'Post'))
BEGIN
EXEC sp_executesql N'ALTER TABLE Post ADD RouteLink NVARCHAR(256)'
EXEC sp_executesql N'UPDATE Post SET RouteLink = FORMAT(PubDateUtc, ''yyyy/M/d'') + ''/'' + Slug'
END

IF EXISTS (
SELECT 1
FROM sys.columns c
JOIN sys.objects o ON c.object_id = o.object_id
WHERE o.name = 'Post' AND c.name = 'HashCheckSum'
)
BEGIN
ALTER TABLE Post DROP COLUMN HashCheckSum;
END;
18 changes: 1 addition & 17 deletions Deployment/mssql-migration.vnext.sql
Original file line number Diff line number Diff line change
@@ -1,17 +1 @@
-- v14.8
IF NOT EXISTS (SELECT * FROM sys.columns
WHERE Name = N'RouteLink' AND Object_ID = Object_ID(N'Post'))
BEGIN
EXEC sp_executesql N'ALTER TABLE Post ADD RouteLink NVARCHAR(256)'
EXEC sp_executesql N'UPDATE Post SET RouteLink = FORMAT(PubDateUtc, ''yyyy/M/d'') + ''/'' + Slug'
END

IF EXISTS (
SELECT 1
FROM sys.columns c
JOIN sys.objects o ON c.object_id = o.object_id
WHERE o.name = 'Post' AND c.name = 'HashCheckSum'
)
BEGIN
ALTER TABLE Post DROP COLUMN HashCheckSum;
END;
--

0 comments on commit 2f623b7

Please sign in to comment.