Ship Pokemon and Lorcana bulk import libs/scripts, unified weekly cron sync across MTG/Pokemon/Lorcana with per-game error isolation and catalog_sync_log telemetry. Admin UI adds Unified/Incremental/Bulk MTG modes. - Rename reconcile migrations to 1781442330* timestamps so they apply after bulk-data migrations without node-pg-migrate ordering conflicts - Add Lorcana set-code normalization + orphan cleanup migrations - Drop stricter user_cards_user_card_unique (keep 3-column foil unique) - Update docs/SCHEMA_MAP.md for tags, card_tags, catalog_sync_log, bulk columns Co-authored-by: Cursor <cursoragent@cursor.com>
37 lines
1.1 KiB
JavaScript
37 lines
1.1 KiB
JavaScript
/**
|
|
* Bulk import Disney Lorcana cards from lorcana-api.com /bulk/cards.
|
|
*
|
|
* Usage:
|
|
* node --env-file=.env.local scripts/bulk-import-lorcana.js
|
|
*
|
|
* Options (env vars):
|
|
* DRY_RUN — "true" to fetch and count without writing to DB
|
|
*/
|
|
|
|
import { neon } from '@neondatabase/serverless';
|
|
|
|
import { runBulkLorcanaSync } from '../lib/card-import/lorcana-bulk.js';
|
|
|
|
if (!process.env.POSTGRES_URL) {
|
|
console.error('POSTGRES_URL is required');
|
|
process.exit(1);
|
|
}
|
|
|
|
const DRY_RUN = process.env.DRY_RUN === 'true';
|
|
const sql = neon(process.env.POSTGRES_URL, { fullResults: false });
|
|
|
|
async function run() {
|
|
console.log(`[bulk-import-lorcana] Starting (dryRun=${DRY_RUN})`);
|
|
|
|
const summary = await runBulkLorcanaSync({ sql, dryRun: DRY_RUN });
|
|
|
|
console.log('[bulk-import-lorcana] Complete!');
|
|
console.log(`[bulk-import-lorcana] Total in file: ${summary.totalInFile}`);
|
|
console.log(`[bulk-import-lorcana] Upserted: ${summary.upserted}`);
|
|
console.log(`[bulk-import-lorcana] Errors: ${summary.errors}`);
|
|
}
|
|
|
|
run().catch((err) => {
|
|
console.error('[bulk-import-lorcana] Fatal error:', err);
|
|
process.exit(1);
|
|
});
|