Skip to content

Commit

Permalink
fix(schemas): fix alter script of init account center
Browse files Browse the repository at this point in the history
  • Loading branch information
wangsijie committed Nov 21, 2024
1 parent 68e0b6f commit eddcdb1
Showing 1 changed file with 1 addition and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@ 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
Expand All @@ -21,7 +14,7 @@ const alteration: AlterationScript = {
// eslint-disable-next-line no-await-in-loop
const tenants = await pool.any<{ id: string }>(sql`
select id from tenants
order by created_at asc
order by created_at asc, id asc
limit ${batchSize} offset ${offset};
`);

Expand Down

0 comments on commit eddcdb1

Please sign in to comment.