 -- 初始帐套
INSERT INTO "Company" ("objectId", "title", "createdAt", "updatedAt")
VALUES
('RbIKpmuaMC', '国家级本科教材遴选','2024-06-16 12:00:00','2024-06-16 12:00:00')
ON conflict("objectId") DO UPDATE
SET "title" = excluded."title","createdAt"=excluded."createdAt","updatedAt"=excluded."updatedAt";


-- 初始超级管理员 bookadmin bk2024
INSERT INTO "_User" ("objectId", "username", "_hashed_password", "company", "createdAt", "updatedAt")
VALUES
('BOOKADMINI', 'bookadmin','$2y$10$diWXn9Sksms/neufGnphU.4wKUXF0CivkRltz4.NMEF9f4MJu2aX6','RbIKpmuaMC','2024-06-16 12:00:00','2024-06-16 12:00:00')
ON conflict("objectId") DO UPDATE
SET 
"username" = excluded."username",
"company" = excluded."company",
"createdAt"=excluded."createdAt",
"updatedAt"=excluded."updatedAt";

-- 初始化超级管理员角色
INSERT INTO "_Role" ("objectId","title", "name", "_rperm", "_wperm", "company", "createdAt", "updatedAt")
VALUES
('ZQOwyoDteL','超级管理员', 'superadmin','{*,BOOKADMINI}','{BOOKADMINI}','RbIKpmuaMC','2024-06-16 12:00:00','2024-06-16 12:00:00')
ON conflict("objectId") DO UPDATE
SET 
"title" = excluded."title",
"name" = excluded."name",
"company" = excluded."company",
"createdAt"=excluded."createdAt";

-- 超级管理员帐号，添加至超管用户组
INSERT INTO "_Join:users:_Role" ("relatedId", "owningId")
VALUES
('BOOKADMINI', 'ZQOwyoDteL')
ON conflict("relatedId","owningId") DO UPDATE
SET 
"relatedId" = excluded."relatedId",
"owningId" = excluded."owningId";
