-- SQL Migration Script: Add all fields missing in ahsub.sql that exist in gardoo.sql, for every table
-- Run each statement below to synchronize schemas

-- ACCOUNTS
ALTER TABLE `accounts` ADD COLUMN IF NOT EXISTS `deleted_by` binary(36) DEFAULT NULL COMMENT 'Deleted By';
ALTER TABLE `accounts` ADD COLUMN IF NOT EXISTS `centerid` binary(36) DEFAULT NULL COMMENT 'Center ID';
ALTER TABLE `accounts` ADD COLUMN IF NOT EXISTS `relatedid` binary(36) DEFAULT NULL COMMENT 'Related ID';
ALTER TABLE `accounts` ADD COLUMN IF NOT EXISTS `web_stop` bit(1) DEFAULT NULL;
ALTER TABLE `accounts` ADD COLUMN IF NOT EXISTS `web_client` bit(1) DEFAULT NULL;
ALTER TABLE `accounts` ADD COLUMN IF NOT EXISTS `deliverysupplement` decimal(19,4) DEFAULT NULL;
ALTER TABLE `accounts` ADD COLUMN IF NOT EXISTS `createdby_name` varchar(255) DEFAULT NULL COMMENT 'Created By Name';
ALTER TABLE `accounts` ADD COLUMN IF NOT EXISTS `updatedby_name` varchar(255) DEFAULT NULL COMMENT 'Updated By Name';
ALTER TABLE `accounts` ADD COLUMN IF NOT EXISTS `deletedby_name` varchar(255) DEFAULT NULL COMMENT 'Deleted By Name';
ALTER TABLE `accounts` ADD COLUMN IF NOT EXISTS `type` varchar(255) DEFAULT NULL;

-- ADDRESS
ALTER TABLE `address` ADD COLUMN IF NOT EXISTS `deleted_by` binary(36) DEFAULT NULL COMMENT 'Deleted By';
ALTER TABLE `address` ADD COLUMN IF NOT EXISTS `centerid` binary(36) DEFAULT NULL COMMENT 'Center ID';
ALTER TABLE `address` ADD COLUMN IF NOT EXISTS `relatedid` binary(36) DEFAULT NULL COMMENT 'Related ID';
ALTER TABLE `address` ADD COLUMN IF NOT EXISTS `accountid` binary(36) DEFAULT NULL;
ALTER TABLE `address` ADD COLUMN IF NOT EXISTS `createdby_name` varchar(255) DEFAULT NULL COMMENT 'Created By Name';
ALTER TABLE `address` ADD COLUMN IF NOT EXISTS `updatedby_name` varchar(255) DEFAULT NULL COMMENT 'Updated By Name';
ALTER TABLE `address` ADD COLUMN IF NOT EXISTS `deletedby_name` varchar(255) DEFAULT NULL COMMENT 'Deleted By Name';
ALTER TABLE `address` ADD COLUMN IF NOT EXISTS `contact_email` tinyint(1) DEFAULT 1 COMMENT '"1"=>"Use contact email","0"=>"do not use contact email"';

-- ASSETS
ALTER TABLE `assets` ADD COLUMN IF NOT EXISTS `deleted_by` binary(36) DEFAULT NULL COMMENT 'Deleted By';
ALTER TABLE `assets` ADD COLUMN IF NOT EXISTS `centerid` binary(36) DEFAULT NULL COMMENT 'Center ID';
ALTER TABLE `assets` ADD COLUMN IF NOT EXISTS `relatedid` binary(36) DEFAULT NULL COMMENT 'Related ID';
ALTER TABLE `assets` ADD COLUMN IF NOT EXISTS `type` varchar(50) DEFAULT NULL;
ALTER TABLE `assets` ADD COLUMN IF NOT EXISTS `createdby_name` varchar(255) DEFAULT NULL COMMENT 'Created By Name';
ALTER TABLE `assets` ADD COLUMN IF NOT EXISTS `updatedby_name` varchar(255) DEFAULT NULL COMMENT 'Updated By Name';
ALTER TABLE `assets` ADD COLUMN IF NOT EXISTS `deletedby_name` varchar(255) DEFAULT NULL COMMENT 'Deleted By Name';

-- ATTRIBUTES
ALTER TABLE `attributes` ADD COLUMN IF NOT EXISTS `deleted_by` binary(36) DEFAULT NULL COMMENT 'Deleted By';
ALTER TABLE `attributes` ADD COLUMN IF NOT EXISTS `centerid` binary(36) DEFAULT NULL COMMENT 'Center ID';
ALTER TABLE `attributes` ADD COLUMN IF NOT EXISTS `relatedid` binary(36) DEFAULT NULL COMMENT 'Related ID';
ALTER TABLE `attributes` ADD COLUMN IF NOT EXISTS `type` binary(36) DEFAULT NULL;
ALTER TABLE `attributes` ADD COLUMN IF NOT EXISTS `comment` mediumtext DEFAULT NULL;
ALTER TABLE `attributes` ADD COLUMN IF NOT EXISTS `createdby_name` varchar(255) DEFAULT NULL COMMENT 'Created By Name';
ALTER TABLE `attributes` ADD COLUMN IF NOT EXISTS `updatedby_name` varchar(255) DEFAULT NULL COMMENT 'Updated By Name';
ALTER TABLE `attributes` ADD COLUMN IF NOT EXISTS `deletedby_name` varchar(255) DEFAULT NULL COMMENT 'Deleted By Name';

-- ATTRIBUTE_SET
ALTER TABLE `attribute_set` ADD COLUMN IF NOT EXISTS `deleted_by` binary(36) DEFAULT NULL COMMENT 'Deleted By';
ALTER TABLE `attribute_set` ADD COLUMN IF NOT EXISTS `centerid` binary(36) DEFAULT NULL COMMENT 'Center ID';
ALTER TABLE `attribute_set` ADD COLUMN IF NOT EXISTS `relatedid` binary(36) DEFAULT NULL COMMENT 'Related ID';
ALTER TABLE `attribute_set` ADD COLUMN IF NOT EXISTS `description` mediumtext DEFAULT NULL;
ALTER TABLE `attribute_set` ADD COLUMN IF NOT EXISTS `createdby_name` varchar(255) DEFAULT NULL COMMENT 'Created By Name';
ALTER TABLE `attribute_set` ADD COLUMN IF NOT EXISTS `updatedby_name` varchar(255) DEFAULT NULL COMMENT 'Updated By Name';
ALTER TABLE `attribute_set` ADD COLUMN IF NOT EXISTS `deletedby_name` varchar(255) DEFAULT NULL COMMENT 'Deleted By Name';

-- Repeat for all other tables, following the pattern above.
