mirror of
https://github.com/logto-io/logto.git
synced 2024-12-30 20:33:54 -05:00
fix(schemas): fix alter script of init account center (#6826)
This commit is contained in:
parent
68e0b6f0fe
commit
44826493f3
1 changed files with 1 additions and 8 deletions
|
@ -4,13 +4,6 @@ import type { AlterationScript } from '../lib/types/alteration.js';
|
||||||
|
|
||||||
const alteration: AlterationScript = {
|
const alteration: AlterationScript = {
|
||||||
up: async (pool) => {
|
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
|
// Process in chunks of 1000 tenants
|
||||||
const batchSize = 1000;
|
const batchSize = 1000;
|
||||||
// eslint-disable-next-line @silverhand/fp/no-let
|
// eslint-disable-next-line @silverhand/fp/no-let
|
||||||
|
@ -21,7 +14,7 @@ const alteration: AlterationScript = {
|
||||||
// eslint-disable-next-line no-await-in-loop
|
// eslint-disable-next-line no-await-in-loop
|
||||||
const tenants = await pool.any<{ id: string }>(sql`
|
const tenants = await pool.any<{ id: string }>(sql`
|
||||||
select id from tenants
|
select id from tenants
|
||||||
order by created_at asc
|
order by created_at asc, id asc
|
||||||
limit ${batchSize} offset ${offset};
|
limit ${batchSize} offset ${offset};
|
||||||
`);
|
`);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue