Skip to content

Instantly share code, notes, and snippets.

@link89
Created October 31, 2024 08:33
Show Gist options
  • Select an option

  • Save link89/df29d8ab7efbc8086545250526e697a4 to your computer and use it in GitHub Desktop.

Select an option

Save link89/df29d8ab7efbc8086545250526e697a4 to your computer and use it in GitHub Desktop.
Modify SCOW database

SCOW 数据表修改

通过数据库操作支持一些目前暂不支持在界面操作的 SCOW 功能。 以下操作需在 mis 的 db 容器中完成。

docker exec -it <container-id> bash
mysql -p 
<enter password>

use scow;

更改 account owner

找出需要修改的记录

select user_account.id, user.name, account.account_name, role from user_account inner join user on user_account.user_id=user.id inner join account on user_account.account_id=account.id where account.account_name = "freshmen";
+-----+-------+--------------+-------+
| id  | name  | account_name | role  |
+-----+-------+--------------+-------+
|   1 | whxu  | freshmen     | OWNER |
| 125 | ypliu | freshmen     | USER  |
+-----+-------+--------------+-------+

根据需要替换最后 where 的查询条件。

使用事务进行修改

start transaction;
update user_account set role = "USER" where id = 1 limit 1;
update user_account set role = "OWNER" where id = 125 limit 1;
commit;

如果操作错误,执行 rollback 即可回滚。

@tongchong
Copy link

进入 mis 的 db 可以使用

./cli db
use scow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment