mirror of
https://github.com/logto-io/logto.git
synced 2024-12-16 20:26:19 -05:00
fix(schemas): resolve duplicates of init account center alter (#6824)
This commit is contained in:
parent
80ae0bb6c7
commit
68e0b6f0fe
1 changed files with 8 additions and 1 deletions
|
@ -4,6 +4,13 @@ import type { AlterationScript } from '../lib/types/alteration.js';
|
|||
|
||||
const alteration: AlterationScript = {
|
||||
up: async (pool) => {
|
||||
// Delete the default account center if it exists
|
||||
const { rowCount } = await pool.query(sql`
|
||||
delete from account_centers where id = 'default';
|
||||
`);
|
||||
|
||||
console.log(`Deleted ${rowCount} default account center`);
|
||||
|
||||
// Process in chunks of 1000 tenants
|
||||
const batchSize = 1000;
|
||||
// eslint-disable-next-line @silverhand/fp/no-let
|
||||
|
@ -26,7 +33,7 @@ const alteration: AlterationScript = {
|
|||
// eslint-disable-next-line no-await-in-loop
|
||||
await pool.query(sql`
|
||||
insert into account_centers (tenant_id, id)
|
||||
values ${sql.join(values, sql`, `)};
|
||||
values ${sql.join(values, sql`, `)}
|
||||
`);
|
||||
|
||||
// eslint-disable-next-line @silverhand/fp/no-mutation
|
||||
|
|
Loading…
Reference in a new issue