Skip to content

Commit 662c7a5

Browse files
authored
Merge pull request #1170 from appwrite/fix-grid-cli
Fix: grid DB CLI
2 parents 3a4b01b + fcaabd9 commit 662c7a5

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

templates/cli/index.js.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ program
113113
.addCommand(logout)
114114
{% endif %}
115115
{% for service in spec.services %}
116-
.addCommand({{ service.name | caseLower }})
116+
.addCommand({{ service.name }})
117117
{% endfor %}
118118
.addCommand(client)
119119
.parse(process.argv);

templates/cli/lib/commands/pull.js.twig

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const { projectsGet } = require("./projects");
99
const { functionsList, functionsGetDeploymentDownload, functionsListDeployments } = require("./functions");
1010
const { sitesList, sitesGetDeploymentDownload, sitesListDeployments } = require("./sites");
1111
const { databasesGet, databasesListCollections, databasesList } = require("./databases");
12-
const { gridsListDatabases, gridsGetDatabase, gridsListTables } = require("./grids");
12+
const { tablesDBList, tablesDBget, tablesDBListTables } = require("./tables-db");
1313
const { storageListBuckets } = require("./storage");
1414
const { localConfig } = require("../config");
1515
const { paginate } = require("../paginate");
@@ -343,7 +343,7 @@ const pullTable = async () => {
343343
log("Fetching tables ...");
344344
let total = 0;
345345

346-
const fetchResponse = await gridsListDatabases({
346+
const fetchResponse = await tablesDBList({
347347
queries: [JSON.stringify({ method: 'limit', values: [1] })],
348348
parseOutput: false
349349
});
@@ -357,14 +357,14 @@ const pullTable = async () => {
357357

358358
if (databases.length === 0) {
359359
if (cliConfig.all) {
360-
databases = (await paginate(gridsListDatabases, { parseOutput: false }, 100, 'databases')).databases.map(database => database.$id);
360+
databases = (await paginate(tablesDBList, { parseOutput: false }, 100, 'databases')).databases.map(database => database.$id);
361361
} else {
362362
databases = (await inquirer.prompt(questionsPullCollection)).databases;
363363
}
364364
}
365365

366366
for (const databaseId of databases) {
367-
const database = await gridsGetDatabase({
367+
const database = await tablesDBget({
368368
databaseId,
369369
parseOutput: false
370370
});
@@ -374,7 +374,7 @@ const pullTable = async () => {
374374

375375
localConfig.addDatabase(database);
376376

377-
const { tables } = await paginate(gridsListTables, {
377+
const { tables } = await paginate(tablesDBListTables, {
378378
databaseId,
379379
parseOutput: false
380380
}, 100, 'tables');

templates/cli/lib/commands/push.js.twig

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ const {
5050
databasesUpdateCollection
5151
} = require("./databases");
5252
const {
53-
gridsGetDatabase,
54-
gridsGetTable
55-
} = require("./grids");
53+
tablesDBGet,
54+
tablesDBGetTable
55+
} = require("./tables-db");
5656
const {
5757
storageGetBucket, storageUpdateBucket, storageCreateBucket
5858
} = require("./storage");
@@ -1714,7 +1714,7 @@ const pushTable = async ({ returnOnZero, attempts } = { returnOnZero: false }) =
17141714
const localDatabase = localConfig.getDatabase(databaseId);
17151715

17161716
try {
1717-
const database = await gridsGetDatabase({
1717+
const database = await tablesDBGet({
17181718
databaseId: databaseId,
17191719
parseOutput: false,
17201720
});
@@ -1740,13 +1740,13 @@ const pushTable = async ({ returnOnZero, attempts } = { returnOnZero: false }) =
17401740
}));
17411741

17421742

1743-
if (!(await approveChanges(tables, gridsGetTable, KeysTable, 'tableId', 'tables', ['columns', 'indexes'], 'databaseId', 'databaseId',))) {
1743+
if (!(await approveChanges(tables, tablesDBGetTable, KeysTable, 'tableId', 'tables', ['columns', 'indexes'], 'databaseId', 'databaseId',))) {
17441744
return;
17451745
}
17461746
// Parallel collection actions
17471747
await Promise.all(tables.map(async (table) => {
17481748
try {
1749-
const remoteTable = await gridsGetTable({
1749+
const remoteTable = await tablesDBGetTable({
17501750
databaseId: table['databaseId'],
17511751
tableId: table['$id'],
17521752
parseOutput: false,

templates/cli/lib/questions.js.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ const questionsPullResources = [
255255
choices: [
256256
{ name: `Settings ${chalk.blackBright(`(Project)`)}`, value: 'settings' },
257257
{ name: `Functions ${chalk.blackBright(`(Deployment)`)}`, value: 'functions' },
258-
{ name: `Tables ${chalk.blackBright(`(Grids)`)}`, value: 'tables' },
258+
{ name: `Tables ${chalk.blackBright(`(TablesDB)`)}`, value: 'tables' },
259259
{ name: `Buckets ${chalk.blackBright(`(Storage)`)}`, value: 'buckets' },
260260
{ name: `Teams ${chalk.blackBright(`(Auth)`)}`, value: 'teams' },
261261
{ name: `Topics ${chalk.blackBright(`(Messaging)`)}`, value: 'messages' },
@@ -667,7 +667,7 @@ const questionsPushResources = [
667667
choices: [
668668
{ name: `Settings ${chalk.blackBright(`(Project)`)}`, value: 'settings' },
669669
{ name: `Functions ${chalk.blackBright(`(Deployment)`)}`, value: 'functions' },
670-
{ name: `Tables ${chalk.blackBright(`(Grids)`)}`, value: 'tables' },
670+
{ name: `Tables ${chalk.blackBright(`(TablesDB)`)}`, value: 'tables' },
671671
{ name: `Buckets ${chalk.blackBright(`(Storage)`)}`, value: 'buckets' },
672672
{ name: `Teams ${chalk.blackBright(`(Auth)`)}`, value: 'teams' },
673673
{ name: `Topics ${chalk.blackBright(`(Messaging)`)}`, value: 'messages' },

0 commit comments

Comments
 (0)