Merge branch 'develop'
This commit is contained in:
commit
ea75813b98
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "swaf",
|
"name": "swaf",
|
||||||
"version": "0.23.4",
|
"version": "0.23.5",
|
||||||
"description": "Structure Web Application Framework.",
|
"description": "Structure Web Application Framework.",
|
||||||
"repository": "https://eternae.ink/arisu/swaf",
|
"repository": "https://eternae.ink/arisu/swaf",
|
||||||
"author": "Alice Gaudon <alice@gaudon.pro>",
|
"author": "Alice Gaudon <alice@gaudon.pro>",
|
||||||
|
@ -15,10 +15,12 @@ export default class AddNameToUsersMigration extends Migration {
|
|||||||
|
|
||||||
// Give every user a random name
|
// Give every user a random name
|
||||||
const users = await User.select().get(this.getCurrentConnection());
|
const users = await User.select().get(this.getCurrentConnection());
|
||||||
|
const callbacks: (() => Promise<void>)[] = [];
|
||||||
await Promise.all(users.map(user => {
|
await Promise.all(users.map(user => {
|
||||||
user.name = nanoid();
|
user.name = nanoid();
|
||||||
return user.save(this.getCurrentConnection());
|
return user.save(this.getCurrentConnection(), c => callbacks.push(c));
|
||||||
}));
|
}));
|
||||||
|
await Promise.all(callbacks);
|
||||||
|
|
||||||
await this.query(`ALTER TABLE users
|
await this.query(`ALTER TABLE users
|
||||||
ADD CONSTRAINT UNIQUE (name)`);
|
ADD CONSTRAINT UNIQUE (name)`);
|
||||||
|
Loading…
Reference in New Issue
Block a user