feat(seeder): add detailed execution timers (stopwatch) for location data
This commit is contained in:
parent
858df02a1d
commit
4b3eb2feee
2 changed files with 12 additions and 0 deletions
|
|
@ -64,7 +64,9 @@ async function seedDatabase() {
|
||||||
|
|
||||||
// Seed in order (respecting foreign key dependencies)
|
// Seed in order (respecting foreign key dependencies)
|
||||||
// 1. Location data first (continents -> subregions -> countries -> states -> cities)
|
// 1. Location data first (continents -> subregions -> countries -> states -> cities)
|
||||||
|
console.time('🌍 Total Location Seeding');
|
||||||
await seedLocationData();
|
await seedLocationData();
|
||||||
|
console.timeEnd('🌍 Total Location Seeding');
|
||||||
|
|
||||||
// 2. Then companies (need countries)
|
// 2. Then companies (need countries)
|
||||||
await seedCompanies();
|
await seedCompanies();
|
||||||
|
|
|
||||||
|
|
@ -463,23 +463,33 @@ export async function seedLocationData() {
|
||||||
try {
|
try {
|
||||||
// 1. Continents (from regions.sql - 6 records)
|
// 1. Continents (from regions.sql - 6 records)
|
||||||
console.log('1️⃣ Seeding Continents...');
|
console.log('1️⃣ Seeding Continents...');
|
||||||
|
console.time(' ⏱️ Continents');
|
||||||
await executeSqlFile('regions.sql', 'continents');
|
await executeSqlFile('regions.sql', 'continents');
|
||||||
|
console.timeEnd(' ⏱️ Continents');
|
||||||
|
|
||||||
// 2. Subregions (22 records)
|
// 2. Subregions (22 records)
|
||||||
console.log('2️⃣ Seeding Subregions...');
|
console.log('2️⃣ Seeding Subregions...');
|
||||||
|
console.time(' ⏱️ Subregions');
|
||||||
await executeSqlFile('subregions.sql', 'subregions');
|
await executeSqlFile('subregions.sql', 'subregions');
|
||||||
|
console.timeEnd(' ⏱️ Subregions');
|
||||||
|
|
||||||
// 3. Countries (~250 records)
|
// 3. Countries (~250 records)
|
||||||
console.log('3️⃣ Seeding Countries...');
|
console.log('3️⃣ Seeding Countries...');
|
||||||
|
console.time(' ⏱️ Countries');
|
||||||
await executeSqlFile('countries.sql', 'countries');
|
await executeSqlFile('countries.sql', 'countries');
|
||||||
|
console.timeEnd(' ⏱️ Countries');
|
||||||
|
|
||||||
// 4. States (~5400 records)
|
// 4. States (~5400 records)
|
||||||
console.log('4️⃣ Seeding States...');
|
console.log('4️⃣ Seeding States...');
|
||||||
|
console.time(' ⏱️ States');
|
||||||
await executeSqlFile('states.sql', 'states');
|
await executeSqlFile('states.sql', 'states');
|
||||||
|
console.timeEnd(' ⏱️ States');
|
||||||
|
|
||||||
// 5. Cities (~160k records) - This is the big one
|
// 5. Cities (~160k records) - This is the big one
|
||||||
console.log('5️⃣ Seeding Cities (this may take a while)...');
|
console.log('5️⃣ Seeding Cities (this may take a while)...');
|
||||||
|
console.time(' ⏱️ Cities (Bulk Insert)');
|
||||||
await executeGzippedSqlFile('cities.sql.gz', 'cities');
|
await executeGzippedSqlFile('cities.sql.gz', 'cities');
|
||||||
|
console.timeEnd(' ⏱️ Cities (Bulk Insert)');
|
||||||
|
|
||||||
console.log('\n ✅ Location data seeding complete!');
|
console.log('\n ✅ Location data seeding complete!');
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue