const { sequelize, connectDB } = require('./config/database');
const Block = require('./models/Block');
const eventBlocks = [
{
name: 'Stuhl (Standard)',
category: 'Bestuhlung',
is_public: true,
svg_data: ``
},
{
name: 'Tisch (Rechteck 180x80)',
category: 'Möbel',
is_public: true,
svg_data: ``
},
{
name: 'Tisch (Rund Ø120)',
category: 'Möbel',
is_public: true,
svg_data: ``
},
{
name: 'Bühne (Modular 200x100)',
category: 'Bühne',
is_public: true,
svg_data: ``
},
{
name: 'Stehtisch',
category: 'Möbel',
is_public: true,
svg_data: ``
},
{
name: 'Barhocker',
category: 'Bestuhlung',
is_public: true,
svg_data: ``
},
{
name: 'Mischpult',
category: 'Technik',
is_public: true,
svg_data: ``
},
{
name: 'Lautsprecher',
category: 'Technik',
is_public: true,
svg_data: ``
},
{
name: 'Trennwand',
category: 'Raum',
is_public: true,
svg_data: ``
},
{
name: 'Notausgang-Schild',
category: 'Sicherheit',
is_public: true,
svg_data: ``
},
];
async function seed() {
try {
await connectDB();
// Clear existing blocks
await Block.destroy({ where: {} });
console.log('Existing blocks cleared.');
// Insert new blocks
for (const block of eventBlocks) {
await Block.create(block);
}
console.log(`${eventBlocks.length} blocks created successfully.`);
process.exit(0);
} catch (err) {
console.error('Seed failed:', err);
process.exit(1);
}
}
seed();