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({
|
await prisma.distribusiUmur.upsert({
|
||||||
where: { id: item.id },
|
where: { id: item.id },
|
||||||
update: {
|
update: {
|
||||||
kelompok: item.kelompok,
|
rentangUmur: item.rentangUmur,
|
||||||
jumlah: item.jumlah,
|
jumlah: item.jumlah,
|
||||||
tahun: item.tahun,
|
tahun: item.tahun,
|
||||||
},
|
},
|
||||||
create: {
|
create: {
|
||||||
id: item.id,
|
id: item.id,
|
||||||
kelompok: item.kelompok,
|
rentangUmur: item.rentangUmur,
|
||||||
jumlah: item.jumlah,
|
jumlah: item.jumlah,
|
||||||
tahun: item.tahun,
|
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");
|
console.log("Distribusi Umur seed selesai");
|
||||||
|
|||||||
@@ -1,31 +1,31 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"id": "cmk-umur-001",
|
"id": "cmk-umur-001",
|
||||||
"kelompok": "0-14",
|
"rentangUmur": "0-14",
|
||||||
"jumlah": 820,
|
"jumlah": 820,
|
||||||
"tahun": 2026
|
"tahun": 2026
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "cmk-umur-002",
|
"id": "cmk-umur-002",
|
||||||
"kelompok": "15-24",
|
"rentangUmur": "15-24",
|
||||||
"jumlah": 650,
|
"jumlah": 650,
|
||||||
"tahun": 2026
|
"tahun": 2026
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "cmk-umur-003",
|
"id": "cmk-umur-003",
|
||||||
"kelompok": "25-54",
|
"rentangUmur": "25-54",
|
||||||
"jumlah": 1680,
|
"jumlah": 1680,
|
||||||
"tahun": 2026
|
"tahun": 2026
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "cmk-umur-004",
|
"id": "cmk-umur-004",
|
||||||
"kelompok": "55-64",
|
"rentangUmur": "55-64",
|
||||||
"jumlah": 520,
|
"jumlah": 520,
|
||||||
"tahun": 2026
|
"tahun": 2026
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "cmk-umur-005",
|
"id": "cmk-umur-005",
|
||||||
"kelompok": "65+",
|
"rentangUmur": "65+",
|
||||||
"jumlah": 545,
|
"jumlah": 545,
|
||||||
"tahun": 2026
|
"tahun": 2026
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2335,14 +2335,14 @@ model DistribusiAgama {
|
|||||||
|
|
||||||
// ========================================= DISTRIBUSI UMUR ========================================= //
|
// ========================================= DISTRIBUSI UMUR ========================================= //
|
||||||
model DistribusiUmur {
|
model DistribusiUmur {
|
||||||
id String @id @default(cuid())
|
id String @id @default(cuid())
|
||||||
kelompok String // Kelompok umur (e.g., "0-14", "15-24", "25-54", "55-64", "65+")
|
rentangUmur String // Rentang umur (e.g., "0-14", "15-24", "25-54", "55-64", "65+")
|
||||||
jumlah Int // Jumlah penduduk
|
jumlah Int // Jumlah penduduk
|
||||||
tahun Int // Tahun data
|
tahun Int // Tahun data
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
deletedAt DateTime?
|
deletedAt DateTime?
|
||||||
isActive Boolean @default(true)
|
isActive Boolean @default(true)
|
||||||
|
|
||||||
@@index([tahun])
|
@@index([tahun])
|
||||||
@@index([isActive])
|
@@index([isActive])
|
||||||
|
|||||||
Reference in New Issue
Block a user