-- Add branch_id to users table
ALTER TABLE `users`
ADD COLUMN `branch_id` INT UNSIGNED DEFAULT 1 AFTER `role`;

ALTER TABLE `users`
ADD CONSTRAINT `fk_users_branch` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL;