f357330ba8
- 将用户角色字段从role改为is_admin布尔值 - 更新相关API权限检查逻辑 - 修改数据库schema和迁移文件 - 调整前端用户显示逻辑 - 添加API响应工具函数 - 优化权限检查中间件 - 重构英雄组件为原子组件
17 lines
805 B
SQL
17 lines
805 B
SQL
PRAGMA foreign_keys=OFF;--> statement-breakpoint
|
|
CREATE TABLE `__new_users` (
|
|
`id` text PRIMARY KEY NOT NULL,
|
|
`email` text NOT NULL,
|
|
`password_hash` text,
|
|
`name` text NOT NULL,
|
|
`is_admin` integer DEFAULT false NOT NULL,
|
|
`avatar` text,
|
|
`created_at` integer NOT NULL,
|
|
`updated_at` integer NOT NULL
|
|
);
|
|
--> statement-breakpoint
|
|
INSERT INTO `__new_users`("id", "email", "password_hash", "name", "is_admin", "avatar", "created_at", "updated_at") SELECT "id", "email", "password_hash", "name", "is_admin", "avatar", "created_at", "updated_at" FROM `users`;--> statement-breakpoint
|
|
DROP TABLE `users`;--> statement-breakpoint
|
|
ALTER TABLE `__new_users` RENAME TO `users`;--> statement-breakpoint
|
|
PRAGMA foreign_keys=ON;--> statement-breakpoint
|
|
CREATE UNIQUE INDEX `users_email_unique` ON `users` (`email`); |