1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- const prisma = require('../../../src/prisma/PrismaClient.js');
- const timeLocal = require('../../../src/utils/TimeLocal.js')
- const cityNames = [
- 'Kabupaten Barito Selatan',
- 'Kabupaten Barito Timur',
- 'Kabupaten Barito Utara',
- 'Kabupaten Gunung Mas',
- 'Kabupaten Kapuas',
- 'Kabupaten Katingan',
- 'Kabupaten Kotawaringin Barat',
- 'Kabupaten Kotawaringin Timur',
- 'Kabupaten Lamandau',
- 'Kabupaten Murung Raya',
- 'Kabupaten Pulang Pisau',
- 'Kabupaten Sukamara',
- 'Kabupaten Seruyan',
- 'Kota Palangka Raya'
- // 14
- ];
- exports.seedKalimantanTengahCities = async () => {
- const province = await prisma.province.findFirst({
- where: { name: 'Kalimantan Tengah' },
- });
- if (!province) {
- console.error('❌ Province Kalimantan Tengah 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('✅ Kalimantan Tengah City seeded!.');
- };
|