Executing database migrations on Vercel

now planetscale is removing their free tier, i'm looking to move, which probably means i gotta use migrations now i'm using next so my build command is just next build my assumption is that i would just change this to next build && tsx ./migrate.ts is this the go-to for running migrations on serverless? is it possible to run migrations inside a transaction so if anything fails, the schema doesn't remain in a broken state?
K
Kairu45d ago
alright this seems to work really nicely with vercel preview branching using neon and drizzle seems to try overwriting the meta info upon migration?
{
severity_local: 'NOTICE',
severity: 'NOTICE',
code: '42P06',
message: 'schema "drizzle" already exists, skipping',
file: 'schemacmds.c',
line: '132',
routine: 'CreateSchemaCommand'
}
{
severity_local: 'NOTICE',
severity: 'NOTICE',
code: '42P07',
message: 'relation "__drizzle_migrations" already exists, skipping',
file: 'parse_utilcmd.c',
line: '207',
routine: 'transformCreateStmt'
}
{
severity_local: 'NOTICE',
severity: 'NOTICE',
code: '42P06',
message: 'schema "drizzle" already exists, skipping',
file: 'schemacmds.c',
line: '132',
routine: 'CreateSchemaCommand'
}
{
severity_local: 'NOTICE',
severity: 'NOTICE',
code: '42P07',
message: 'relation "__drizzle_migrations" already exists, skipping',
file: 'parse_utilcmd.c',
line: '207',
routine: 'transformCreateStmt'
}