Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ program
.addCommand(proxy)
.addCommand(sites)
.addCommand(storage)
.addCommand(tablesdb)
.addCommand(tablesDB)
.addCommand(teams)
.addCommand(tokens)
.addCommand(users)
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/databases.js
Original file line number Diff line number Diff line change
Expand Up @@ -2330,7 +2330,7 @@ databases

databases
.command(`create`)
.description(`[**DEPRECATED** - This command is deprecated. Please use 'tables-db create-database' instead] Create a new Database. `)
.description(`[**DEPRECATED** - This command is deprecated. Please use 'tables-db create' instead] Create a new Database. `)
.requiredOption(`--database-id <database-id>`, `Unique Id. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
.requiredOption(`--name <name>`, `Database name. Max length: 128 chars.`)
.option(`--enabled [value]`, `Is the database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled.`, (value) => value === undefined ? true : parseBool(value))
Expand Down
10 changes: 5 additions & 5 deletions lib/commands/pull.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const { projectsGet } = require("./projects");
const { functionsList, functionsGetDeploymentDownload, functionsListDeployments } = require("./functions");
const { sitesList, sitesGetDeploymentDownload, sitesListDeployments } = require("./sites");
const { databasesGet, databasesListCollections, databasesList } = require("./databases");
const { gridsListDatabases, gridsGetDatabase, gridsListTables } = require("./grids");
const { tablesDBList, tablesDBget, tablesDBListTables } = require("./tables-db");
const { storageListBuckets } = require("./storage");
const { localConfig } = require("../config");
const { paginate } = require("../paginate");
Expand Down Expand Up @@ -343,7 +343,7 @@ const pullTable = async () => {
log("Fetching tables ...");
let total = 0;

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

if (databases.length === 0) {
if (cliConfig.all) {
databases = (await paginate(gridsListDatabases, { parseOutput: false }, 100, 'databases')).databases.map(database => database.$id);
databases = (await paginate(tablesDBList, { parseOutput: false }, 100, 'databases')).databases.map(database => database.$id);
} else {
databases = (await inquirer.prompt(questionsPullCollection)).databases;
}
}

for (const databaseId of databases) {
const database = await gridsGetDatabase({
const database = await tablesDBget({
databaseId,
parseOutput: false
});
Expand All @@ -374,7 +374,7 @@ const pullTable = async () => {

localConfig.addDatabase(database);

const { tables } = await paginate(gridsListTables, {
const { tables } = await paginate(tablesDBListTables, {
databaseId,
parseOutput: false
}, 100, 'tables');
Expand Down
12 changes: 6 additions & 6 deletions lib/commands/push.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ const {
databasesUpdateCollection
} = require("./databases");
const {
gridsGetDatabase,
gridsGetTable
} = require("./grids");
tablesDBGet,
tablesDBGetTable
} = require("./tables-db");
const {
storageGetBucket, storageUpdateBucket, storageCreateBucket
} = require("./storage");
Expand Down Expand Up @@ -1714,7 +1714,7 @@ const pushTable = async ({ returnOnZero, attempts } = { returnOnZero: false }) =
const localDatabase = localConfig.getDatabase(databaseId);

try {
const database = await gridsGetDatabase({
const database = await tablesDBGet({
databaseId: databaseId,
parseOutput: false,
});
Expand All @@ -1740,13 +1740,13 @@ const pushTable = async ({ returnOnZero, attempts } = { returnOnZero: false }) =
}));


if (!(await approveChanges(tables, gridsGetTable, KeysTable, 'tableId', 'tables', ['columns', 'indexes'], 'databaseId', 'databaseId',))) {
if (!(await approveChanges(tables, tablesDBGetTable, KeysTable, 'tableId', 'tables', ['columns', 'indexes'], 'databaseId', 'databaseId',))) {
return;
}
// Parallel collection actions
await Promise.all(tables.map(async (table) => {
try {
const remoteTable = await gridsGetTable({
const remoteTable = await tablesDBGetTable({
databaseId: table['databaseId'],
tableId: table['$id'],
parseOutput: false,
Expand Down
4 changes: 2 additions & 2 deletions lib/questions.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ const questionsPullResources = [
choices: [
{ name: `Settings ${chalk.blackBright(`(Project)`)}`, value: 'settings' },
{ name: `Functions ${chalk.blackBright(`(Deployment)`)}`, value: 'functions' },
{ name: `Tables ${chalk.blackBright(`(Grids)`)}`, value: 'tables' },
{ name: `Tables ${chalk.blackBright(`(TablesDB)`)}`, value: 'tables' },
{ name: `Buckets ${chalk.blackBright(`(Storage)`)}`, value: 'buckets' },
{ name: `Teams ${chalk.blackBright(`(Auth)`)}`, value: 'teams' },
{ name: `Topics ${chalk.blackBright(`(Messaging)`)}`, value: 'messages' },
Expand Down Expand Up @@ -667,7 +667,7 @@ const questionsPushResources = [
choices: [
{ name: `Settings ${chalk.blackBright(`(Project)`)}`, value: 'settings' },
{ name: `Functions ${chalk.blackBright(`(Deployment)`)}`, value: 'functions' },
{ name: `Tables ${chalk.blackBright(`(Grids)`)}`, value: 'tables' },
{ name: `Tables ${chalk.blackBright(`(TablesDB)`)}`, value: 'tables' },
{ name: `Buckets ${chalk.blackBright(`(Storage)`)}`, value: 'buckets' },
{ name: `Teams ${chalk.blackBright(`(Auth)`)}`, value: 'teams' },
{ name: `Topics ${chalk.blackBright(`(Messaging)`)}`, value: 'messages' },
Expand Down