@@ -6,7 +6,7 @@ const inquirer = require("inquirer");
66const JSONbig = require("json-bigint")({ storeAsString: false });
77const { Command } = require("commander");
88const 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");
1010const { Spinner, SPINNER_ARC, SPINNER_DOTS } = require('../spinner');
1111const { paginate } = require('../paginate');
1212const { questionsPushBuckets, questionsPushTeams, questionsPushFunctions, questionsPushSites, questionsGetEntrypoint, questionsPushCollections, questionsPushTables, questionPushChanges, questionPushChangesConfirmation, questionsPushMessagingTopics, questionsPushResources } = require("../questions");
@@ -50,7 +50,8 @@ const {
5050 databasesUpdateCollection
5151} = require("./databases");
5252const {
53- gridsGetDatabase
53+ gridsGetDatabase,
54+ gridsGetTable
5455} = require("./grids");
5556const {
5657 storageGetBucket, storageUpdateBucket, storageCreateBucket
@@ -1738,13 +1739,13 @@ const pushTable = async ({ returnOnZero, attempts } = { returnOnZero: false }) =
17381739 }));
17391740
17401741
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',))) {
17421743 return;
17431744 }
17441745 // Parallel collection actions
17451746 await Promise.all(tables.map(async (table) => {
17461747 try {
1747- const remoteTable = await databasesGetTable ({
1748+ const remoteTable = await gridsGetTable ({
17481749 databaseId: table['databaseId'],
17491750 tableId: table['$id'],
17501751 parseOutput: false,
@@ -1784,14 +1785,14 @@ const pushTable = async ({ returnOnZero, attempts } = { returnOnZero: false }) =
17841785 let numberOfTables = 0;
17851786 // Serialize attribute actions
17861787 for (let table of tables) {
1787- let attributes = table.attributes ;
1788+ let columns = table.columns ;
17881789 let indexes = table.indexes;
17891790
17901791 if (table.isExisted) {
1791- attributes = await attributesToCreate(table.remoteVersion.attributes , table.attributes , table);
1792+ columns = await attributesToCreate(table.remoteVersion.columns , table.columns , table);
17921793 indexes = await attributesToCreate(table.remoteVersion.indexes, table.indexes, table, true);
17931794
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)) {
17951796 continue;
17961797 }
17971798
@@ -1800,7 +1801,7 @@ const pushTable = async ({ returnOnZero, attempts } = { returnOnZero: false }) =
18001801 log(`Pushing table ${table.name} ( ${table['databaseId']} - ${table['$id']} ) attributes`)
18011802
18021803 try {
1803- await createAttributes(attributes , table)
1804+ await createAttributes(columns , table)
18041805 } catch (e) {
18051806 throw e;
18061807 }
@@ -1881,7 +1882,7 @@ const pushCollection = async ({ returnOnZero, attempts } = { returnOnZero: false
18811882 }));
18821883
18831884
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',))) {
18851886 return;
18861887 }
18871888 // Parallel collection actions
0 commit comments