PageRenderTime 64ms CodeModel.GetById 18ms app.highlight 30ms RepoModel.GetById 1ms app.codeStats 0ms

/BlogEngine/BlogEngine.NET/setup/MySQL/MySQLUpgradeFrom2.0To2.5.sql

#
SQL | 114 lines | 89 code | 25 blank | 0 comment | 0 complexity | 9dd40252343e3874deb836d12ecc942f MD5 | raw file
  1
  2ALTER TABLE be_Users ADD BlogID varchar(36) NOT NULL DEFAULT '';
  3UPDATE be_Users SET BlogID = '27604F05-86AD-47EF-9E05-950BB762570C';
  4
  5ALTER TABLE be_UserRoles ADD BlogID varchar(36) NOT NULL DEFAULT '';
  6UPDATE be_UserRoles SET BlogID = '27604F05-86AD-47EF-9E05-950BB762570C';
  7ALTER TABLE be_UserRoles ADD UserName nvarchar(100) NOT NULL DEFAULT '';
  8ALTER TABLE be_UserRoles ADD Role nvarchar(100) NOT NULL DEFAULT '';
  9
 10UPDATE be_UserRoles
 11SET UserName =
 12(
 13SELECT UserName
 14FROM be_Users
 15WHERE be_Users.UserID = be_UserRoles.UserID
 16),
 17Role = 
 18(
 19SELECT Role
 20FROM be_Roles
 21WHERE be_Roles.RoleID = be_UserRoles.RoleID
 22);
 23
 24ALTER TABLE be_UserRoles DROP COLUMN UserID;
 25ALTER TABLE be_UserRoles DROP COLUMN RoleID;
 26
 27ALTER TABLE be_StopWords DROP PRIMARY KEY;
 28ALTER TABLE be_StopWords ADD StopWordRowId int(10) UNSIGNED NOT NULL AUTO_INCREMENT, ADD PRIMARY KEY (StopWordRowId);
 29ALTER TABLE be_StopWords ADD BlogId varchar(36) NOT NULL DEFAULT '';
 30UPDATE be_StopWords SET BlogId = '27604F05-86AD-47EF-9E05-950BB762570C';
 31
 32ALTER TABLE be_Settings DROP PRIMARY KEY;
 33ALTER TABLE be_Settings ADD SettingRowId int(10) UNSIGNED NOT NULL AUTO_INCREMENT, ADD PRIMARY KEY (SettingRowId);
 34ALTER TABLE be_Settings ADD BlogId varchar(36) NOT NULL DEFAULT '';
 35UPDATE be_Settings SET BlogId = '27604F05-86AD-47EF-9E05-950BB762570C';
 36
 37ALTER TABLE be_Roles ADD BlogID varchar(36) NOT NULL DEFAULT '';
 38UPDATE be_Roles SET BlogID = '27604F05-86AD-47EF-9E05-950BB762570C';
 39
 40ALTER TABLE be_Rights DROP PRIMARY KEY;
 41ALTER TABLE be_Rights ADD RightRowId int(10) UNSIGNED NOT NULL AUTO_INCREMENT, ADD PRIMARY KEY (RightRowId);
 42ALTER TABLE be_Rights ADD BlogId varchar(36) NOT NULL DEFAULT '';
 43UPDATE be_Rights SET BlogId = '27604F05-86AD-47EF-9E05-950BB762570C';
 44
 45ALTER TABLE be_RightRoles DROP PRIMARY KEY;
 46ALTER TABLE be_RightRoles ADD RightRoleRowId int(10) UNSIGNED NOT NULL AUTO_INCREMENT, ADD PRIMARY KEY (RightRoleRowId);
 47ALTER TABLE be_RightRoles ADD BlogId varchar(36) NOT NULL DEFAULT '';
 48UPDATE be_RightRoles SET BlogId = '27604F05-86AD-47EF-9E05-950BB762570C';
 49
 50ALTER TABLE be_Referrers DROP PRIMARY KEY;
 51ALTER TABLE be_Referrers ADD ReferrerRowId int(10) UNSIGNED NOT NULL AUTO_INCREMENT, ADD PRIMARY KEY (ReferrerRowId);
 52
 53ALTER TABLE be_Referrers ADD BlogId varchar(36) NOT NULL DEFAULT '';
 54UPDATE be_Referrers SET BlogId = '27604F05-86AD-47EF-9E05-950BB762570C';
 55
 56ALTER TABLE be_Profiles ADD BlogID varchar(36) NOT NULL DEFAULT '';
 57UPDATE be_Profiles SET BlogID = '27604F05-86AD-47EF-9E05-950BB762570C';
 58
 59ALTER TABLE be_Posts DROP PRIMARY KEY;
 60ALTER TABLE be_Posts ADD PostRowID int(10) UNSIGNED NOT NULL AUTO_INCREMENT, ADD PRIMARY KEY (PostRowID);
 61ALTER TABLE be_Posts ADD BlogID varchar(36) NOT NULL DEFAULT '';
 62UPDATE be_Posts SET BlogID = '27604F05-86AD-47EF-9E05-950BB762570C';
 63
 64ALTER TABLE be_PostTag ADD BlogID varchar(36) NOT NULL DEFAULT '';
 65UPDATE be_PostTag SET BlogID = '27604F05-86AD-47EF-9E05-950BB762570C';
 66
 67ALTER TABLE be_PostNotify ADD BlogID varchar(36) NOT NULL DEFAULT '';
 68UPDATE be_PostNotify SET BlogID = '27604F05-86AD-47EF-9E05-950BB762570C';
 69
 70ALTER TABLE be_PostComment DROP PRIMARY KEY;
 71ALTER TABLE be_PostComment ADD PostCommentRowID int(10) UNSIGNED NOT NULL AUTO_INCREMENT, ADD PRIMARY KEY (PostCommentRowID);
 72ALTER TABLE be_PostComment ADD BlogID varchar(36) NOT NULL DEFAULT '';
 73UPDATE be_PostComment SET BlogID = '27604F05-86AD-47EF-9E05-950BB762570C';
 74
 75ALTER TABLE be_PingService ADD BlogID varchar(36) NOT NULL DEFAULT '';
 76UPDATE be_PingService SET BlogID = '27604F05-86AD-47EF-9E05-950BB762570C';
 77
 78ALTER TABLE be_Pages DROP PRIMARY KEY;
 79ALTER TABLE be_Pages ADD PageRowID int(10) UNSIGNED NOT NULL AUTO_INCREMENT, ADD PRIMARY KEY (PageRowID);
 80ALTER TABLE be_Pages ADD BlogID varchar(36) NOT NULL DEFAULT '';
 81UPDATE be_Pages SET BlogID = '27604F05-86AD-47EF-9E05-950BB762570C';
 82
 83ALTER TABLE be_DataStoreSettings ADD DataStoreSettingRowId int(10) UNSIGNED NOT NULL AUTO_INCREMENT, ADD PRIMARY KEY (DataStoreSettingRowId);
 84ALTER TABLE be_DataStoreSettings ADD BlogId varchar(36) NOT NULL DEFAULT '';
 85UPDATE be_DataStoreSettings SET BlogId = '27604F05-86AD-47EF-9E05-950BB762570C';
 86
 87ALTER TABLE be_Categories DROP PRIMARY KEY;
 88ALTER TABLE be_Categories ADD CategoryRowID int(10) UNSIGNED NOT NULL AUTO_INCREMENT, ADD PRIMARY KEY (CategoryRowID);
 89ALTER TABLE be_Categories ADD BlogID varchar(36) NOT NULL DEFAULT '';
 90UPDATE be_Categories SET BlogID = '27604F05-86AD-47EF-9E05-950BB762570C';
 91
 92ALTER TABLE be_PostCategory ADD BlogID varchar(36) NOT NULL DEFAULT '';
 93UPDATE be_PostCategory SET BlogID = '27604F05-86AD-47EF-9E05-950BB762570C';
 94
 95CREATE TABLE `be_Blogs` (
 96  `BlogRowId` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
 97  `BlogId` varchar(36) NOT NULL DEFAULT '',
 98  `BlogName` varchar(255) NOT NULL DEFAULT '',
 99  `Hostname` varchar(255) NOT NULL DEFAULT '',
100  `IsAnyTextBeforeHostnameAccepted` tinyint(1) NOT NULL DEFAULT 1,
101  `StorageContainerName` varchar(255) NOT NULL DEFAULT '',
102  `VirtualPath` varchar(255) NOT NULL DEFAULT '',
103  `IsPrimary` tinyint(1) NOT NULL DEFAULT 0,
104  `IsActive` tinyint(1) NOT NULL DEFAULT 1,
105  PRIMARY KEY (`BlogRowId`)
106) ENGINE=InnoDB DEFAULT CHARSET=latin1;
107
108INSERT INTO be_Blogs (BlogId, BlogName, Hostname, IsAnyTextBeforeHostnameAccepted, StorageContainerName, VirtualPath, IsPrimary, IsActive) VALUES ('27604f05-86ad-47ef-9e05-950bb762570c', 'Primary', '', 0, '', '~/', 1, 1);
109
110ALTER TABLE be_BlogRollItems DROP PRIMARY KEY;
111ALTER TABLE be_BlogRollItems ADD BlogRollRowId int(10) UNSIGNED NOT NULL AUTO_INCREMENT, ADD PRIMARY KEY (BlogRollRowId);
112ALTER TABLE be_BlogRollItems ADD BlogId varchar(36) NOT NULL DEFAULT '';
113UPDATE be_BlogRollItems SET BlogId = '27604F05-86AD-47EF-9E05-950BB762570C';
114