27 lines
930 B
JavaScript
27 lines
930 B
JavaScript
// Verify migration result on production
|
|
const { PrismaClient } = require('@prisma/client')
|
|
const p = new PrismaClient()
|
|
;(async () => {
|
|
const tables = await p.$queryRawUnsafe(`
|
|
SELECT TABLE_NAME
|
|
FROM information_schema.TABLES
|
|
WHERE TABLE_SCHEMA = DATABASE()
|
|
AND TABLE_NAME LIKE '%flash%'
|
|
`)
|
|
const ordersCol = await p.$queryRawUnsafe(`
|
|
SELECT COLUMN_NAME
|
|
FROM information_schema.COLUMNS
|
|
WHERE TABLE_SCHEMA = DATABASE()
|
|
AND TABLE_NAME = 'orders'
|
|
AND COLUMN_NAME = 'flash_sale_id'
|
|
`)
|
|
const mig = await p.$queryRawUnsafe(`
|
|
SELECT migration_name, finished_at, rolled_back_at
|
|
FROM _prisma_migrations
|
|
WHERE migration_name = '20260910030338_drop_flash_sale'
|
|
`)
|
|
console.log('flash tables:', tables)
|
|
console.log('orders.flash_sale_id col:', ordersCol)
|
|
console.log('migration row:', mig)
|
|
await p.$disconnect()
|
|
})().catch((e) => { console.error(e); process.exit(1) }) |