Relatude Help

The commands

Command What it does
new Create a new application: an API with a React client, or an MVC website
init Write relatude.settings/relatude.db.json into an existing application
info Report the database's state, node counts per type, file sizes and log status
schema Print the datamodel: node types, properties, relations and ids
query Run a query and print the result as JSON
validate Check the model code: what would fail at startup, and what to worry about
codegen Generate C# model code with every id spelled out
settings Print relatude.db.json as the server resolves it, without secrets
insert Insert nodes from JSON
delete Delete nodes by id
timestamp Print the head of the transaction log
revert Delete every transaction after a timestamp
maintenance Flush, truncate the log, save state, back up, clear caches, rebuild indexes
version Print the Relatude.DB version the tool was built against

relatude help <command> describes one command and its options. relatude help all prints the whole reference at once.

relatude schema                          # node types, members, ids, relations
relatude schema --format md > MODEL.md   # the same as a markdown document
relatude schema --format json            # ids included, for tooling
relatude schema --type Product --ids     # one type, with guids

relatude info                            # state, node counts per type, file sizes, log status

relatude query "Product.Count()"
relatude query "Product.Where(p => p.Price > 100).OrderBy(p => p.Name).Take(10)"
relatude query "Article.WhereSearch(\"backpack\").Page(0, 20)"
relatude query "Product.Where(p => p.Name == Name).Take(5)" --param Name=Rucksack

relatude codegen --out Models/Model.g.cs # the model as C#, with every id spelled out
relatude codegen --out-dir Models        # one file per node type and relation
relatude codegen --no-attributes         # plain interfaces

relatude validate                        # what would break at startup, and what to worry about
relatude settings                        # relatude.db.json resolved, without secrets
relatude init --namespace MyApp.Models   # write relatude.settings/relatude.db.json

relatude new --list-types                # the project types and what each is suited for
relatude new MyApp                       # default type: Backend (API + Relatude.DB) + Client (React)
relatude new MySite --projecttype csharp_web_mvc   # one ASP.NET Core MVC project
relatude new MyApp --user admin --password secret

relatude insert --type Product '{ "Name": "Rucksack", "Price": 249 }'
relatude insert --type Product --file products.json
relatude delete --id 4101bdce-040a-4aa7-940f-354e31cdc4c5 --yes

relatude timestamp                       # head of the transaction log, as a bare number
relatude revert --after <ts> --dry-run   # what would be deleted after that point
relatude revert --after <ts> --yes       # delete it: the database as if it never happened

relatude maintenance flush
relatude maintenance truncate-log        # rewrite the log to current state only
relatude maintenance save-state          # write state files, so the next start is fast
relatude maintenance backup --truncate
relatude maintenance clear-cache
relatude maintenance reset-indexes --yes # delete state and index files, rebuild from the log