@@ -6,7 +6,7 @@ const inquirer = require("inquirer");
6
6
const JSONbig = require("json-bigint")({ storeAsString: false });
7
7
const { Command } = require("commander");
8
8
const ID = require("../id");
9
- const { localConfig, globalConfig, KeysAttributes, KeysFunction, KeysSite, whitelistKeys, KeysTopics, KeysStorage, KeysTeams, KeysCollection } = require("../config");
9
+ const { localConfig, globalConfig, KeysAttributes, KeysFunction, KeysSite, whitelistKeys, KeysTopics, KeysStorage, KeysTeams, KeysCollection, KeysTable } = require("../config");
10
10
const { Spinner, SPINNER_ARC, SPINNER_DOTS } = require('../spinner');
11
11
const { paginate } = require('../paginate');
12
12
const { questionsPushBuckets, questionsPushTeams, questionsPushFunctions, questionsPushSites, questionsGetEntrypoint, questionsPushCollections, questionsPushTables, questionPushChanges, questionPushChangesConfirmation, questionsPushMessagingTopics, questionsPushResources } = require("../questions");
@@ -50,7 +50,8 @@ const {
50
50
databasesUpdateCollection
51
51
} = require("./databases");
52
52
const {
53
- gridsGetDatabase
53
+ gridsGetDatabase,
54
+ gridsGetTable
54
55
} = require("./grids");
55
56
const {
56
57
storageGetBucket, storageUpdateBucket, storageCreateBucket
@@ -1738,13 +1739,13 @@ const pushTable = async ({ returnOnZero, attempts } = { returnOnZero: false }) =
1738
1739
}));
1739
1740
1740
1741
1741
- if (!(await approveChanges(tables, databasesGetTable , KeysTable, 'tableId', 'tables', ['attributes ', 'indexes'], 'databaseId', 'databaseId',))) {
1742
+ if (!(await approveChanges(tables, gridsGetTable , KeysTable, 'tableId', 'tables', ['columns ', 'indexes'], 'databaseId', 'databaseId',))) {
1742
1743
return;
1743
1744
}
1744
1745
// Parallel collection actions
1745
1746
await Promise.all(tables.map(async (table) => {
1746
1747
try {
1747
- const remoteTable = await databasesGetTable ({
1748
+ const remoteTable = await gridsGetTable ({
1748
1749
databaseId: table['databaseId'],
1749
1750
tableId: table['$id'],
1750
1751
parseOutput: false,
@@ -1784,14 +1785,14 @@ const pushTable = async ({ returnOnZero, attempts } = { returnOnZero: false }) =
1784
1785
let numberOfTables = 0;
1785
1786
// Serialize attribute actions
1786
1787
for (let table of tables) {
1787
- let attributes = table.attributes ;
1788
+ let columns = table.columns ;
1788
1789
let indexes = table.indexes;
1789
1790
1790
1791
if (table.isExisted) {
1791
- attributes = await attributesToCreate(table.remoteVersion.attributes , table.attributes , table);
1792
+ columns = await attributesToCreate(table.remoteVersion.columns , table.columns , table);
1792
1793
indexes = await attributesToCreate(table.remoteVersion.indexes, table.indexes, table, true);
1793
1794
1794
- if ((Array.isArray(attributes ) && attributes .length < = 0) && (Array.isArray(indexes) && indexes.length < = 0)) {
1795
+ if ((Array.isArray(columns ) && columns .length < = 0) && (Array.isArray(indexes) && indexes.length < = 0)) {
1795
1796
continue;
1796
1797
}
1797
1798
@@ -1800,7 +1801,7 @@ const pushTable = async ({ returnOnZero, attempts } = { returnOnZero: false }) =
1800
1801
log(`Pushing table ${table.name} ( ${table['databaseId']} - ${table['$id']} ) attributes`)
1801
1802
1802
1803
try {
1803
- await createAttributes(attributes , table)
1804
+ await createAttributes(columns , table)
1804
1805
} catch (e) {
1805
1806
throw e;
1806
1807
}
@@ -1881,7 +1882,7 @@ const pushCollection = async ({ returnOnZero, attempts } = { returnOnZero: false
1881
1882
}));
1882
1883
1883
1884
1884
- if (!(await approveChanges(collections, databasesGetCollection, KeysCollection, 'collectionId', 'collections', ['attributes ', 'indexes'], 'databaseId', 'databaseId',))) {
1885
+ if (!(await approveChanges(collections, databasesGetCollection, KeysCollection, 'collectionId', 'collections', ['columns ', 'indexes'], 'databaseId', 'databaseId',))) {
1885
1886
return;
1886
1887
}
1887
1888
// Parallel collection actions
0 commit comments