fix: rename DistribusiUmur.kelompok to rentangUmur to match UI/API
- Update Prisma schema: kelompok -> rentangUmur - Update seed data JSON: kelompok -> rentangUmur - Update seeder file: use rentangUmur field - This fixes the empty data issue in distribusi-umur admin page Note: Run 'bunx prisma db push' to apply schema migration Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
@@ -10,18 +10,18 @@ export async function seedDistribusiUmur() {
|
||||
await prisma.distribusiUmur.upsert({
|
||||
where: { id: item.id },
|
||||
update: {
|
||||
kelompok: item.kelompok,
|
||||
rentangUmur: item.rentangUmur,
|
||||
jumlah: item.jumlah,
|
||||
tahun: item.tahun,
|
||||
},
|
||||
create: {
|
||||
id: item.id,
|
||||
kelompok: item.kelompok,
|
||||
rentangUmur: item.rentangUmur,
|
||||
jumlah: item.jumlah,
|
||||
tahun: item.tahun,
|
||||
},
|
||||
});
|
||||
console.log(` Kelompok ${item.kelompok}: ${item.jumlah} jiwa`);
|
||||
console.log(` Rentang ${item.rentangUmur}: ${item.jumlah} jiwa`);
|
||||
}
|
||||
|
||||
console.log("Distribusi Umur seed selesai");
|
||||
|
||||
@@ -1,31 +1,31 @@
|
||||
[
|
||||
{
|
||||
"id": "cmk-umur-001",
|
||||
"kelompok": "0-14",
|
||||
"rentangUmur": "0-14",
|
||||
"jumlah": 820,
|
||||
"tahun": 2026
|
||||
},
|
||||
{
|
||||
"id": "cmk-umur-002",
|
||||
"kelompok": "15-24",
|
||||
"rentangUmur": "15-24",
|
||||
"jumlah": 650,
|
||||
"tahun": 2026
|
||||
},
|
||||
{
|
||||
"id": "cmk-umur-003",
|
||||
"kelompok": "25-54",
|
||||
"rentangUmur": "25-54",
|
||||
"jumlah": 1680,
|
||||
"tahun": 2026
|
||||
},
|
||||
{
|
||||
"id": "cmk-umur-004",
|
||||
"kelompok": "55-64",
|
||||
"rentangUmur": "55-64",
|
||||
"jumlah": 520,
|
||||
"tahun": 2026
|
||||
},
|
||||
{
|
||||
"id": "cmk-umur-005",
|
||||
"kelompok": "65+",
|
||||
"rentangUmur": "65+",
|
||||
"jumlah": 545,
|
||||
"tahun": 2026
|
||||
}
|
||||
|
||||
@@ -2335,14 +2335,14 @@ model DistribusiAgama {
|
||||
|
||||
// ========================================= DISTRIBUSI UMUR ========================================= //
|
||||
model DistribusiUmur {
|
||||
id String @id @default(cuid())
|
||||
kelompok String // Kelompok umur (e.g., "0-14", "15-24", "25-54", "55-64", "65+")
|
||||
jumlah Int // Jumlah penduduk
|
||||
tahun Int // Tahun data
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
deletedAt DateTime?
|
||||
isActive Boolean @default(true)
|
||||
id String @id @default(cuid())
|
||||
rentangUmur String // Rentang umur (e.g., "0-14", "15-24", "25-54", "55-64", "65+")
|
||||
jumlah Int // Jumlah penduduk
|
||||
tahun Int // Tahun data
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
deletedAt DateTime?
|
||||
isActive Boolean @default(true)
|
||||
|
||||
@@index([tahun])
|
||||
@@index([isActive])
|
||||
|
||||
Reference in New Issue
Block a user