import prisma from '../../../src/prisma/PrismaClient'; import { now } from '../../../src/utils/TimeLocal'; const cityNames: string[] = [ 'Kabupaten Bangka', 'Kabupaten Bangka Barat', 'Kabupaten Bangka Selatan', 'Kabupaten Bangka Tengah', 'Kabupaten Belitung', 'Kabupaten Belitung Timur', 'Kota Pangkal Pinang' ]; export async function seedKepulauanBangkaBelitungCities(): Promise { const province = await prisma.province.findFirst({ where: { name: 'Kepulauan Bangka Belitung' }, }); if (!province) { console.error('❌ Province Kepulauan Bangka Belitung not found. Seed it first.'); return; } for (const name of cityNames) { await prisma.city.upsert({ where: { name_province_id: { name, province_id: province.id, }, }, update: { updatedAt: now().toDate(), }, create: { name, province_id: province.id, createdAt: now().toDate(), }, }); } console.log('✅ Kepulauan Bangka Belitung City seeded!'); } // const prisma = require('../../../src/prisma/PrismaClient.js'); // const timeLocal = require('../../../src/utils/TimeLocal.js') // const cityNames = [ // 'Kabupaten Bangka', // 'Kabupaten Bangka Barat', // 'Kabupaten Bangka Selatan', // 'Kabupaten Bangka Tengah', // 'Kabupaten Belitung', // 'Kabupaten Belitung Timur', // 'Kota Pangkal Pinang' // // 7 // ]; // exports.seedKepulauanBangkaBelitungCities = async () => { // const province = await prisma.province.findFirst({ // where: { name: 'Kepulauan Bangka Belitung' }, // }); // if (!province) { // console.error('❌ Province Kepulauan Bangka Belitung not found. Seed it first.'); // return; // } // for (const name of cityNames) { // await prisma.city.upsert({ // where: { // name_province_id: { // name, // province_id: province.id, // }, // }, // update: { // updatedAt: timeLocal.now().toDate() // }, // create: { // name, // province_id: province.id, // createdAt: timeLocal.now().toDate() // }, // }); // } // console.log('✅ Kepulauan Bangka Belitung City seeded!.'); // };