-
Type:
Improvement
-
Resolution: Fixed
-
Priority:
Unknown
-
Affects Version/s: None
-
None
Context
php artisan mongodb:encryption:create-collection takes one collection name as an argument. The encryptedFieldsMap can declare several collections, and there is no way to see which ones are not created yet, or to create them in one command.
Requested behavior* Interactive mode: when no collection argument is given and the terminal is interactive, ask which collections to create.
** Offer the collections of encryptedFieldsMap that do not exist yet.
** Allow selecting one or several.
- Non-interactive mode: when no collection argument is given and the input is not interactive, list the mapped collections that are not created yet, and exit without creating anything.
- --all: create every mapped collection that does not exist yet.
- --recreate: drop and recreate the collections that already exist, to rebuild them from a changed map.
Notes
- The collection argument stays optional for backward compatibility. Passing a collection name keeps the current behavior.
- --no-server still only validates the configuration.
- --recreate is destructive: dropping a collection removes its documents. The data keys stay in the key vault and are reused by alternate key name, so a recreated collection works with the same keys. The option should ask for confirmation in production, like the rewrap command does with ConfirmableTrait.
- The option names are open for discussion.