Add skip logic to migration scripts to prevent re-running
This commit is contained in:
@@ -122,6 +122,18 @@ async function getReleaseYear(artist, title) {
|
||||
// --- Migration Logic ---
|
||||
|
||||
async function migrate() {
|
||||
// Check if migration already ran
|
||||
const flagPath = path.join(process.cwd(), '.release-years-migrated');
|
||||
try {
|
||||
const { access } = await import('fs/promises');
|
||||
await access(flagPath);
|
||||
console.log('✅ Release year migration already completed (flag file exists). Skipping...');
|
||||
await prisma.$disconnect();
|
||||
return;
|
||||
} catch {
|
||||
// Flag file doesn't exist, proceed with migration
|
||||
}
|
||||
|
||||
console.log('🎵 Starting release year migration...');
|
||||
console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user