mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-15 05:41:51 +00:00
Fix antiraid level upsert for MySQL
This commit is contained in:
parent
49cefe406e
commit
f916e8c156
1 changed files with 5 additions and 2 deletions
|
@ -27,6 +27,7 @@ export class GuildAntiraidLevels extends BaseGuildRepository {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// Upsert: https://stackoverflow.com/a/47064558/316944
|
// Upsert: https://stackoverflow.com/a/47064558/316944
|
||||||
|
// But the MySQL version: https://github.com/typeorm/typeorm/issues/1090#issuecomment-634391487
|
||||||
await this.antiraidLevels
|
await this.antiraidLevels
|
||||||
.createQueryBuilder()
|
.createQueryBuilder()
|
||||||
.insert()
|
.insert()
|
||||||
|
@ -34,8 +35,10 @@ export class GuildAntiraidLevels extends BaseGuildRepository {
|
||||||
guild_id: this.guildId,
|
guild_id: this.guildId,
|
||||||
level,
|
level,
|
||||||
})
|
})
|
||||||
.onConflict('("guild_id") DO UPDATE SET "guild_id" = :guildId')
|
.orUpdate({
|
||||||
.setParameter("guildId", this.guildId)
|
conflict_target: ["guild_id"],
|
||||||
|
overwrite: ["level"],
|
||||||
|
})
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue