civex record
Manage records
| Command | Description |
|---|---|
add |
Add a record, prompting for each field defined on the schema. |
check |
Check records for what needs a look: values their field's rules now refuse (a rule tightened after they were entered), required fields left empty, records sharing a unique key, links to records that are gone and files that are nowhere. |
delete |
Delete a record (and its children) to Recently Deleted. |
delete-all |
Delete all records in a dataset (optionally filtered by schema). |
find |
List records in a dataset. Use --schema to filter by type and show field columns, and --search to find records by what they hold. |
move |
Move records to another collection, or inside another record. |
move-all |
Move every record of a collection (or of one schema in it) to another. |
note |
Notes left on records |
orphans |
List live records that sit under a deleted record, so nothing above them lists them, with what they sit under. Put one back in place with civex record restore-above <id>, or delete it. |
purge |
Permanently delete a record that's already in Recently Deleted. Irreversible. |
restore |
Restore a soft-deleted record (and the children cascade-deleted with it). |
restore-above |
Bring back what a live record sits under that is deleted: each deleted record directly above it, by itself, so their other children stay deleted. |
set |
Set (or clear) fields on many records at once. |
show |
Show a record's field values. |
summarise |
Summarise records: group them by field values and work out counts, averages, totals and more over each group. |
update |
Update a record's field values, prompting for each field. |
civex record add
Add a record, prompting for each field defined on the schema.
Usage
Options
| Option | Type | Default | Description |
|---|---|---|---|
--to |
str |
Dataset to add the record to (required) | |
--schema, -s |
str |
Schema for this record (required) |
civex record check
Check records for what needs a look: values their field's rules now refuse (a rule tightened after they were entered), required fields left empty, records sharing a unique key, links to records that are gone and files that are nowhere.
The records are those record find would list with the same options.
Prints one line per kind, field and issue with a count; with --issue,
lists the records that have it (their ids are what record set --id
takes to put them right). Nothing is changed.
Usage
Options
| Option | Type | Default | Description |
|---|---|---|---|
--in |
str |
The collection (omit for every collection) | |
--schema, -s |
str |
Only this kind of record (omit for every kind) | |
--where, -w |
str |
Only records with field=value; repeatable | |
--search, -q |
str |
Only records whose values contain this text | |
--within |
str |
Only records beneath this record (id or prefix) | |
--issue, -i |
str |
List the records with this issue instead: breaks_rule, blank, duplicate_key, broken_reference or missing_file. | |
--field, -f |
str |
With --issue: only this field's issue | |
--limit, -n |
int |
200 |
With --issue: the most records to list |
civex record delete
Delete a record (and its children) to Recently Deleted.
Reversible with civex record restore within the retention window
(see civex trash list); civex record purge deletes permanently.
Usage
Arguments
| Argument | Type | Required | Description |
|---|---|---|---|
RECORD_ID |
str |
yes | Record ID or short prefix |
Options
| Option | Type | Default | Description |
|---|---|---|---|
--yes, -y |
flag | false |
Skip confirmation prompt |
--force |
flag | false |
Clear any reference/reference_list fields pointing at this record instead of blocking the delete |
civex record delete-all
Delete all records in a dataset (optionally filtered by schema).
Usage
Arguments
| Argument | Type | Required | Description |
|---|---|---|---|
DATASET_NAME |
str |
yes | Dataset to delete records from |
Options
| Option | Type | Default | Description |
|---|---|---|---|
--schema, -s |
str |
Limit to this schema | |
--yes, -y |
flag | false |
Skip confirmation prompt |
--force |
flag | false |
Clear any reference/reference_list fields pointing at deleted records instead of blocking the delete |
civex record find
List records in a dataset. Use --schema to filter by type and show field columns, and --search to find records by what they hold.
Usage
Options
| Option | Type | Default | Description |
|---|---|---|---|
--in |
str |
Dataset to search (required) | |
--schema, -s |
str |
Filter by schema | |
--where |
str |
field=value filter (repeatable) | |
--search, -q |
str |
Text to look for in the records' values (text, numbers, list items, file names), ignoring case. A record id prefix matches too. | |
--search-field |
str |
Look for the --search text only in this field (repeatable). Needs --schema. | |
--limit, -n |
int |
50 |
Maximum records to return |
civex record move
Move records to another collection, or inside another record.
A record keeps its id, its values and its history, and takes everything beneath it along; the move is one event in Activity. It is refused whole when a reference would break (a record may only reference its own collection's records or a global collection's), a uniqueness key is taken where it would land, or its kind can't sit there.
Usage
Arguments
| Argument | Type | Required | Description |
|---|---|---|---|
RECORD_IDS... |
str |
yes | Records to move (ids or unique prefixes), with everything inside them |
Options
| Option | Type | Default | Description |
|---|---|---|---|
--to |
str |
The collection to move them to (required) | |
--under |
str |
The record in that collection they go inside (omit for its top level) | |
--dry-run |
flag | false |
Say what would move and what is in the way, only |
civex record move-all
Move every record of a collection (or of one schema in it) to another.
Usage
Arguments
| Argument | Type | Required | Description |
|---|---|---|---|
DATASET_NAME |
str |
yes | Collection to move records from |
Options
| Option | Type | Default | Description |
|---|---|---|---|
--to |
str |
The collection to move them to (required) | |
--schema, -s |
str |
Only records of this schema | |
--under |
str |
The record in that collection they go inside (omit for its top level) | |
--yes, -y |
flag | false |
Skip confirmation prompt |
--dry-run |
flag | false |
Say what would move and what is in the way, only |
civex record note
Notes left on records
Usage
civex record orphans
List live records that sit under a deleted record, so nothing above them
lists them, with what they sit under. Put one back in place with
civex record restore-above <id>, or delete it.
Usage
Options
| Option | Type | Default | Description |
|---|---|---|---|
--limit |
int |
200 |
Show at most this many. |
civex record purge
Permanently delete a record that's already in Recently Deleted. Irreversible.
Usage
Arguments
| Argument | Type | Required | Description |
|---|---|---|---|
RECORD_ID |
str |
yes | Record ID or short prefix |
Options
| Option | Type | Default | Description |
|---|---|---|---|
--yes, -y |
flag | false |
Skip confirmation prompt |
civex record restore
Restore a soft-deleted record (and the children cascade-deleted with it).
Usage
Arguments
| Argument | Type | Required | Description |
|---|---|---|---|
RECORD_ID |
str |
yes | Record ID or short prefix |
Options
| Option | Type | Default | Description |
|---|---|---|---|
--only-this |
flag | false |
Restore just this record, not the children deleted with it. |
--with-parents |
flag | false |
If deleted records above it hold it back, restore them too, each by itself, leaving their other children deleted. |
civex record restore-above
Bring back what a live record sits under that is deleted: each deleted record directly above it, by itself, so their other children stay deleted.
Usage
Arguments
| Argument | Type | Required | Description |
|---|---|---|---|
RECORD_ID |
str |
yes | Record ID or short prefix |
civex record set
Set (or clear) fields on many records at once.
Choose the records with --id (repeatable), or with --in and the same filters as listing them. Each value is read as its field's type. A record takes every change or none: one that can't (a value its field won't take, a uniqueness key already used, a field it hasn't got of its own) is left as it is and named, and the others are changed. The plan is shown first; the edit is one event in Activity, and may start workflow runs that watch the fields.
Usage
Arguments
| Argument | Type | Required | Description |
|---|---|---|---|
ASSIGNMENTS... |
str |
yes | field=value terms; an empty value (field=) clears the field |
Options
| Option | Type | Default | Description |
|---|---|---|---|
--id |
str |
A record to edit (id or prefix); repeat for several | |
--in |
str |
Edit every record this collection lists (with the filters) | |
--schema, -s |
str |
Only records of this schema | |
--where, -w |
str |
Only records with field=value; repeatable | |
--search, -q |
str |
Only records whose values contain this text | |
--yes, -y |
flag | false |
Skip confirmation prompt |
--dry-run |
flag | false |
Say what would change and what can't, only |
civex record show
Show a record's field values.
Usage
Arguments
| Argument | Type | Required | Description |
|---|---|---|---|
RECORD_ID |
str |
yes | Record ID or short prefix |
civex record summarise
Summarise records: group them by field values and work out counts, averages, totals and more over each group.
The records are those record find would list with the same options. A
date groups by year, month, week or day (one known only to the year keeps
a group of its own), a date and time in its field's or collection's time
zone, a number by value or in ranges, a list (tags, links) by each item.
The last row is the totals over every record, each counted once.
Usage
Options
| Option | Type | Default | Description |
|---|---|---|---|
--in |
str |
The collection (omit for every collection) | |
--schema, -s |
str |
The kind of record to summarise (required) | |
--by, -b |
str |
Group by a field (repeatable, up to 3): 'field', or 'kind.field' for a field of a kind above; add ':year', ':month', ':week' or ':day' for a date, or ':5' for a number in ranges 5 wide. | |
--measure, -m |
str |
What to work out (repeatable): 'count' (records, the default), or 'filled', 'distinct', 'min', 'max', 'mean' or 'sum' then ':field', e.g. 'mean:depth'. | |
--where, -w |
str |
Only records with field=value; repeatable | |
--search, -q |
str |
Only records whose values contain this text | |
--within |
str |
Only records beneath this record (id or prefix) | |
--limit, -n |
int |
1000 |
The most groups to show |
--format, -f |
str |
Print the summary as csv, tsv, json or jsonl instead of a table (a last row holds the totals). | |
--csv |
flag | false |
The same as --format csv |
civex record update
Update a record's field values, prompting for each field.
Usage
Arguments
| Argument | Type | Required | Description |
|---|---|---|---|
RECORD_ID |
str |
yes | Record ID or short prefix |