27 lines
579 B
TypeScript
27 lines
579 B
TypeScript
import 'dotenv/config'
|
|
|
|
import { db } from './index'
|
|
import { restaurantTables } from './schema'
|
|
|
|
async function seed() {
|
|
const tables = await db
|
|
.insert(restaurantTables)
|
|
.values([
|
|
{ name: 'Tisch 1', seats: 2 },
|
|
{ name: 'Tisch 2', seats: 2 },
|
|
{ name: 'Tisch 3', seats: 4 },
|
|
{ name: 'Tisch 4', seats: 4 },
|
|
{ name: 'Tisch 5', seats: 6 },
|
|
{ name: 'Tisch 6', seats: 8 },
|
|
])
|
|
.returning()
|
|
|
|
console.log(`Seeded ${tables.length} tables.`)
|
|
process.exit(0)
|
|
}
|
|
|
|
seed().catch((error) => {
|
|
console.error(error)
|
|
process.exit(1)
|
|
})
|