init-data.sql.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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 "_Join:users:_Role" ("relatedId", "owningId")
  31. VALUES
  32. ('6684b5464b9206e48dbcf67c', 'ZQOwyoDteL')
  33. ON conflict("relatedId","owningId") DO UPDATE
  34. SET
  35. "relatedId" = excluded."relatedId",
  36. "owningId" = excluded."owningId";
  37. `