Files
twenty/packages/twenty-server/src/database/clickHouse/seeds/run-seeds.ts
Félix Malfait 7b78b64bca Update clickhouse tables (#11905)
Following a discussion with @Bonapara - changing the base tables
2025-05-07 09:39:18 +02:00

39 lines
825 B
TypeScript

/* eslint-disable no-console */
import { createClient } from '@clickhouse/client';
import { config } from 'dotenv';
import { fixtures } from './fixtures';
config({
path: process.env.NODE_ENV === 'test' ? '.env.test' : '.env',
override: true,
});
const client = createClient({
url: process.env.CLICKHOUSE_URL,
});
async function seedEvents() {
try {
console.log(`⚡ Seeding ${fixtures.length} events...`);
await client.insert({
table: 'workspaceEvent',
values: fixtures,
format: 'JSONEachRow',
});
console.log('✅ All events seeded successfully');
} catch (error) {
console.error('Error seeding events:', error);
throw error;
} finally {
await client.close();
}
}
seedEvents().catch((err) => {
console.error('Seeding error:', err);
process.exit(1);
});