stones/import-data.js

58 lines
1.4 KiB
JavaScript

const { PrismaClient } = require('@prisma/client');
const prisma = new PrismaClient();
// This script imports data directly via Prisma instead of using psql
async function main() {
console.log('Importing data sources...');
try {
// Create DataSource records first
await prisma.dataSource.createMany({
data: [
{
name: 'Public Nouns',
type: 'NFT',
description: 'Public Nouns NFT holders',
createdAt: new Date(),
updatedAt: new Date()
},
{
name: 'Raid Guild',
type: 'DAO',
description: 'Raid Guild DAO members',
createdAt: new Date(),
updatedAt: new Date()
},
{
name: 'Moloch DAO',
type: 'DAO',
description: 'Moloch DAO members',
createdAt: new Date(),
updatedAt: new Date()
},
{
name: 'MetaCartel',
type: 'DAO',
description: 'MetaCartel DAO members',
createdAt: new Date(),
updatedAt: new Date()
}
],
skipDuplicates: true
});
console.log('Data sources imported successfully');
// You can add more import steps here if needed
} catch (error) {
console.error('Error importing data:', error);
} finally {
await prisma.$disconnect();
}
}
main().catch(error => {
console.error(error);
process.exit(1);
});