Database Sync

Pull and push databases as local CSV files.

Sync your LumifyHub databases to your local machine as YAML schema + CSV data files. Edit databases in any spreadsheet app or text editor, then push changes back to the cloud.

Overview

When you run lh db pull, each database is saved as:

~/.lumifyhub/databases/{workspace}/{database}/
├── schema.yaml    # Database structure (properties, settings)
└── data.csv       # Row data (editable!)

Commands

Pull Databases

Download databases from LumifyHub to your local machine.

# Pull all databases from all workspaces
lh db pull

# Pull from a specific workspace
lh db pull -w my-workspace

# Pull a specific database by name
lh db pull project-tasks

# Force overwrite local changes
lh db pull --force

Push Changes

Upload local changes back to LumifyHub.

# Push all modified databases
lh db push

# Push from a specific workspace
lh db push -w my-workspace

# Push a specific database
lh db push project-tasks

Check Status

See which databases have local modifications.

lh db status

Output shows:

  • synced - No local changes
  • modified - Local changes ready to push

List Databases

View all locally synced databases.

lh db list

File Format

schema.yaml

Contains the database structure:

id: "abc123"
title: "Project Tasks"
workspace_id: "ws-456"
workspace_slug: "my-workspace"
slug: "project-tasks-abc123"
updated_at: "2025-01-30T10:00:00Z"
local_hash: "a1b2c3d4"
remote_hash: "a1b2c3d4"

data_sources:
  - id: "ds-789"
    name: "Main"
    sort_order: 0

properties:
  - property_id: "prop_status"
    property_name: "Status"
    property_type: "select"
    data_source_id: "ds-789"
    sort_order: 0
    config: {"options": [{"id": "opt_1", "name": "To Do"}, {"id": "opt_2", "name": "Done"}]}

data.csv

Contains the actual row data:

_id,_title,_data_source_id,prop_status,prop_due
row-1,Fix login bug,ds-789,opt_1,2025-02-01
row-2,Add dark mode,ds-789,opt_2,
row-3,Write docs,ds-789,opt_1,2025-02-15

Special columns:

  • _id - Row identifier (don't change this)
  • _title - Row title
  • _data_source_id - Data source the row belongs to

Editing Data

Using a Spreadsheet

  1. Open data.csv in Excel, Google Sheets, or Numbers
  2. Edit cells as needed
  3. Save the file
  4. Run lh db push

Using a Text Editor

The CSV format is simple enough to edit directly:

_id,_title,_data_source_id,prop_status
row-1,Updated task name,ds-789,opt_2

Adding New Rows

Add a new line to the CSV. Use a temporary ID starting with new_:

new_1,My new task,ds-789,opt_1

The server will assign a real ID when you push.

Deleting Rows

Remove the line from the CSV file. When you push, the row will be deleted from LumifyHub.

Conflict Handling

If you have local changes and try to pull:

$ lh db pull
  Conflict: my-workspace/project-tasks
    Use --force to overwrite local changes

Options:

  1. Push your changes first: lh db push
  2. Discard local changes: lh db pull --force

Git Integration

The CLI automatically commits changes to a local git repo after pull/push operations. This gives you:

  • History of all changes
  • Ability to revert mistakes
  • Sync across machines via git

Tips

Batch Edits

Need to update many rows? Edit the CSV directly - it's much faster than clicking through the UI.

Backup Before Changes

The automatic git commits mean you can always revert:

cd ~/.lumifyhub/databases
git log --oneline
git checkout HEAD~1 -- my-workspace/project-tasks/

Automation

Use the CLI in scripts to automate data updates:

#!/bin/bash
lh db pull -w my-workspace
# ... modify CSV files with sed/awk/python ...
lh db push -w my-workspace