Add multiple states, cities, and banks to seed data in prisma/seed.ts
This commit is contained in:
@@ -33,11 +33,46 @@ async function main() {
|
||||
update: {},
|
||||
create: { countryXid: india.id, stateName: 'Maharashtra' },
|
||||
});
|
||||
const uttarpradesh = await prisma.states.upsert({
|
||||
where: { stateName: 'Uttar-Pradesh' },
|
||||
update: {},
|
||||
create: { countryXid: india.id, stateName: 'Uttar-Pradesh' },
|
||||
});
|
||||
const Rajasthan = await prisma.states.upsert({
|
||||
where: { stateName: 'Rajasthan' },
|
||||
update: {},
|
||||
create: { countryXid: india.id, stateName: 'Rajasthan' },
|
||||
});
|
||||
const Uttarakhand = await prisma.states.upsert({
|
||||
where: { stateName: 'Uttarakhand' },
|
||||
update: {},
|
||||
create: { countryXid: india.id, stateName: 'Uttarakhand' },
|
||||
});
|
||||
const HimachalPradesh = await prisma.states.upsert({
|
||||
where: { stateName: 'Himachal Pradesh' },
|
||||
update: {},
|
||||
create: { countryXid: india.id, stateName: 'Himachal Pradesh' },
|
||||
});
|
||||
const Gujrat = await prisma.states.upsert({
|
||||
where: { stateName: 'Gujrat' },
|
||||
update: {},
|
||||
create: { countryXid: india.id, stateName: 'Gujrat' },
|
||||
});
|
||||
|
||||
// ✅ Cities
|
||||
await prisma.cities.createMany({
|
||||
data: [
|
||||
{ stateXid: maharashtra.id, cityName: 'Mumbai' },
|
||||
{ stateXid: uttarpradesh.id, cityName: 'Azamgarh' },
|
||||
{ stateXid: uttarpradesh.id, cityName: 'Lucknow' },
|
||||
{ stateXid: uttarpradesh.id, cityName: 'Prayagraj' },
|
||||
{ stateXid: Rajasthan.id, cityName: 'Jaipur' },
|
||||
{ stateXid: Rajasthan.id, cityName: 'Jaisalmer' },
|
||||
{ stateXid: Uttarakhand.id, cityName: 'Haridwar' },
|
||||
{ stateXid: HimachalPradesh.id, cityName: 'Manali' },
|
||||
{ stateXid: Gujrat.id, cityName: 'Surat' },
|
||||
{ stateXid: Gujrat.id, cityName: 'Ahemdabad' },
|
||||
{ stateXid: Gujrat.id, cityName: 'Rajkot' },
|
||||
],
|
||||
skipDuplicates: true,
|
||||
});
|
||||
@@ -56,6 +91,21 @@ async function main() {
|
||||
update: {},
|
||||
create: { countryXid: india.id, bankName: 'HDFC Bank' },
|
||||
});
|
||||
const indianBank = await prisma.banks.upsert({
|
||||
where: { bankName: 'Indian Bank' },
|
||||
update: {},
|
||||
create: { countryXid: india.id, bankName: 'Indian Bank' },
|
||||
});
|
||||
const Kotak = await prisma.banks.upsert({
|
||||
where: { bankName: 'Kotak Bank' },
|
||||
update: {},
|
||||
create: { countryXid: india.id, bankName: 'Kotak Bank' },
|
||||
});
|
||||
const BOI = await prisma.banks.upsert({
|
||||
where: { bankName: 'Bank of India' },
|
||||
update: {},
|
||||
create: { countryXid: india.id, bankName: 'Bank of India' },
|
||||
});
|
||||
|
||||
// ✅ Bank Branches
|
||||
await prisma.bankBranches.createMany({
|
||||
@@ -67,6 +117,27 @@ async function main() {
|
||||
branchAddress: 'HDFC Fort Branch, Mumbai',
|
||||
ifscCode: 'HDFC0001234',
|
||||
},
|
||||
{
|
||||
bankXid: indianBank.id,
|
||||
stateXid: maharashtra.id,
|
||||
cityXid: (await prisma.cities.findFirst({ where: { cityName: 'Mumbai' } }))!.id,
|
||||
branchAddress: 'Indian Bank Fort Branch, Mumbai',
|
||||
ifscCode: 'IDIB0001234',
|
||||
},
|
||||
{
|
||||
bankXid: Kotak.id,
|
||||
stateXid: Uttarakhand.id,
|
||||
cityXid: (await prisma.cities.findFirst({ where: { cityName: 'Haridwar' } }))!.id,
|
||||
branchAddress: 'Kotak Fort Branch, Mumbai',
|
||||
ifscCode: 'KTB0001234',
|
||||
},
|
||||
{
|
||||
bankXid: BOI.id,
|
||||
stateXid: uttarpradesh.id,
|
||||
cityXid: (await prisma.cities.findFirst({ where: { cityName: 'Azamgarh' } }))!.id,
|
||||
branchAddress: 'Bank of India Fort Branch, Mumbai',
|
||||
ifscCode: 'BOI0001234',
|
||||
},
|
||||
],
|
||||
skipDuplicates: true,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user