30 lines
732 B
JavaScript
30 lines
732 B
JavaScript
|
|
#!/usr/bin/env node
|
||
|
|
|
||
|
|
import { config } from 'dotenv';
|
||
|
|
import { sql } from '@vercel/postgres';
|
||
|
|
|
||
|
|
// Load environment variables
|
||
|
|
config({ path: '.env.local' });
|
||
|
|
|
||
|
|
async function addImageColumn() {
|
||
|
|
try {
|
||
|
|
console.log('🖼️ Adding image column to collections table...\n');
|
||
|
|
|
||
|
|
// Add image column to collections table
|
||
|
|
await sql`
|
||
|
|
ALTER TABLE collections
|
||
|
|
ADD COLUMN IF NOT EXISTS image TEXT
|
||
|
|
`;
|
||
|
|
console.log('✅ Added image column to collections table');
|
||
|
|
|
||
|
|
console.log('\n🎉 Image column added successfully!');
|
||
|
|
console.log('\n📋 Collections can now have hero images!');
|
||
|
|
|
||
|
|
} catch (error) {
|
||
|
|
console.error('❌ Migration failed:', error.message);
|
||
|
|
process.exit(1);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
addImageColumn();
|