Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/feat-general-improvements' into …
Browse files Browse the repository at this point in the history
…feat-general-improvements
  • Loading branch information
byawitz committed Jun 11, 2024
2 parents 8420eb0 + 49488a6 commit cc78c01
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
19 changes: 13 additions & 6 deletions templates/cli/lib/commands/push.js.twig
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,8 @@ const createAttribute = async (databaseId, collectionId, attribute) => {
collectionId,
key: attribute.key,
required: attribute.required,
min: attribute.min,
max: attribute.max,
min: parseInt(attribute.min.toString()),
max: parseInt(attribute.max.toString()),
xdefault: attribute.default,
array: attribute.array,
parseOutput: false
Expand All @@ -356,8 +356,8 @@ const createAttribute = async (databaseId, collectionId, attribute) => {
collectionId,
key: attribute.key,
required: attribute.required,
min: attribute.min,
max: attribute.max,
min: parseFloat(attribute.min.toString()),
max: parseFloat(attribute.max.toString()),
xdefault: attribute.default,
array: attribute.array,
parseOutput: false
Expand Down Expand Up @@ -481,7 +481,14 @@ const attributesToCreate = async (remoteAttributes, localAttributes, collection)
return { Key: change.key, Action: change.action, Reason: change.reason, };
}));

if (!cliConfig.force) {
if (!cliConfig.force && (deleting.length > 0 || conflicts.length > 0)) {
if (deleting.length > 0) {
log(`Attribute deletion will cause ${chalk.red('loss of data')}`);
}
if (conflicts.length > 0) {
log(`Attribute recreation will cause ${chalk.red('loss of data')}`);
}

const answers = await inquirer.prompt(questionsPushCollections[1]);

if (answers.changes.toLowerCase() !== 'yes') {
Expand Down Expand Up @@ -1045,7 +1052,7 @@ const pushCollection = async ({ returnOnZero } = { returnOnZero: false }) => {
}
}))

// Serialize attribute actions
// Serialize attribute actions
for (let collection of collections) {
let attributes = collection.attributes;

Expand Down
2 changes: 1 addition & 1 deletion templates/cli/lib/questions.js.twig
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ const questionsPushCollections = [
{
type: "input",
name: "changes",
message: `Are you sure you want to override this collection? This can lead to loss of data! Type "YES" to confirm.`
message: `Would you like to apply these changes? Type "YES" to confirm.`
}
]

Expand Down

0 comments on commit cc78c01

Please sign in to comment.