36573-vm/db/migrations/006_add_trade_ref_bank_and_signature.sql
2025-12-04 02:32:25 +00:00

31 lines
1.4 KiB
SQL

-- Add new tables for trade references and bank details
CREATE TABLE IF NOT EXISTS `customer_trade_references` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`customer_application_id` int(11) NOT NULL,
`company_name` varchar(255) NOT NULL,
`contact_person` varchar(255) DEFAULT NULL,
`email` varchar(255) DEFAULT NULL,
`phone` varchar(50) DEFAULT NULL,
`address` text,
PRIMARY KEY (`id`),
KEY `customer_application_id` (`customer_application_id`),
CONSTRAINT `customer_trade_references_ibfk_1` FOREIGN KEY (`customer_application_id`) REFERENCES `customer_applications` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE IF NOT EXISTS `customer_bank_details` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`customer_application_id` int(11) NOT NULL,
`bank_name` varchar(255) DEFAULT NULL,
`branch` varchar(255) DEFAULT NULL,
`bsb_number` varchar(50) DEFAULT NULL,
`account_number` varchar(50) DEFAULT NULL,
`account_name` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `customer_application_id` (`customer_application_id`),
CONSTRAINT `customer_bank_details_ibfk_1` FOREIGN KEY (`customer_application_id`) REFERENCES `customer_applications` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- Add columns for declaration and signature to customer_applications
ALTER TABLE `customer_applications`
ADD COLUMN `declaration_text` TEXT,
ADD COLUMN `signature_path` VARCHAR(255);