SET sql_mode = '';
ALTER TABLE `sps_tariff` ADD `sync_at` DATETIME NULL DEFAULT NULL AFTER `superadmin`;
ALTER TABLE `sps_service_type`  ADD `superadmin` TINYINT NOT NULL  AFTER `location_id`;
ALTER TABLE `sps_service_type` ADD `sync_at` DATETIME NULL DEFAULT NULL AFTER `superadmin`;
ALTER TABLE `sps_discounts`  ADD `superadmin` TINYINT NOT NULL  AFTER `location_id`;
ALTER TABLE `sps_discounts` ADD `sync_at` DATETIME NULL DEFAULT NULL AFTER `superadmin`;
ALTER TABLE `sps_special_days`  ADD `superadmin` TINYINT NOT NULL  AFTER `location_id`;
ALTER TABLE `sps_special_days` ADD `sync_at` DATETIME NULL DEFAULT NULL AFTER `superadmin`;
ALTER TABLE `sps_settings`  ADD `superadmin` TINYINT NOT NULL  AFTER `location_id`;
ALTER TABLE `sps_settings` ADD `sync_at` DATETIME NULL DEFAULT NULL AFTER `superadmin`;
ALTER TABLE `sps_tariff_tier`  ADD `superadmin` TINYINT NOT NULL  AFTER `location_id`;
ALTER TABLE `sps_tariff_tier` ADD `sync_at` DATETIME NULL DEFAULT NULL AFTER `superadmin`;

/*----Gate Configuration Table Update---------*/
ALTER TABLE `sps_gate_configurations`  ADD `is_aps` TINYINT NOT NULL  AFTER `gate_type`;
ALTER TABLE `sps_gate_configurations`  ADD `aps_gate_type` ENUM('web','machine') NULL DEFAULT NULL  AFTER `is_aps`;

/*-----APS Payment Modes-----*/
/*US833 - Web APS Payment will consider under master_payment_mode = 4 - Ewallet*/
-- INSERT INTO `sps_master_payment_modes` (`id`, `master_payment_mode`, `location_id`, `area_id`, `created_by`, `updated_by`, `created_at`, `updated_at`, `deleted_at`, `master_payment_description`) VALUES
-- (7, 'Web Payment Gateway', 1, 1, 1, 0, '2020-12-09 11:00:00', '0000-00-00 00:00:00', NULL, 'It will accept money on APS');
INSERT INTO `sps_payment_modes` (`id`, `payment_mode`, `master_id`, `parent_id`, `location_id`, `area_id`, `created_by`, `updated_by`, `created_at`, `updated_at`, `deleted_at`, `payment_description`) VALUES
(6, 'Web APS', 4, 0, 0, 0, 0, 0, '2020-12-09 11:00:00', '2020-12-09 11:00:00', NULL, 'APS Payment Gateway');

/*Update query if payment modes table is already inserted*/ 
Update sps_payment_modes set master_id = 4 where payment_description = 'APS Payment Gateway';
