-- ProArt Accounting - Token Table Migration -- Run this on your existing database CREATE TABLE IF NOT EXISTS `tokens` ( `record_id` INT(11) NOT NULL AUTO_INCREMENT, `token` VARCHAR(128) NOT NULL, `user_id` INT(11) NOT NULL, `created_at` DATETIME NOT NULL, `expires_at` DATETIME NOT NULL, `active` TINYINT(1) NOT NULL DEFAULT 1, PRIMARY KEY (`record_id`), UNIQUE KEY `token` (`token`), KEY `user_id` (`user_id`), KEY `expires_at` (`expires_at`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- Ensure logs table has table_name and affected_record columns ALTER TABLE `logs` ADD COLUMN IF NOT EXISTS `table_name` VARCHAR(255) DEFAULT NULL, ADD COLUMN IF NOT EXISTS `affected_record` INT(11) DEFAULT 0; -- Add a default admin user (password: admin123 — CHANGE THIS!) -- Password is SHA-256 of 'admin123' INSERT IGNORE INTO `proart_accounting_users` (`record_id`, `username`, `password`, `email`, `rights`) VALUES (1, 'admin', SHA2('admin123', 256), 'admin@proartmoldings.co.za', 'admin');