12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- const prisma = require('../../../src/prisma/PrismaClient.js');
- const timeLocal = require('../../../src/utils/TimeLocal.js')
- const cityNames = [
- 'Kabupaten Balangan',
- 'Kabupaten Banjar',
- 'Kabupaten Barito Kuala',
- 'Kabupaten Hulu Sungai Selatan',
- 'Kabupaten Hulu Sungai Tengah',
- 'Kabupaten Hulu Sungai Utara',
- 'Kabupaten Kotabaru',
- 'Kabupaten Tabalong',
- 'Kabupaten Tanah Bumbu',
- 'Kabupaten Tanah Laut',
- 'Kabupaten Tapin',
- 'Kota Banjarbaru',
- 'Kota Banjarmasin'
- // 13
- ];
- exports.seedKalimantanSelatanCities = async () => {
- const province = await prisma.province.findFirst({
- where: { name: 'Kalimantan Selatan' },
- });
- if (!province) {
- console.error('❌ Province Kalimantan Selatan 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 Selatan City seeded!.');
- };
|