@budibase/server 1.0.80-alpha.3 → 1.0.80-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/builder/assets/{index.f8c92447.js → index.5a72dc45.js} +98 -96
- package/builder/assets/{index.c57242d4.css → index.dd19c61c.css} +1 -1
- package/builder/index.html +2 -2
- package/coverage/clover.xml +182 -154
- package/coverage/coverage-final.json +7 -7
- package/coverage/lcov-report/api/controllers/analytics.js.html +1 -1
- package/coverage/lcov-report/api/controllers/apikeys.js.html +1 -1
- package/coverage/lcov-report/api/controllers/application.js.html +1 -1
- package/coverage/lcov-report/api/controllers/auth.js.html +1 -1
- package/coverage/lcov-report/api/controllers/automation.js.html +1 -1
- package/coverage/lcov-report/api/controllers/backup.js.html +1 -1
- package/coverage/lcov-report/api/controllers/cloud.js.html +1 -1
- package/coverage/lcov-report/api/controllers/component.js.html +1 -1
- package/coverage/lcov-report/api/controllers/datasource.js.html +1 -1
- package/coverage/lcov-report/api/controllers/dev.js.html +1 -1
- package/coverage/lcov-report/api/controllers/index.html +1 -1
- package/coverage/lcov-report/api/controllers/integration.js.html +1 -1
- package/coverage/lcov-report/api/controllers/layout.js.html +1 -1
- package/coverage/lcov-report/api/controllers/metadata.js.html +1 -1
- package/coverage/lcov-report/api/controllers/migrations.js.html +1 -1
- package/coverage/lcov-report/api/controllers/permission.js.html +1 -1
- package/coverage/lcov-report/api/controllers/query/index.html +1 -1
- package/coverage/lcov-report/api/controllers/query/index.js.html +1 -1
- package/coverage/lcov-report/api/controllers/query/validation.js.html +1 -1
- package/coverage/lcov-report/api/controllers/role.js.html +1 -1
- package/coverage/lcov-report/api/controllers/routing.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/external.js.html +71 -8
- package/coverage/lcov-report/api/controllers/row/index.html +33 -33
- package/coverage/lcov-report/api/controllers/row/index.js.html +35 -8
- package/coverage/lcov-report/api/controllers/row/internal.js.html +56 -8
- package/coverage/lcov-report/api/controllers/row/internalSearch.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/staticFormula.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/utils.js.html +1 -1
- package/coverage/lcov-report/api/controllers/screen.js.html +1 -1
- package/coverage/lcov-report/api/controllers/script.js.html +1 -1
- package/coverage/lcov-report/api/controllers/table/bulkFormula.js.html +1 -1
- package/coverage/lcov-report/api/controllers/table/external.js.html +51 -9
- package/coverage/lcov-report/api/controllers/table/index.html +14 -14
- package/coverage/lcov-report/api/controllers/table/index.js.html +1 -1
- package/coverage/lcov-report/api/controllers/table/internal.js.html +1 -1
- package/coverage/lcov-report/api/controllers/table/utils.js.html +1 -1
- package/coverage/lcov-report/api/controllers/templates.js.html +1 -1
- package/coverage/lcov-report/api/controllers/user.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/exporters.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/index.html +1 -1
- package/coverage/lcov-report/api/controllers/view/index.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/utils.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/viewBuilder.js.html +1 -1
- package/coverage/lcov-report/api/controllers/webhook.js.html +1 -1
- package/coverage/lcov-report/api/index.html +1 -1
- package/coverage/lcov-report/api/index.js.html +1 -1
- package/coverage/lcov-report/api/routes/analytics.js.html +1 -1
- package/coverage/lcov-report/api/routes/apikeys.js.html +1 -1
- package/coverage/lcov-report/api/routes/application.js.html +1 -1
- package/coverage/lcov-report/api/routes/auth.js.html +1 -1
- package/coverage/lcov-report/api/routes/automation.js.html +1 -1
- package/coverage/lcov-report/api/routes/backup.js.html +1 -1
- package/coverage/lcov-report/api/routes/cloud.js.html +1 -1
- package/coverage/lcov-report/api/routes/component.js.html +1 -1
- package/coverage/lcov-report/api/routes/datasource.js.html +1 -1
- package/coverage/lcov-report/api/routes/deploy.js.html +1 -1
- package/coverage/lcov-report/api/routes/dev.js.html +1 -1
- package/coverage/lcov-report/api/routes/index.html +1 -1
- package/coverage/lcov-report/api/routes/index.js.html +1 -1
- package/coverage/lcov-report/api/routes/integration.js.html +1 -1
- package/coverage/lcov-report/api/routes/layout.js.html +1 -1
- package/coverage/lcov-report/api/routes/metadata.js.html +1 -1
- package/coverage/lcov-report/api/routes/migrations.js.html +1 -1
- package/coverage/lcov-report/api/routes/permission.js.html +1 -1
- package/coverage/lcov-report/api/routes/query.js.html +1 -1
- package/coverage/lcov-report/api/routes/role.js.html +1 -1
- package/coverage/lcov-report/api/routes/routing.js.html +1 -1
- package/coverage/lcov-report/api/routes/row.js.html +65 -2
- package/coverage/lcov-report/api/routes/screen.js.html +1 -1
- package/coverage/lcov-report/api/routes/script.js.html +1 -1
- package/coverage/lcov-report/api/routes/static.js.html +1 -1
- package/coverage/lcov-report/api/routes/table.js.html +1 -1
- package/coverage/lcov-report/api/routes/templates.js.html +1 -1
- package/coverage/lcov-report/api/routes/user.js.html +1 -1
- package/coverage/lcov-report/api/routes/utils/index.html +1 -1
- package/coverage/lcov-report/api/routes/utils/validators.js.html +1 -1
- package/coverage/lcov-report/api/routes/view.js.html +1 -1
- package/coverage/lcov-report/api/routes/webhook.js.html +1 -1
- package/coverage/lcov-report/automations/actions.js.html +1 -1
- package/coverage/lcov-report/automations/automationUtils.js.html +1 -1
- package/coverage/lcov-report/automations/bullboard.js.html +1 -1
- package/coverage/lcov-report/automations/index.html +1 -1
- package/coverage/lcov-report/automations/index.js.html +1 -1
- package/coverage/lcov-report/automations/steps/bash.js.html +1 -1
- package/coverage/lcov-report/automations/steps/createRow.js.html +1 -1
- package/coverage/lcov-report/automations/steps/delay.js.html +1 -1
- package/coverage/lcov-report/automations/steps/deleteRow.js.html +1 -1
- package/coverage/lcov-report/automations/steps/discord.js.html +1 -1
- package/coverage/lcov-report/automations/steps/executeQuery.js.html +1 -1
- package/coverage/lcov-report/automations/steps/executeScript.js.html +1 -1
- package/coverage/lcov-report/automations/steps/filter.js.html +1 -1
- package/coverage/lcov-report/automations/steps/index.html +1 -1
- package/coverage/lcov-report/automations/steps/integromat.js.html +1 -1
- package/coverage/lcov-report/automations/steps/outgoingWebhook.js.html +1 -1
- package/coverage/lcov-report/automations/steps/queryRows.js.html +1 -1
- package/coverage/lcov-report/automations/steps/sendSmtpEmail.js.html +1 -1
- package/coverage/lcov-report/automations/steps/serverLog.js.html +1 -1
- package/coverage/lcov-report/automations/steps/slack.js.html +1 -1
- package/coverage/lcov-report/automations/steps/updateRow.js.html +1 -1
- package/coverage/lcov-report/automations/steps/utils.js.html +1 -1
- package/coverage/lcov-report/automations/steps/zapier.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/app.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/cron.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/index.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/index.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/rowDeleted.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/rowSaved.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/rowUpdated.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/webhook.js.html +1 -1
- package/coverage/lcov-report/automations/triggers.js.html +1 -1
- package/coverage/lcov-report/automations/utils.js.html +1 -1
- package/coverage/lcov-report/constants/index.html +1 -1
- package/coverage/lcov-report/constants/index.js.html +1 -1
- package/coverage/lcov-report/constants/layouts.js.html +1 -1
- package/coverage/lcov-report/constants/screens.js.html +1 -1
- package/coverage/lcov-report/db/client.js.html +1 -1
- package/coverage/lcov-report/db/inMemoryView.js.html +1 -1
- package/coverage/lcov-report/db/index.html +1 -1
- package/coverage/lcov-report/db/index.js.html +1 -1
- package/coverage/lcov-report/db/linkedRows/LinkController.js.html +1 -1
- package/coverage/lcov-report/db/linkedRows/index.html +1 -1
- package/coverage/lcov-report/db/linkedRows/index.js.html +1 -1
- package/coverage/lcov-report/db/linkedRows/linkUtils.js.html +1 -1
- package/coverage/lcov-report/db/newid.js.html +1 -1
- package/coverage/lcov-report/db/utils.js.html +1 -1
- package/coverage/lcov-report/events/AutomationEmitter.js.html +1 -1
- package/coverage/lcov-report/events/index.html +1 -1
- package/coverage/lcov-report/events/index.js.html +1 -1
- package/coverage/lcov-report/events/utils.js.html +1 -1
- package/coverage/lcov-report/index.html +26 -26
- package/coverage/lcov-report/integrations/tests/TestConfiguration.js.html +1 -1
- package/coverage/lcov-report/integrations/tests/index.html +1 -1
- package/coverage/lcov-report/middleware/appInfo.js.html +1 -1
- package/coverage/lcov-report/middleware/authorized.js.html +2 -2
- package/coverage/lcov-report/middleware/builder.js.html +1 -1
- package/coverage/lcov-report/middleware/currentapp.js.html +1 -1
- package/coverage/lcov-report/middleware/index.html +1 -1
- package/coverage/lcov-report/middleware/joi-validator.js.html +1 -1
- package/coverage/lcov-report/middleware/resourceId.js.html +12 -12
- package/coverage/lcov-report/middleware/selfhost.js.html +1 -1
- package/coverage/lcov-report/middleware/usageQuota.js.html +1 -1
- package/coverage/lcov-report/middleware/utils.js.html +1 -1
- package/coverage/lcov-report/threads/automation.js.html +1 -1
- package/coverage/lcov-report/threads/index.html +1 -1
- package/coverage/lcov-report/threads/index.js.html +1 -1
- package/coverage/lcov-report/threads/query.js.html +1 -1
- package/coverage/lcov-report/threads/utils.js.html +1 -1
- package/coverage/lcov-report/utilities/bcrypt.js.html +1 -1
- package/coverage/lcov-report/utilities/budibaseDir.js.html +1 -1
- package/coverage/lcov-report/utilities/centralPath.js.html +1 -1
- package/coverage/lcov-report/utilities/csvParser.js.html +1 -1
- package/coverage/lcov-report/utilities/global.js.html +1 -1
- package/coverage/lcov-report/utilities/index.html +1 -1
- package/coverage/lcov-report/utilities/index.js.html +1 -1
- package/coverage/lcov-report/utilities/queue/inMemoryQueue.js.html +1 -1
- package/coverage/lcov-report/utilities/queue/index.html +1 -1
- package/coverage/lcov-report/utilities/routing/index.html +1 -1
- package/coverage/lcov-report/utilities/routing/index.js.html +1 -1
- package/coverage/lcov-report/utilities/rowProcessor/index.html +1 -1
- package/coverage/lcov-report/utilities/rowProcessor/index.js.html +1 -1
- package/coverage/lcov-report/utilities/rowProcessor/utils.js.html +1 -1
- package/coverage/lcov-report/utilities/scriptRunner.js.html +1 -1
- package/coverage/lcov-report/utilities/security.js.html +1 -1
- package/coverage/lcov-report/utilities/statusCodes.js.html +1 -1
- package/coverage/lcov-report/utilities/usageQuota/index.html +1 -1
- package/coverage/lcov-report/utilities/usageQuota/index.js.html +1 -1
- package/coverage/lcov-report/utilities/usageQuota/rows.js.html +1 -1
- package/coverage/lcov-report/utilities/usageQuota/usageQuoteReset.js.html +1 -1
- package/coverage/lcov-report/utilities/users.js.html +1 -1
- package/coverage/lcov-report/utilities/workerRequests.js.html +1 -1
- package/coverage/lcov.info +295 -250
- package/dist/api/controllers/row/external.js +18 -0
- package/dist/api/controllers/row/index.js +11 -0
- package/dist/api/controllers/row/internal.js +11 -0
- package/dist/api/controllers/table/external.js +8 -2
- package/dist/api/routes/row.js +15 -1
- package/dist/integrations/base/sqlTable.js +13 -5
- package/dist/package.json +4 -4
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/src/api/controllers/row/external.js +21 -0
- package/src/api/controllers/row/index.js +9 -0
- package/src/api/controllers/row/internal.js +16 -0
- package/src/api/controllers/table/external.js +16 -2
- package/src/api/routes/row.js +21 -0
- package/src/definitions/datasource.ts +6 -0
- package/src/integrations/base/sqlTable.ts +24 -6
|
@@ -152,6 +152,24 @@ exports.validate = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
152
152
|
// can't validate external right now - maybe in future
|
|
153
153
|
return { valid: true };
|
|
154
154
|
});
|
|
155
|
+
exports.exportRows = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
156
|
+
const { datasourceId, tableName } = breakExternalTableId(ctx.params.tableId);
|
|
157
|
+
const db = getAppDB();
|
|
158
|
+
const datasource = yield db.get(datasourceId);
|
|
159
|
+
if (!datasource || !datasource.entities) {
|
|
160
|
+
ctx.throw(400, "Datasource has not been configured for plus API.");
|
|
161
|
+
}
|
|
162
|
+
const tables = datasource.entities;
|
|
163
|
+
const table = tables[tableName];
|
|
164
|
+
ctx.request.body = {
|
|
165
|
+
query: {
|
|
166
|
+
oneOf: {
|
|
167
|
+
[table.primaryDisplay]: ctx.request.body.map(id => breakRowIdField(id)[0]),
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
};
|
|
171
|
+
return exports.search(ctx);
|
|
172
|
+
});
|
|
155
173
|
exports.fetchEnrichedRow = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
156
174
|
const id = ctx.params.rowId;
|
|
157
175
|
const tableId = ctx.params.tableId;
|
|
@@ -159,3 +159,14 @@ exports.fetchEnrichedRow = function (ctx) {
|
|
|
159
159
|
}
|
|
160
160
|
});
|
|
161
161
|
};
|
|
162
|
+
exports.export = function (ctx) {
|
|
163
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
164
|
+
const tableId = getTableId(ctx);
|
|
165
|
+
try {
|
|
166
|
+
ctx.body = yield pickApi(tableId).exportRows(ctx);
|
|
167
|
+
}
|
|
168
|
+
catch (err) {
|
|
169
|
+
ctx.throw(400, err);
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
};
|
|
@@ -336,6 +336,17 @@ exports.validate = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
336
336
|
row: ctx.request.body,
|
|
337
337
|
});
|
|
338
338
|
});
|
|
339
|
+
exports.exportRows = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
340
|
+
const db = getAppDB();
|
|
341
|
+
const table = yield db.get(ctx.params.tableId);
|
|
342
|
+
const rowIds = ctx.request.body.rows;
|
|
343
|
+
let response = (yield db.allDocs({
|
|
344
|
+
include_docs: true,
|
|
345
|
+
keys: rowIds,
|
|
346
|
+
})).rows.map(row => row.doc);
|
|
347
|
+
let rows = yield outputProcessing(table, response);
|
|
348
|
+
return rows;
|
|
349
|
+
});
|
|
339
350
|
exports.fetchEnrichedRow = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
340
351
|
const db = getAppDB();
|
|
341
352
|
const tableId = ctx.params.tableId;
|
|
@@ -16,7 +16,7 @@ const { cloneDeep } = require("lodash/fp");
|
|
|
16
16
|
const csvParser = require("../../../utilities/csvParser");
|
|
17
17
|
const { handleRequest } = require("../row/external");
|
|
18
18
|
const { getAppDB } = require("@budibase/backend-core/context");
|
|
19
|
-
function makeTableRequest(datasource, operation, table, tables, oldTable = null) {
|
|
19
|
+
function makeTableRequest(datasource, operation, table, tables, oldTable = null, renamed = null) {
|
|
20
20
|
return __awaiter(this, void 0, void 0, function* () {
|
|
21
21
|
const json = {
|
|
22
22
|
endpoint: {
|
|
@@ -32,6 +32,9 @@ function makeTableRequest(datasource, operation, table, tables, oldTable = null)
|
|
|
32
32
|
if (oldTable) {
|
|
33
33
|
json.meta.table = oldTable;
|
|
34
34
|
}
|
|
35
|
+
if (renamed) {
|
|
36
|
+
json.meta.renamed = renamed;
|
|
37
|
+
}
|
|
35
38
|
return makeExternalQuery(datasource, json);
|
|
36
39
|
});
|
|
37
40
|
}
|
|
@@ -135,6 +138,7 @@ function isRelationshipSetup(column) {
|
|
|
135
138
|
exports.save = function (ctx) {
|
|
136
139
|
return __awaiter(this, void 0, void 0, function* () {
|
|
137
140
|
const table = ctx.request.body;
|
|
141
|
+
const { _rename: renamed } = table;
|
|
138
142
|
// can't do this right now
|
|
139
143
|
delete table.dataImport;
|
|
140
144
|
const datasourceId = getDatasourceId(ctx.request.body);
|
|
@@ -193,7 +197,7 @@ exports.save = function (ctx) {
|
|
|
193
197
|
const operation = oldTable
|
|
194
198
|
? DataSourceOperation.UPDATE_TABLE
|
|
195
199
|
: DataSourceOperation.CREATE_TABLE;
|
|
196
|
-
yield makeTableRequest(datasource, operation, tableToSave, tables, oldTable);
|
|
200
|
+
yield makeTableRequest(datasource, operation, tableToSave, tables, oldTable, renamed);
|
|
197
201
|
// update any extra tables (like foreign keys in other tables)
|
|
198
202
|
for (let extraTable of extraTablesToUpdate) {
|
|
199
203
|
const oldExtraTable = oldTables[extraTable.name];
|
|
@@ -206,6 +210,8 @@ exports.save = function (ctx) {
|
|
|
206
210
|
if (Array.isArray(tableToSave.constrained)) {
|
|
207
211
|
tableToSave.constrained = tableToSave.constrained.filter(constraint => Object.keys(tableToSave.schema).includes(constraint));
|
|
208
212
|
}
|
|
213
|
+
// remove the rename prop
|
|
214
|
+
delete tableToSave._rename;
|
|
209
215
|
// store it into couch now for budibase reference
|
|
210
216
|
datasource.entities[tableToSave.name] = tableToSave;
|
|
211
217
|
yield db.put(datasource);
|
package/dist/api/routes/row.js
CHANGED
|
@@ -194,5 +194,19 @@ router
|
|
|
194
194
|
* of the deleted rows, if deleting a single row then the body will contain a "row" property which
|
|
195
195
|
* is the deleted row.
|
|
196
196
|
*/
|
|
197
|
-
.delete("/api/:tableId/rows", paramResource("tableId"), authorized(PermissionTypes.TABLE, PermissionLevels.WRITE), usage, rowController.destroy)
|
|
197
|
+
.delete("/api/:tableId/rows", paramResource("tableId"), authorized(PermissionTypes.TABLE, PermissionLevels.WRITE), usage, rowController.destroy)
|
|
198
|
+
/**
|
|
199
|
+
* @api {post} /api/:tableId/rows/exportRows Export Rows
|
|
200
|
+
* @apiName Export rows
|
|
201
|
+
* @apiGroup rows
|
|
202
|
+
* @apiPermission table write access
|
|
203
|
+
* @apiDescription This API can export a number of provided rows
|
|
204
|
+
*
|
|
205
|
+
* @apiParam {string} tableId The ID of the table the row is to be deleted from.
|
|
206
|
+
*
|
|
207
|
+
* @apiParam (Body) {object[]} [rows] The row IDs which are to be exported
|
|
208
|
+
*
|
|
209
|
+
* @apiSuccess {object[]|object}
|
|
210
|
+
*/
|
|
211
|
+
.post("/api/:tableId/rows/exportRows", paramResource("tableId"), authorized(PermissionTypes.TABLE, PermissionLevels.WRITE), usage, rowController.export);
|
|
198
212
|
module.exports = router;
|
|
@@ -4,7 +4,7 @@ const knex_1 = require("knex");
|
|
|
4
4
|
const datasource_1 = require("../../definitions/datasource");
|
|
5
5
|
const utils_1 = require("../utils");
|
|
6
6
|
const { FieldTypes, RelationshipTypes } = require("../../constants");
|
|
7
|
-
function generateSchema(schema, table, tables, oldTable = null) {
|
|
7
|
+
function generateSchema(schema, table, tables, oldTable = null, renamed) {
|
|
8
8
|
let primaryKey = table && table.primary ? table.primary[0] : null;
|
|
9
9
|
const columns = Object.values(table.schema);
|
|
10
10
|
// all columns in a junction table will be meta
|
|
@@ -22,7 +22,9 @@ function generateSchema(schema, table, tables, oldTable = null) {
|
|
|
22
22
|
for (let [key, column] of Object.entries(table.schema)) {
|
|
23
23
|
// skip things that are already correct
|
|
24
24
|
const oldColumn = oldTable ? oldTable.schema[key] : null;
|
|
25
|
-
if ((oldColumn && oldColumn.type) ||
|
|
25
|
+
if ((oldColumn && oldColumn.type) ||
|
|
26
|
+
(primaryKey === key && !isJunction) ||
|
|
27
|
+
(renamed === null || renamed === void 0 ? void 0 : renamed.updated) === key) {
|
|
26
28
|
continue;
|
|
27
29
|
}
|
|
28
30
|
switch (column.type) {
|
|
@@ -72,12 +74,18 @@ function generateSchema(schema, table, tables, oldTable = null) {
|
|
|
72
74
|
break;
|
|
73
75
|
}
|
|
74
76
|
}
|
|
77
|
+
if (renamed) {
|
|
78
|
+
schema.renameColumn(renamed.old, renamed.updated);
|
|
79
|
+
}
|
|
75
80
|
// need to check if any columns have been deleted
|
|
76
81
|
if (oldTable) {
|
|
77
82
|
const deletedColumns = Object.entries(oldTable.schema)
|
|
78
83
|
.filter(([key, schema]) => schema.type !== FieldTypes.LINK && table.schema[key] == null)
|
|
79
84
|
.map(([key]) => key);
|
|
80
85
|
deletedColumns.forEach(key => {
|
|
86
|
+
if ((renamed === null || renamed === void 0 ? void 0 : renamed.old) === key) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
81
89
|
if (oldTable.constrained && oldTable.constrained.indexOf(key) !== -1) {
|
|
82
90
|
schema.dropForeign(key);
|
|
83
91
|
}
|
|
@@ -91,9 +99,9 @@ function buildCreateTable(knex, table, tables) {
|
|
|
91
99
|
generateSchema(schema, table, tables);
|
|
92
100
|
});
|
|
93
101
|
}
|
|
94
|
-
function buildUpdateTable(knex, table, tables, oldTable) {
|
|
102
|
+
function buildUpdateTable(knex, table, tables, oldTable, renamed) {
|
|
95
103
|
return knex.alterTable(table.name, schema => {
|
|
96
|
-
generateSchema(schema, table, tables, oldTable);
|
|
104
|
+
generateSchema(schema, table, tables, oldTable, renamed);
|
|
97
105
|
});
|
|
98
106
|
}
|
|
99
107
|
function buildDeleteTable(knex, table) {
|
|
@@ -132,7 +140,7 @@ class SqlTableQueryBuilder {
|
|
|
132
140
|
if (!json.meta || !json.meta.table) {
|
|
133
141
|
throw "Must specify old table for update";
|
|
134
142
|
}
|
|
135
|
-
query = buildUpdateTable(client, json.table, json.meta.tables, json.meta.table);
|
|
143
|
+
query = buildUpdateTable(client, json.table, json.meta.tables, json.meta.table, json.meta.renamed);
|
|
136
144
|
break;
|
|
137
145
|
case datasource_1.Operation.DELETE_TABLE:
|
|
138
146
|
query = buildDeleteTable(client, json.table);
|
package/dist/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/server",
|
|
3
3
|
"email": "hi@budibase.com",
|
|
4
|
-
"version": "1.0.80-alpha.
|
|
4
|
+
"version": "1.0.80-alpha.5",
|
|
5
5
|
"description": "Budibase Web Server",
|
|
6
6
|
"main": "src/index.ts",
|
|
7
7
|
"repository": {
|
|
@@ -71,9 +71,9 @@
|
|
|
71
71
|
"license": "GPL-3.0",
|
|
72
72
|
"dependencies": {
|
|
73
73
|
"@apidevtools/swagger-parser": "^10.0.3",
|
|
74
|
-
"@budibase/backend-core": "^1.0.80-alpha.
|
|
75
|
-
"@budibase/client": "^1.0.80-alpha.
|
|
76
|
-
"@budibase/string-templates": "^1.0.80-alpha.
|
|
74
|
+
"@budibase/backend-core": "^1.0.80-alpha.5",
|
|
75
|
+
"@budibase/client": "^1.0.80-alpha.5",
|
|
76
|
+
"@budibase/string-templates": "^1.0.80-alpha.5",
|
|
77
77
|
"@bull-board/api": "^3.7.0",
|
|
78
78
|
"@bull-board/koa": "^3.7.0",
|
|
79
79
|
"@elastic/elasticsearch": "7.10.0",
|