Skip to content

Latest commit

ย 

History

History
98 lines (67 loc) ยท 3.9 KB

File metadata and controls

98 lines (67 loc) ยท 3.9 KB

๐Ÿ”น delete` โ€” delete database objects

Source Code

Top-level command with four subcommands. delete record is implemented; the rest are planned.

๐Ÿ”ธ delete record`

ingitdb delete record --id=ID [--path=PATH]
ingitdb delete record --id=ID --github=OWNER/REPO[@REF] [--token=TOKEN]

Deletes a single record by ID. For SingleRecord collections, the record file is removed. For MapOfIDRecords collections, the key is removed from the shared map file.

Flag Required Description
--id=ID yes Record ID as collection/path/key.
--path=PATH no Path to the local database directory. Defaults to the current working directory.
--github=OWNER/REPO[@REF] no GitHub repository. Mutually exclusive with --path.
--token=TOKEN no GitHub personal access token. Falls back to GITHUB_TOKEN. Required for GitHub writes.

Examples:

# ๐Ÿ“˜ Delete a record locally
ingitdb delete record --id=countries/ie

# ๐Ÿ™ Delete a record in a GitHub repository
export GITHUB_TOKEN=ghp_...
ingitdb delete record --github=myorg/mydb --id=countries/ie

The following subcommands are planned but not yet implemented:

โš™๏ธ delete collection`

ingitdb delete collection --collection=ID [--path=PATH]

Deletes a collection definition and all of its record files.

Flag Required Description
--collection=ID yes Collection id to delete (e.g. countries.counties).
--path=PATH no Path to the database directory. Defaults to the current working directory.

Example:

ingitdb delete collection --collection=countries.counties.dublin

๐Ÿ”ธ delete view`

ingitdb delete view --view=ID [--path=PATH]

Deletes a view definition and removes its materialised output files.

Flag Required Description
--view=ID yes View id to delete.
--path=PATH no Path to the database directory. Defaults to the current working directory.

Example:

ingitdb delete view --view=by_status

๐Ÿ”ธ delete records`

ingitdb delete records --collection=ID [--path=PATH] [--in=REGEXP] [--filter-name=PATTERN]

Deletes individual records from a collection. Use --in and --filter-name to scope which records are removed.

Flag Required Description
--collection=ID yes Collection to delete records from.
--path=PATH no Path to the database directory. Defaults to the current working directory.
--in=REGEXP no Regular expression scoping deletion to a sub-path.
--filter-name=PATTERN no Glob-style pattern to match record names to delete.

Example:

ingitdb delete records --collection=countries.counties --filter-name='*old*'