CREATE TABLE IF NOT EXISTS tbltenant_cp_pay_card_readers  (	
  `id` BIGINT NOT NULL AUTO_INCREMENT,
  `tenant_id` BIGINT UNSIGNED NOT NULL,
  `staff_id` BIGINT UNSIGNED NOT NULL,
  `name` VARCHAR(255) NOT NULL,
  `description` VARCHAR(255) NULL,
  `model` ENUM('PAX_D135') NOT NULL ,  
  `serial_number` VARCHAR(100) NOT NULL, 
  `device_id` VARCHAR(255) NOT NULL,
  `status` TINYINT DEFAULT NULL COMMENT '1 = Active | 0 = Deactive ',
  `created_at` DATETIME DEFAULT NULL,
  `updated_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,  
  PRIMARY KEY (`id`),
  KEY `tenant_id` (`tenant_id`),
  KEY `staff_id` (`staff_id`),
  KEY `device_id` (`device_id`)
) ENGINE=INNODB DEFAULT CHARSET=utf8mb3;

ALTER TABLE tbltenant_cp_pay_card_readers
ADD CONSTRAINT fk_tenant_cp_pay_card_readers_tenant_id
FOREIGN KEY (tenant_id)
REFERENCES tbltenants(id)
ON DELETE CASCADE
ON UPDATE CASCADE;

ALTER TABLE tblinvoicepaymentrecords ADD authorize_signature VARCHAR(40) DEFAULT NULL AFTER cancel_note;
ALTER TABLE tblinvoicepaymentrecords ADD authorize_ip_addr VARCHAR(40) DEFAULT NULL AFTER authorize_signature;
ALTER TABLE tblinvoicepaymentrecords ADD authorize_signed_on DATETIME DEFAULT NULL AFTER authorize_ip_addr;