Browse Source

feat: update record count, error log

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
pull/2218/head
Raju Udava 2 years ago committed by Pranav C
parent
commit
392733daeb
  1. 20
      packages/nocodb/src/lib/noco/meta/api/sync/helpers/job.ts
  2. 4
      packages/nocodb/src/lib/noco/meta/api/sync/helpers/readAndProcessData.ts

20
packages/nocodb/src/lib/noco/meta/api/sync/helpers/job.ts

@ -104,6 +104,10 @@ export default async (
migrationSkipLog: {
count: 0,
log: []
},
data: {
records: 0,
nestedLinks: 0
}
};
@ -119,6 +123,13 @@ export default async (
async function getAirtableSchema(sDB) {
const start = Date.now();
if (!sDB.shareId)
throw {
message:
'Invalid Shared Base ID :: Ensure www.airtable.com/<SharedBaseID> is accessible. Refer https://bit.ly/3x0OdXI for details'
};
if (sDB.shareId.startsWith('exp')) {
const template = await FetchAT.readTemplate(sDB.shareId);
await FetchAT.initialize(template.template.exploreApplication.shareId);
@ -1895,6 +1906,8 @@ export default async (
logBasic(`:: Grid: ${rtc.view.grid}`);
logBasic(`:: Gallery: ${rtc.view.gallery}`);
logBasic(`:: Form: ${rtc.view.form}`);
logBasic(`:: Total Records: ${rtc.data.records}`);
logBasic(`:: Total Nested Links: ${rtc.data.nestedLinks}`);
const duration = Date.now() - start;
logBasic(`:: Migration time: ${duration}`);
@ -1934,7 +1947,9 @@ export default async (
axios: {
count: rtc.fetchAt.count,
time: rtc.fetchAt.time
}
},
totalRecords: rtc.data.records,
nestedLinks: rtc.data.nestedLinks
}
}
});
@ -2254,6 +2269,7 @@ export default async (
sDB: syncDB,
logDetailed
});
rtc.data.records += recordsMap[ncTbl.id].length;
logDetailed(`Data inserted from ${ncTbl.title}`);
}
@ -2261,7 +2277,7 @@ export default async (
logBasic('Configuring Record Links...');
for (let i = 0; i < ncTblList.list.length; i++) {
const ncTbl = await api.dbTable.read(ncTblList.list[i].id);
await importLTARData({
rtc.data.nestedLinks += await importLTARData({
table: ncTbl,
projectName: syncDB.projectName,
api,

4
packages/nocodb/src/lib/noco/meta/api/sync/helpers/readAndProcessData.ts

@ -118,6 +118,7 @@ export async function importData({
return records;
} catch (e) {
console.log(e);
return 0;
}
}
@ -192,6 +193,7 @@ export async function importLTARData({
});
}
let nestedLinkCnt = 0;
// Iterate over all related M2M associative table
for (const assocMeta of assocTableMetas) {
const insertData = [];
@ -209,6 +211,7 @@ export async function importLTARData({
);
}
nestedLinkCnt += insertData.length;
// Insert datas as chunks of size `ASSOC_BULK_DATA_BATCH_SIZE`
for (
let i = 0;
@ -229,4 +232,5 @@ export async function importLTARData({
);
}
}
return nestedLinkCnt;
}

Loading…
Cancel
Save