38471-vm/db/migrations/20260318_create_outlets_table.sql
2026-03-18 09:45:33 +00:00

13 lines
453 B
SQL

CREATE TABLE IF NOT EXISTS outlets (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255) NOT NULL,
address TEXT NULL,
phone VARCHAR(50) NULL,
status ENUM('active', 'inactive') DEFAULT 'active',
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
INSERT INTO outlets (id, name, address, phone, status, created_at)
SELECT 1, 'Main Outlet', 'Head Office', '', 'active', NOW()
WHERE NOT EXISTS (SELECT 1 FROM outlets WHERE id = 1);