import { MigrationDiagram } from 'ts-prorm-orm';
const svg = new MigrationDiagram({
title: 'Add author to posts',
description: 'Link every post to the user who wrote it',
timestamp: '2026-01-12',
changes: [
{ table: 'posts', type: 'modify', changes: [
{ name: 'authorId', type: 'INTEGER', action: 'add',
constraints: ['NOT NULL', 'REFERENCES users(id)'] },
{ name: 'title', type: 'VARCHAR(200)', oldType: 'VARCHAR(120)', action: 'modify' },
{ name: 'legacy_author', type: 'VARCHAR(100)', action: 'remove' },
] },
{ table: 'post_tags', type: 'add', changes: [
{ name: 'postId', type: 'INTEGER', action: 'add', constraints: ['PK'] },
{ name: 'tagId', type: 'INTEGER', action: 'add', constraints: ['PK'] },
] },
],
}).generate();