-
Notifications
You must be signed in to change notification settings - Fork 865
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2b2e5fd
commit 7c7434f
Showing
3 changed files
with
201 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
CREATE TABLE IF NOT EXISTS `ArticleTypeRelation` ( | ||
`ArticleId` VARCHAR(100) NOT NULL, | ||
`ArticleTypeId` VARCHAR(100) NOT NULL, | ||
PRIMARY KEY (`ArticleId`, `ArticleTypeId`) | ||
); | ||
|
||
TRUNCATE TABLE `ArticleTypeRelation`; | ||
|
||
INSERT INTO `ArticleTypeRelation` (ArticleId, ArticleTypeId) | ||
SELECT DISTINCT IFNULL(ContentID, ID), ArticleTypeID FROM `Article`; | ||
|
||
CREATE TABLE IF NOT EXISTS `CMS_WidgetArticleTypeRelation` ( | ||
`WidgetId` VARCHAR(100) NOT NULL, | ||
`ArticleTypeId` INT NOT NULL, | ||
PRIMARY KEY (`WidgetId`, `ArticleTypeId`) | ||
); | ||
|
||
TRUNCATE TABLE `CMS_WidgetArticleTypeRelation`; | ||
|
||
INSERT INTO `CMS_WidgetArticleTypeRelation` (WidgetId, ArticleTypeId) | ||
SELECT T0.ID, T1.ID FROM `ArticleListWidget` T0 | ||
INNER JOIN `ArticleType` T1 ON T0.ArticleTypeID = T1.ID OR T0.ArticleTypeID = T1.ParentID | ||
UNION | ||
SELECT T0.ID, T1.ID FROM `ArticleTopWidget` T0 | ||
INNER JOIN `ArticleType` T1 ON T0.ArticleTypeID = T1.ID OR T0.ArticleTypeID = T1.ParentID | ||
UNION | ||
SELECT T0.ID, T1.ID FROM `ArticleTypeWidget` T0 | ||
INNER JOIN `ArticleType` T1 ON T0.ArticleTypeID = T1.ID OR T0.ArticleTypeID = T1.ParentID; | ||
|
||
CREATE TABLE IF NOT EXISTS `ProductCategoryRelation` ( | ||
`ProductId` VARCHAR(100) NOT NULL, | ||
`ProductCategoryId` VARCHAR(100) NOT NULL, | ||
PRIMARY KEY (`ProductId`, `ProductCategoryId`) | ||
); | ||
|
||
TRUNCATE TABLE `ProductCategoryRelation`; | ||
|
||
INSERT INTO `ProductCategoryRelation` (ProductId, ProductCategoryId) | ||
SELECT DISTINCT IFNULL(ContentID, ID), ProductCategoryID FROM `Product`; | ||
|
||
CREATE TABLE IF NOT EXISTS `CMS_WidgetProductCategoryRelation` ( | ||
`WidgetId` VARCHAR(100) NOT NULL, | ||
`ProductCategoryId` INT NOT NULL, | ||
PRIMARY KEY (`WidgetId`, `ProductCategoryId`) | ||
); | ||
|
||
TRUNCATE TABLE `CMS_WidgetProductCategoryRelation`; | ||
|
||
INSERT INTO `CMS_WidgetProductCategoryRelation` (WidgetId, ProductCategoryId) | ||
SELECT T0.ID, T1.ID FROM `ProductListWidget` T0 | ||
INNER JOIN `ProductCategory` T1 ON T0.ProductCategoryID = T1.ID OR T0.ProductCategoryID = T1.ParentID | ||
UNION | ||
SELECT T0.ID, T1.ID FROM `ProductCategoryWidget` T0 | ||
INNER JOIN `ProductCategory` T1 ON T0.ProductCategoryID = T1.ID OR T0.ProductCategoryID = T1.ParentID; | ||
|
||
CREATE TABLE IF NOT EXISTS `VideoTypeRelation` ( | ||
`VideoId` VARCHAR(100) NOT NULL, | ||
`VideoTypeId` VARCHAR(100) NOT NULL, | ||
PRIMARY KEY (`VideoId`, `VideoTypeId`) | ||
); | ||
|
||
TRUNCATE TABLE `VideoTypeRelation`; | ||
|
||
INSERT INTO `VideoTypeRelation` (VideoId, VideoTypeId) | ||
SELECT DISTINCT IFNULL(ContentID, ID), VideoTypeID FROM `Video`; | ||
|
||
CREATE TABLE IF NOT EXISTS `CMS_WidgetVideoTypeRelation` ( | ||
`WidgetId` VARCHAR(100) NOT NULL, | ||
`VideoTypeId` INT NOT NULL, | ||
PRIMARY KEY (`WidgetId`, `VideoTypeId`) | ||
); | ||
|
||
TRUNCATE TABLE `CMS_WidgetVideoTypeRelation`; | ||
|
||
INSERT INTO `CMS_WidgetVideoTypeRelation` (WidgetId, VideoTypeId) | ||
SELECT T0.ID, T1.ID FROM `VideoListWidget` T0 | ||
INNER JOIN `VideoType` T1 ON T0.VideoTypeID = T1.ID OR T0.VideoTypeID = T1.ParentID | ||
UNION | ||
SELECT T0.ID, T1.ID FROM `VideoTopWidget` T0 | ||
INNER JOIN `VideoType` T1 ON T0.VideoTypeID = T1.ID OR T0.VideoTypeID = T1.ParentID | ||
UNION | ||
SELECT T0.ID, T1.ID FROM `VideoTypeWidget` T0 | ||
INNER JOIN `VideoType` T1 ON T0.VideoTypeID = T1.ID OR T0.VideoTypeID = T1.ParentID; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
CREATE TABLE IF NOT EXISTS ArticleTypeRelation ( | ||
ArticleId TEXT NOT NULL, | ||
ArticleTypeId TEXT NOT NULL, | ||
PRIMARY KEY (ArticleId, ArticleTypeId) | ||
); | ||
|
||
DELETE FROM ArticleTypeRelation; | ||
|
||
INSERT INTO ArticleTypeRelation (ArticleId, ArticleTypeId) | ||
SELECT DISTINCT IFNULL(ContentID, ID), ArticleTypeID FROM Article; | ||
|
||
CREATE TABLE IF NOT EXISTS CMS_WidgetArticleTypeRelation ( | ||
WidgetId TEXT NOT NULL, | ||
ArticleTypeId INTEGER NOT NULL, | ||
PRIMARY KEY (WidgetId, ArticleTypeId) | ||
); | ||
|
||
DELETE FROM CMS_WidgetArticleTypeRelation; | ||
|
||
INSERT INTO CMS_WidgetArticleTypeRelation (WidgetId, ArticleTypeId) | ||
SELECT T0.ID, T1.ID FROM ArticleListWidget T0 | ||
INNER JOIN ArticleType T1 ON T0.ArticleTypeID = T1.ID OR T0.ArticleTypeID = T1.ParentID | ||
UNION | ||
SELECT T0.ID, T1.ID FROM ArticleTopWidget T0 | ||
INNER JOIN ArticleType T1 ON T0.ArticleTypeID = T1.ID OR T0.ArticleTypeID = T1.ParentID | ||
UNION | ||
SELECT T0.ID, T1.ID FROM ArticleTypeWidget T0 | ||
INNER JOIN ArticleType T1 ON T0.ArticleTypeID = T1.ID OR T0.ArticleTypeID = T1.ParentID; | ||
|
||
CREATE TABLE IF NOT EXISTS ProductCategoryRelation ( | ||
ProductId TEXT NOT NULL, | ||
ProductCategoryId TEXT NOT NULL, | ||
PRIMARY KEY (ProductId, ProductCategoryId) | ||
); | ||
|
||
DELETE FROM ProductCategoryRelation; | ||
|
||
INSERT INTO ProductCategoryRelation (ProductId, ProductCategoryId) | ||
SELECT DISTINCT IFNULL(ContentID, ID), ProductCategoryID FROM Product; | ||
|
||
CREATE TABLE IF NOT EXISTS CMS_WidgetProductCategoryRelation ( | ||
WidgetId TEXT NOT NULL, | ||
ProductCategoryId INTEGER NOT NULL, | ||
PRIMARY KEY (WidgetId, ProductCategoryId) | ||
); | ||
|
||
DELETE FROM CMS_WidgetProductCategoryRelation; | ||
|
||
INSERT INTO CMS_WidgetProductCategoryRelation (WidgetId, ProductCategoryId) | ||
SELECT T0.ID, T1.ID FROM ProductListWidget T0 | ||
INNER JOIN ProductCategory T1 ON T0.ProductCategoryID = T1.ID OR T0.ProductCategoryID = T1.ParentID | ||
UNION | ||
SELECT T0.ID, T1.ID FROM ProductCategoryWidget T0 | ||
INNER JOIN ProductCategory T1 ON T0.ProductCategoryID = T1.ID OR T0.ProductCategoryID = T1.ParentID; | ||
|
||
CREATE TABLE IF NOT EXISTS VideoTypeRelation ( | ||
VideoId TEXT NOT NULL, | ||
VideoTypeId TEXT NOT NULL, | ||
PRIMARY KEY (VideoId, VideoTypeId) | ||
); | ||
|
||
DELETE FROM VideoTypeRelation; | ||
|
||
INSERT INTO VideoTypeRelation (VideoId, VideoTypeId) | ||
SELECT DISTINCT IFNULL(ContentID, ID), VideoTypeID FROM Video; | ||
|
||
CREATE TABLE IF NOT EXISTS CMS_WidgetVideoTypeRelation ( | ||
WidgetId TEXT NOT NULL, | ||
VideoTypeId INTEGER NOT NULL, | ||
PRIMARY KEY (WidgetId, VideoTypeId) | ||
); | ||
|
||
DELETE FROM CMS_WidgetVideoTypeRelation; | ||
|
||
INSERT INTO CMS_WidgetVideoTypeRelation (WidgetId, VideoTypeId) | ||
SELECT T0.ID, T1.ID FROM VideoListWidget T0 | ||
INNER JOIN VideoType T1 ON T0.VideoTypeID = T1.ID OR T0.VideoTypeID = T1.ParentID | ||
UNION | ||
SELECT T0.ID, T1.ID FROM VideoTopWidget T0 | ||
INNER JOIN VideoType T1 ON T0.VideoTypeID = T1.ID OR T0.VideoTypeID = T1.ParentID | ||
UNION | ||
SELECT T0.ID, T1.ID FROM VideoTypeWidget T0 | ||
INNER JOIN VideoType T1 ON T0.VideoTypeID = T1.ID OR T0.VideoTypeID = T1.ParentID; |