21 lines
No EOL
690 B
Markdown
21 lines
No EOL
690 B
Markdown
# 1. Exec into the app container
|
|
docker exec -it $(docker ps | grep portfolio-web | awk '{print $1}') sh
|
|
|
|
# 2. Write and run the migration
|
|
cat > /tmp/migrate.ts << 'EOF'
|
|
import { drizzle } from 'drizzle-orm/node-postgres'
|
|
import pg from 'pg'
|
|
|
|
async function main() {
|
|
const pool = new pg.Pool({ connectionString: process.env.DATABASE_URL })
|
|
const { up } = await import('/app/src/migrations/20260521_173007.ts')
|
|
console.log('running migration...')
|
|
await up({ db: drizzle(pool) })
|
|
console.log('done')
|
|
await pool.end()
|
|
}
|
|
|
|
main().catch(console.error)
|
|
EOF
|
|
|
|
DATABASE_URL=postgresql://postgres:TrojanHero1@portfolio-portfoliodb-22lpk0:5432/postgres node_modules/.bin/tsx /tmp/migrate.ts |