deckhearth/scripts/add-updated-at-column.js
Randall Stillwell f27a7333db Created comprehensive admin card editor
- Built complete admin interface for editing all card properties
- Added card search functionality with live results
- Created comprehensive form with sections for:
  * Basic information (name, game, set, rarity, etc.)
  * Game mechanics (type, mana cost, power/toughness, colors)
  * Card text and oracle text
  * Image URLs (primary and stock images)
  * Pricing information (current and market prices)
- Added real-time card preview that updates as you edit
- Implemented PUT API endpoint for updating cards
- Added proper validation and error handling
- Added database schema updates (updated_at column)
- Integrated admin navigation between card editor and import tools
- Full responsive design with modern UI components
- Live search with card thumbnails and metadata
- Proper form state management and data persistence
2025-07-24 15:16:57 -05:00

36 lines
No EOL
885 B
JavaScript

#!/usr/bin/env node
/**
* Add updated_at column to cards table
*
* This script adds the updated_at column to the cards table if it doesn't exist.
*/
import dotenv from 'dotenv';
import { neon } from '@neondatabase/serverless';
// Load environment variables from .env.local
dotenv.config({ path: '.env.local' });
async function addUpdatedAtColumn() {
const sql = neon(process.env.POSTGRES_URL);
try {
console.log('✅ Connecting to Neon database...');
// Add updated_at column
await sql`
ALTER TABLE cards
ADD COLUMN IF NOT EXISTS updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
`;
console.log('✅ Added updated_at column to cards table');
console.log('🎉 Updated_at column added successfully!');
} catch (error) {
console.error('❌ Failed to add column:', error.message);
process.exit(1);
}
}
addUpdatedAtColumn();