Skip to content

Commit 93070dd

Browse files
committed
fix: synchronize schema in seed-chapters to create tables if missing
1 parent b0bd654 commit 93070dd

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

backend/src/scripts/seed-chapters.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,18 @@ import { ChapterEntity } from '../infrastructure/db/chapter.entities';
99
async function main() {
1010
console.log('[Seed] Connecting to database...');
1111

12-
const dataSource = new DataSource(makeTypeOrmOptions() as any);
12+
const opts = makeTypeOrmOptions();
13+
14+
// Create DataSource with synchronize to create tables if they don't exist
15+
const dataSource = new DataSource({
16+
...opts,
17+
synchronize: true,
18+
logging: false,
19+
} as any);
20+
1321
await dataSource.initialize();
1422

15-
console.log('[Seed] Connection established.');
23+
console.log('[Seed] Connection established and schema synchronized.');
1624

1725
const chapterRepo = dataSource.getRepository(ChapterEntity);
1826

0 commit comments

Comments
 (0)