t3-code-android-nightly/.repos/alchemy-effect/examples/cloudflare-neon-prisma/migrations/app/20260830T0525_init/migration.ts
Julius Marminge 6f9cea00ae
chore(refs): sync Effect and Alchemy references to 4.0.1 and beta.80 (#16170)
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-05 13:22:30 -07:00

47 lines
1.8 KiB
JavaScript
Executable file

#!/usr/bin/env -S node
import type { Contract as End } from '../../snapshots/7de60ab4aee8baa42480f8a2d3559ff4027deae801de73c6a93c9eeb4170f558/contract';
import endContract from '../../snapshots/7de60ab4aee8baa42480f8a2d3559ff4027deae801de73c6a93c9eeb4170f558/contract.json' with { type: 'json' };
import { Migration, MigrationCLI, col, fn, primaryKey } from '@internal/postgres/migration';
export default class M extends Migration<never, End> {
override readonly endContractJson = endContract;
override get operations() {
return [
this.createSchema({ schema: 'public' }),
this.createTable({
schema: 'public',
table: 'Post',
columns: [
col('authorId', 'uuid', { notNull: true, codecRef: { codecId: 'pg/uuid@1' } }),
col('id', 'uuid', { notNull: true, codecRef: { codecId: 'pg/uuid@1' } }),
col('title', 'text', { notNull: true, codecRef: { codecId: 'pg/text@1' } }),
],
constraints: [primaryKey(['id'])],
}),
this.createTable({
schema: 'public',
table: 'User',
columns: [
col('createdAt', 'timestamptz', {
notNull: true,
default: fn('now()'),
codecRef: { codecId: 'pg/timestamptz-string@1' },
}),
col('email', 'text', { notNull: true, codecRef: { codecId: 'pg/text@1' } }),
col('id', 'uuid', { notNull: true, codecRef: { codecId: 'pg/uuid@1' } }),
col('name', 'text', { notNull: true, codecRef: { codecId: 'pg/text@1' } }),
],
constraints: [primaryKey(['id'])],
}),
this.addUnique({
schema: 'public',
table: 'User',
constraint: 'User_email_key',
columns: ['email'],
}),
];
}
}
MigrationCLI.run(import.meta.url, M);