init-data.sql.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. export const initDataSQL = `
  2. -- 初始帐套
  3. INSERT INTO "Company" ("objectId", "title", "createdAt", "updatedAt")
  4. VALUES
  5. ('RbIKpmuaMC', '国家级本科教材遴选','2024-06-16 12:00:00','2024-06-16 12:00:00')
  6. ON conflict("objectId") DO UPDATE
  7. SET "title" = excluded."title","createdAt"=excluded."createdAt","updatedAt"=excluded."updatedAt";
  8. -- 初始超级管理员 bookadmin bk2024
  9. -- Authing同步用户ID 6684b5464b9206e48dbcf67c
  10. INSERT INTO "_User" ("objectId", "username", "_hashed_password", "company", "createdAt", "updatedAt")
  11. VALUES
  12. ('6684b5464b9206e48dbcf67c', 'bookadmin','$2y$10$diWXn9Sksms/neufGnphU.4wKUXF0CivkRltz4.NMEF9f4MJu2aX6','RbIKpmuaMC','2024-06-16 12:00:00','2024-06-16 12:00:00')
  13. ON conflict("objectId") DO UPDATE
  14. SET
  15. "username" = excluded."username",
  16. "company" = excluded."company",
  17. "createdAt"=excluded."createdAt",
  18. "updatedAt"=excluded."updatedAt";
  19. -- 初始化超级管理员角色
  20. INSERT INTO "_Role" ("objectId","title", "name", "_rperm", "_wperm", "company", "createdAt", "updatedAt")
  21. VALUES
  22. ('ZQOwyoDteL','超级管理员', 'superadmin','{*,6684b5464b9206e48dbcf67c}','{6684b5464b9206e48dbcf67c}','RbIKpmuaMC','2024-06-16 12:00:00','2024-06-16 12:00:00')
  23. ON conflict("objectId") DO UPDATE
  24. SET
  25. "title" = excluded."title",
  26. "name" = excluded."name",
  27. "company" = excluded."company",
  28. "createdAt"=excluded."createdAt";
  29. -- 初始化管理员角色
  30. INSERT INTO "_Role" ("objectId","title", "name", "_rperm", "_wperm", "company", "createdAt", "updatedAt")
  31. VALUES
  32. ('ADMININITI','管理员', 'admin','{*,6684b5464b9206e48dbcf67c}','{6684b5464b9206e48dbcf67c}','RbIKpmuaMC','2024-06-16 12:00:00','2024-06-16 12:00:00')
  33. ON conflict("objectId") DO UPDATE
  34. SET
  35. "title" = excluded."title",
  36. "name" = excluded."name",
  37. "company" = excluded."company",
  38. "createdAt"=excluded."createdAt";
  39. -- 初始化操作员角色
  40. INSERT INTO "_Role" ("objectId","title", "name", "_rperm", "_wperm", "company", "createdAt", "updatedAt")
  41. VALUES
  42. ('MANAGERINT','操作员', 'manager','{*,6684b5464b9206e48dbcf67c}','{6684b5464b9206e48dbcf67c}','RbIKpmuaMC','2024-06-16 12:00:00','2024-06-16 12:00:00')
  43. ON conflict("objectId") DO UPDATE
  44. SET
  45. "title" = excluded."title",
  46. "name" = excluded."name",
  47. "company" = excluded."company",
  48. "createdAt"=excluded."createdAt";
  49. -- 超级管理员帐号,添加至超管用户组
  50. INSERT INTO "_Join:users:_Role" ("relatedId", "owningId")
  51. VALUES
  52. ('6684b5464b9206e48dbcf67c', 'ZQOwyoDteL')
  53. ON conflict("relatedId","owningId") DO UPDATE
  54. SET
  55. "relatedId" = excluded."relatedId",
  56. "owningId" = excluded."owningId";
  57. `