feat(db): company, user.company_id and Co-Lite back-office modules
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
This commit is contained in:
1 parent
f97bf48d93
commit
42071a850f
6 files changed
+51
-9
No files matched your search
@@ -0,0 +1,17 @@
|
||||
-- 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';
|
||||
@@ -0,0 +1,9 @@
|
||||
-- Co-Lite change 2: back-office modules read by the admin portal (area BO).
|
||||
-- Target: `service-system`.`module`. Additive only. Run once.
|
||||
-- ROLE_SUPER_ADMIN (id 1) passes every module check and needs no modules_roles rows.
|
||||
USE `service-system`;
|
||||
|
||||
INSERT INTO `module` (`id`, `name`, `desc`, `area`, `type`, `parent`, `url`, `icon_name`) VALUES
|
||||
(40000000, 'BO_ROOT', 'Back Office', 'BO', 'R', 0, NULL, NULL),
|
||||
(40700000, 'BO_USERS', 'Users', 'BO', 'M', 40000000, '/users', 'UserCog'),
|
||||
(40800000, 'BO_ROLES', 'Roles', 'BO', 'M', 40000000, '/roles', 'ShieldCheck');
|
||||
@@ -0,0 +1,6 @@
|
||||
-- Rollback for 01-company.sql and 02-bo-modules.sql.
|
||||
USE `service-system`;
|
||||
DELETE FROM `modules_roles` WHERE `module_id` IN (40000000, 40700000, 40800000);
|
||||
DELETE FROM `module` WHERE `id` IN (40000000, 40700000, 40800000);
|
||||
ALTER TABLE `user` DROP COLUMN `company_id`;
|
||||
DROP TABLE `company`;
|
||||
Reference in new issue
Block a user