DROP TABLE IF EXISTS `shopifyshop`;
CREATE TABLE `shopifyshop` (
    `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
    `storeId` int(10) UNSIGNED NOT NULL,
    `shop` varchar(50) NOT NULL DEFAULT '',
    `token` varchar(50) NOT NULL DEFAULT '',
    `locationGid` varchar(50) NULL DEFAULT '',
    `active` tinyint(1) NOT NULL DEFAULT 1,
    `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
    `createdById` int(10) UNSIGNED NOT NULL DEFAULT 10 ,
    `updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    `updatedById` int(10) UNSIGNED NOT NULL DEFAULT 10,
    PRIMARY KEY (`id`),
    INDEX `storeId` (`storeId`) USING BTREE,
    INDEX `shop` (`shop`) USING BTREE,
    INDEX `token` (`token`) USING BTREE,
    INDEX `locationGid` (`locationGid`) USING BTREE
)ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

ALTER TABLE `ecommerceinfo` DROP INDEX `shopifyShop`;
ALTER TABLE `ecommerceinfo` DROP `shopifyShop`;
ALTER TABLE `ecommerceinfo` DROP `shopifyToken`;
ALTER TABLE `shopifyproductinfo` DROP INDEX `storeId`;
ALTER TABLE `shopifyproductinfo` DROP `storeId`;

ALTER TABLE `shopifyproductinfo` ADD COLUMN `shopId` int(10) UNSIGNED NOT NULL AFTER `id`;
ALTER TABLE `shopifyproductinfo` ADD INDEX(`shopId`);

DROP TABLE IF EXISTS `shopifyotherinfo`;
CREATE TABLE `shopifyotherinfo` (
   `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
   `shopId` int(10) UNSIGNED NOT NULL,
   `entityType` varchar(15) NOT NULL DEFAULT '',
   `entityId` varchar(10) NOT NULL DEFAULT '',
   `gid` varchar(50) NOT NULL DEFAULT '',
   `active` tinyint(1) NOT NULL DEFAULT 1,
   `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
   `createdById` int(10) UNSIGNED NOT NULL DEFAULT 10 ,
   `updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
   `updatedById` int(10) UNSIGNED NOT NULL DEFAULT 10,
   PRIMARY KEY (`id`),
   INDEX `shopId` (`shopId`) USING BTREE,
   INDEX `entityType` (`entityType`) USING BTREE,
   INDEX `entityId` (`entityId`) USING BTREE,
   INDEX `gid` (`gid`) USING BTREE
)ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

