Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(schemas): resolve duplicates of init account center alter #6824

Merged
merged 1 commit into from
Nov 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Loading