Skip to content

Commit 49488a6

Browse files
Merge pull request #875 from appwrite/feat-collection-push-improvements
Feat collection push improvements
2 parents 85167e9 + 034d08e commit 49488a6

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

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

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -344,8 +344,8 @@ const createAttribute = async (databaseId, collectionId, attribute) => {
344344
collectionId,
345345
key: attribute.key,
346346
required: attribute.required,
347-
min: attribute.min,
348-
max: attribute.max,
347+
min: parseInt(attribute.min.toString()),
348+
max: parseInt(attribute.max.toString()),
349349
xdefault: attribute.default,
350350
array: attribute.array,
351351
parseOutput: false
@@ -356,8 +356,8 @@ const createAttribute = async (databaseId, collectionId, attribute) => {
356356
collectionId,
357357
key: attribute.key,
358358
required: attribute.required,
359-
min: attribute.min,
360-
max: attribute.max,
359+
min: parseFloat(attribute.min.toString()),
360+
max: parseFloat(attribute.max.toString()),
361361
xdefault: attribute.default,
362362
array: attribute.array,
363363
parseOutput: false
@@ -481,7 +481,14 @@ const attributesToCreate = async (remoteAttributes, localAttributes, collection)
481481
return { Key: change.key, Action: change.action, Reason: change.reason, };
482482
}));
483483

484-
if (!cliConfig.force) {
484+
if (!cliConfig.force && (deleting.length > 0 || conflicts.length > 0)) {
485+
if (deleting.length > 0) {
486+
log(`Attribute deletion will cause ${chalk.red('loss of data')}`);
487+
}
488+
if (conflicts.length > 0) {
489+
log(`Attribute recreation will cause ${chalk.red('loss of data')}`);
490+
}
491+
485492
const answers = await inquirer.prompt(questionsPushCollections[1]);
486493

487494
if (answers.changes.toLowerCase() !== 'yes') {
@@ -1045,7 +1052,7 @@ const pushCollection = async ({ returnOnZero } = { returnOnZero: false }) => {
10451052
}
10461053
}))
10471054

1048-
// Serialize attribute actions
1055+
// Serialize attribute actions
10491056
for (let collection of collections) {
10501057
let attributes = collection.attributes;
10511058

templates/cli/lib/questions.js.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ const questionsPushCollections = [
672672
{
673673
type: "input",
674674
name: "changes",
675-
message: `Are you sure you want to override this collection? This can lead to loss of data! Type "YES" to confirm.`
675+
message: `Would you like to apply these changes? Type "YES" to confirm.`
676676
}
677677
]
678678

0 commit comments

Comments
 (0)