|
|
@ -147,6 +147,14 @@ export default { |
|
|
|
.create({client: 'sqlite3'}) |
|
|
|
.create({client: 'sqlite3'}) |
|
|
|
.getNewTableColumns() |
|
|
|
.getNewTableColumns() |
|
|
|
.filter(c => c.column_name != "title") |
|
|
|
.filter(c => c.column_name != "title") |
|
|
|
|
|
|
|
// mark updated column_name |
|
|
|
|
|
|
|
t.columns.map(c => { |
|
|
|
|
|
|
|
if (c.cn) { |
|
|
|
|
|
|
|
c.column_name = c.cn |
|
|
|
|
|
|
|
c.ref_column_name = c.column_name |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return c |
|
|
|
|
|
|
|
}) |
|
|
|
const table = await this.$api.dbTable.create(project.id, { |
|
|
|
const table = await this.$api.dbTable.create(project.id, { |
|
|
|
table_name: t.ref_table_name, |
|
|
|
table_name: t.ref_table_name, |
|
|
|
title: '', |
|
|
|
title: '', |
|
|
@ -154,6 +162,7 @@ export default { |
|
|
|
}); |
|
|
|
}); |
|
|
|
console.log(table) |
|
|
|
console.log(table) |
|
|
|
t.table_title = table.title |
|
|
|
t.table_title = table.title |
|
|
|
|
|
|
|
console.log(t) |
|
|
|
} |
|
|
|
} |
|
|
|
this.tableCreation = true |
|
|
|
this.tableCreation = true |
|
|
|
} catch (e) { |
|
|
|
} catch (e) { |
|
|
@ -188,8 +197,11 @@ export default { |
|
|
|
async importDataToProject(projectName, prefix) { |
|
|
|
async importDataToProject(projectName, prefix) { |
|
|
|
let total = 0 |
|
|
|
let total = 0 |
|
|
|
let progress = 0 |
|
|
|
let progress = 0 |
|
|
|
|
|
|
|
console.log("projectName = " + projectName) |
|
|
|
|
|
|
|
console.log(this.templateData.tables) |
|
|
|
await Promise.all(this.templateData.tables.map(v => (async(tableMeta) => { |
|
|
|
await Promise.all(this.templateData.tables.map(v => (async(tableMeta) => { |
|
|
|
const table = tableMeta.table_title |
|
|
|
console.log(tableMeta) |
|
|
|
|
|
|
|
const tableName = tableMeta.table_title |
|
|
|
const data = this.importData[tableMeta.ref_table_name] |
|
|
|
const data = this.importData[tableMeta.ref_table_name] |
|
|
|
total += data.length |
|
|
|
total += data.length |
|
|
|
for (let i = 0; i < data.length; i += 500) { |
|
|
|
for (let i = 0; i < data.length; i += 500) { |
|
|
@ -199,7 +211,7 @@ export default { |
|
|
|
await this.$api.dbTableRow.bulkCreate( |
|
|
|
await this.$api.dbTableRow.bulkCreate( |
|
|
|
'noco', |
|
|
|
'noco', |
|
|
|
projectName, |
|
|
|
projectName, |
|
|
|
table, |
|
|
|
tableName, |
|
|
|
batchData |
|
|
|
batchData |
|
|
|
) |
|
|
|
) |
|
|
|
progress += batchData.length |
|
|
|
progress += batchData.length |
|
|
|