appwrite-utils-cli 0.0.35 → 0.0.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/migrations/collections.js +2 -7
- package/package.json +1 -1
- package/src/migrations/collections.ts +9 -16
package/README.md
CHANGED
|
@@ -86,6 +86,7 @@ This setup ensures that developers have robust tools at their fingertips to mana
|
|
|
86
86
|
|
|
87
87
|
### Changelog
|
|
88
88
|
|
|
89
|
+
- 0.0.36: Made it update collections by default, sometimes you gotta do what you gotta do
|
|
89
90
|
- 0.0.35: Added update collection if it exists and permissions or such are different (`documentSecurity` and `enabled`), also added a check for `fetch failed` errors to retry them with recursion, not sure how well that will work out, but we're gonna try it! It will still fail after 5 tries, but hopefully that gives Appwrite some time to figure it's stuff out
|
|
90
91
|
- 0.0.34: Fixed the `bin` section of the package.json, apparently you can't use `node` to run it
|
|
91
92
|
- 0.0.33: Fixed `idMappings`, if you are importing data and use the `idMappings` functionality, you can set a `fieldToSet` based on the value of a `sourceField` in the current imported items data (whether it's in the final data or the original), in order to match another field in another collection. So if you had a store, and it had items and the items have a Region ID for instance. You can then, in your regionId of the items, setup an `idMapping` that will allow you to map the value of the `targetField` based on the value of the `targetFieldToMatch` in the `targetCollection`. Sounds complex, but it's very useful. Like psuedo-relationship resolution, without the relationships.
|
|
@@ -173,13 +173,8 @@ export const createOrUpdateCollections = async (database, databaseId, config, de
|
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
175
|
else {
|
|
176
|
-
console.log(`Collection ${collection.name} exists,
|
|
177
|
-
|
|
178
|
-
collection.documentSecurity !== collectionToUse.documentSecurity ||
|
|
179
|
-
collection.$permissions.length !== collectionToUse.$permissions.length) {
|
|
180
|
-
console.log(`Updating collection: ${collectionToUse.$id}`);
|
|
181
|
-
await database.updateCollection(databaseId, collectionToUse.$id, collection.name, permissions, collection.documentSecurity ?? false, collection.enabled ?? true);
|
|
182
|
-
}
|
|
176
|
+
console.log(`Collection ${collection.name} exists, updating it`);
|
|
177
|
+
await database.updateCollection(databaseId, collectionToUse.$id, collection.name, permissions, collection.documentSecurity ?? false, collection.enabled ?? true);
|
|
183
178
|
}
|
|
184
179
|
// Update attributes and indexes for the collection
|
|
185
180
|
console.log("Creating Attributes");
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "appwrite-utils-cli",
|
|
3
3
|
"description": "Appwrite Utility Functions to help with database management, data conversion, data import, migrations, and much more. Meant to be used as a CLI tool, I do not recommend installing this in frontend environments.",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.36",
|
|
5
5
|
"main": "src/main.ts",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"repository": {
|
|
@@ -228,22 +228,15 @@ export const createOrUpdateCollections = async (
|
|
|
228
228
|
continue; // Skip to the next collection on failure
|
|
229
229
|
}
|
|
230
230
|
} else {
|
|
231
|
-
console.log(`Collection ${collection.name} exists,
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
collection
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
collectionToUse.$id,
|
|
241
|
-
collection.name,
|
|
242
|
-
permissions,
|
|
243
|
-
collection.documentSecurity ?? false,
|
|
244
|
-
collection.enabled ?? true
|
|
245
|
-
);
|
|
246
|
-
}
|
|
231
|
+
console.log(`Collection ${collection.name} exists, updating it`);
|
|
232
|
+
await database.updateCollection(
|
|
233
|
+
databaseId,
|
|
234
|
+
collectionToUse.$id,
|
|
235
|
+
collection.name,
|
|
236
|
+
permissions,
|
|
237
|
+
collection.documentSecurity ?? false,
|
|
238
|
+
collection.enabled ?? true
|
|
239
|
+
);
|
|
247
240
|
}
|
|
248
241
|
|
|
249
242
|
// Update attributes and indexes for the collection
|