mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-03-21 17:25:10 -05:00
Database: Remove LIMIT clauses from primary key mutating methods
PG doesn't support LIMIT in these, and they don't need it anyway since primary keys should be unique.
This commit is contained in:
parent
d32ad3dc98
commit
a341d3c566
|
|
@ -321,11 +321,11 @@ export class DatabaseTable<Row, DB extends Database> {
|
|||
}
|
||||
delete(primaryKey: BasicSQLValue) {
|
||||
if (!this.primaryKeyName) throw new Error(`Cannot delete() without a single-column primary key`);
|
||||
return this.deleteAll()`WHERE "${this.primaryKeyName}" = ${primaryKey} LIMIT 1`;
|
||||
return this.deleteAll()`WHERE "${this.primaryKeyName}" = ${primaryKey}`;
|
||||
}
|
||||
update(primaryKey: BasicSQLValue, data: PartialOrSQL<Row>) {
|
||||
if (!this.primaryKeyName) throw new Error(`Cannot update() without a single-column primary key`);
|
||||
return this.updateAll(data)`WHERE "${this.primaryKeyName}" = ${primaryKey} LIMIT 1`;
|
||||
return this.updateAll(data)`WHERE "${this.primaryKeyName}" = ${primaryKey}`;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -335,7 +335,6 @@ export class MySQLDatabase extends Database<mysql.Pool, mysql.OkPacket> {
|
|||
const prefix = config.prefix || "";
|
||||
if (config.prefix) {
|
||||
config = { ...config };
|
||||
delete config.prefix;
|
||||
}
|
||||
super(mysql.createPool(config), prefix);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user