123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- import prisma from '../../../src/prisma/PrismaClient';
- import { now } from '../../../src/utils/TimeLocal';
- const cityNames: string[] = [
- 'Kabupaten Alor',
- 'Kabupaten Belu',
- 'Kabupaten Ende',
- 'Kabupaten Flores Timur',
- 'Kabupaten Kupang',
- 'Kabupaten Lembata',
- 'Kabupaten Malaka',
- 'Kabupaten Manggarai',
- 'Kabupaten Manggarai Barat',
- 'Kabupaten Manggarai Timur',
- 'Kabupaten Nagekeo',
- 'Kabupaten Ngada',
- 'Kabupaten Rote Ndao',
- 'Kabupaten Sabu Raijua',
- 'Kabupaten Sikka',
- 'Kabupaten Sumba Barat',
- 'Kabupaten Sumba Barat Daya',
- 'Kabupaten Sumba Tengah',
- 'Kabupaten Sumba Timur',
- 'Kabupaten Timor Tengah Selatan',
- 'Kabupaten Timor Tengah Utara',
- 'Kota Kupang'
- ];
- export async function seedNusaTenggaraTimurCities(): Promise<void> {
- const province = await prisma.province.findFirst({
- where: { name: 'Nusa Tenggara Timur' },
- });
- if (!province) {
- console.error('❌ Province Nusa Tenggara Timur 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('✅ Nusa Tenggara Timur City seeded!');
- }
- // const prisma = require('../../../src/prisma/PrismaClient.js');
- // const timeLocal = require('../../../src/utils/TimeLocal.js')
- // const cityNames = [
- // 'Kabupaten Alor',
- // 'Kabupaten Belu',
- // 'Kabupaten Ende',
- // 'Kabupaten Flores Timur',
- // 'Kabupaten Kupang',
- // 'Kabupaten Lembata',
- // 'Kabupaten Malaka',
- // 'Kabupaten Manggarai',
- // 'Kabupaten Manggarai Barat',
- // 'Kabupaten Manggarai Timur',
- // 'Kabupaten Nagekeo',
- // 'Kabupaten Ngada',
- // 'Kabupaten Rote Ndao',
- // 'Kabupaten Sabu Raijua',
- // 'Kabupaten Sikka',
- // 'Kabupaten Sumba Barat',
- // 'Kabupaten Sumba Barat Daya',
- // 'Kabupaten Sumba Tengah',
- // 'Kabupaten Sumba Timur',
- // 'Kabupaten Timor Tengah Selatan',
- // 'Kabupaten Timor Tengah Utara',
- // 'Kota Kupang'
- // // 22
- // ];
- // exports.seedNusaTenggaraTimurCities = async () => {
- // const province = await prisma.province.findFirst({
- // where: { name: 'Nusa Tenggara Timur' },
- // });
- // if (!province) {
- // console.error('❌ Province Nusa Tenggara Timur 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('✅ Nusa Tenggara Timur City seeded!.');
- // };
|