# Managing data

> Browse and edit collections and records, filter, and import/export.

_Updated: 2026-06-07_

The **Data** tab is a working database UI over your collections — view and edit
records, change schema, and move data in and out.

## Schema

The **Schemas** screen lists your collections. You can create and edit
*admin-managed* collections here through a drawer: add fields with their types and
modifiers (required, unique, min/max, options, relations), define row-level
**checks**, and toggle soft-delete.

```walkthrough
target: admin
title: The Schemas screen
steps:
  - say: The Schemas screen lists every collection in your instance.
    do: navigate
    value: /_/schema
    expect: { text: posts, first: true }
  - say: Create and edit admin-managed collections through a drawer — fields, checks, and soft-delete.
    do: hover
    on: { text: posts, first: true }
    minDwellSec: 2
```

> [!NOTE]
> Collections defined in Go code show as **code-defined** and are read-only in the
> UI — change those in your [schema](schema) and run a migration. Before saving a
> schema edit, the UI runs a **dry-run migration diff** so you see exactly what
> DDL will change.

## Records

Open a collection to get a data grid:

- **Create / edit** — "+ New" and row "Edit" open a side drawer; for simple field
  types you can also **click a cell to edit inline** (saves on Enter).
- **Filter & sort** — a filter box takes an expression
  (`status='published' && views>100`) and a sort box takes a key list
  (`-created,title`). A full-text search box appears for collections with a
  searchable field.
- **Bulk actions** — select rows to delete in bulk; you get a per-row success
  report.
- **Tree / DAG views** — hierarchical and self-referencing collections get
  tree/graph toggles.

```walkthrough
target: admin
title: A real records session — create, edit, filter, export
steps:
  - say: Start on the Data tab. Railbase opens it on your first collection.
    do: click
    on: { role: link, name: Data, first: true }
  - say: Pick the posts collection from the sidebar.
    do: click
    on: { text: posts, first: true }
    expect: { role: button, name: "+ New" }
  - say: Click New to open the create drawer over the grid.
    do: click
    on: { role: button, name: "+ New" }
    expect: { role: button, name: Create }
  - say: Give the post a title.
    do: fill
    on: { css: "[role=dialog] input[type=text]", nth: 0 }
    value: "Launching Railbase v1"
  - say: Add some body copy.
    do: fill
    on: { css: "[role=dialog] input[type=text]", nth: 1 }
    value: "Today we shipped the records grid — inline edit, filters, and CSV export."
  - say: Set its status to published.
    do: select
    on: { css: "[role=dialog] select" }
    value: published
  - say: And give it a view count.
    do: fill
    on: { css: "[role=dialog] input[type=number]" }
    value: "150"
  - say: Save. The drawer closes and the new row appears in the grid.
    do: click
    on: { role: button, name: Create }
    expect: { text: "Launching Railbase v1" }
  - say: You can also edit in place. Click the status cell on the draft row.
    do: click
    on: { text: draft, exact: true, first: true }
    expect: { css: "select:visible" }
  - say: Switch it to published — that change saves immediately.
    do: select
    on: { css: "select:visible" }
    value: published
  - say: Now filter the grid — show only published posts with more than a hundred views.
    do: fill
    on: { label: filter }
    value: "status='published' && views>100"
    expect: { text: "Launching Railbase v1" }
  - say: Finally, export the result. Export CSV runs as a background job and downloads when it's ready.
    do: click
    on: { role: button, name: Export CSV }
    minDwellSec: 2.5
```

![The Railbase admin data grid](/docs/rb-admin-data-admins.png "The records grid — filter, sort, bulk-select, and inline-edit. Shown here browsing the built-in `_admins` system collection.")

> [!NOTE]
> Auth collections (like `users`) are read-only in the generic grid — manage them
> from the [Users](users-and-access) screen, which understands accounts.

## Import & export

- **Import** — CSV, TSV, and XLSX. Pick a file, map columns to fields (required
  fields are flagged), preview the first rows, then run an async import with a
  progress bar and a per-row error report.
- **Export** — export a collection to **CSV**. It runs as a background job and
  downloads when ready (handles large collections without timing out).

## System tables

The Data sidebar has a **System** group exposing the internal collections —
`_users`, `_admins`, `_sessions`, `_api_tokens`, `_jobs` — so you can inspect
sessions, jobs, and tokens directly when debugging.
