Change SQL in the OpenSpec change folder, mirrored into local/seed. Local seed keeps only roles 1-3; dev admin no longer needs a first-login change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
18 lines
638 B
SQL
18 lines
638 B
SQL
-- Co-Lite change 2: company and user.company_id. Target: `service-system`. Additive only. Run once.
|
|
USE `service-system`;
|
|
|
|
CREATE TABLE `company` (
|
|
`id` bigint NOT NULL AUTO_INCREMENT,
|
|
`name` varchar(255) NOT NULL,
|
|
`create_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
PRIMARY KEY (`id`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
|
|
|
INSERT INTO `company` (`id`, `name`) VALUES (1, 'Co-Lite');
|
|
|
|
-- Nullable: member rows share the `user` table and have no company.
|
|
ALTER TABLE `user` ADD COLUMN `company_id` bigint NULL;
|
|
|
|
-- Every existing admin belongs to the one company.
|
|
UPDATE `user` SET `company_id` = 1 WHERE `type` = 'A';
|