Skip to content

revisium/revisium-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Revisium CLI

Quality Gate Status codecov Bugs GitHub License GitHub Release

Command-line interface for managing Revisium projects

Overview

A CLI tool for interacting with Revisium instances, providing migration management, schema export, data export, and project synchronization capabilities.

Features

  • Migration Management - Save and apply database migrations with auto-commit
  • Schema Export/Import - Export table schemas and convert to migrations
  • Data Export/Upload - Export and upload rows with smart dependency handling
  • Project Sync - Synchronize schema and data between Revisium projects
  • Bulk Operations - Efficient batch operations with configurable batch size
  • Docker Deployment - Containerized automation for CI/CD

Installation

# Install globally
npm install -g revisium

# Or use with npx
npx revisium --help

Examples

CI/CD Migrations (Prisma-like Workflow)

┌─────────────┐      ┌─────────────┐      ┌─────────────┐
│    DEV      │      │    GIT      │      │   CI/CD     │
│             │      │             │      │             │
│  Revisium   │ save │ migrations  │ push │   apply     │
│    UI       │─────▶│   .json     │─────▶│  migrations │
│             │      │   data/     │      │   + seed    │
└─────────────┘      └─────────────┘      └─────────────┘

Like Prisma, save schema migrations locally and apply them in CI/CD:

# 1. Save migrations locally (during development)
revisium migrate save --file ./revisium/migrations.json \
  --url revisium://admin:admin@localhost:8080/myorg/myproject/master

# 2. Commit to git
git add revisium/migrations.json
git commit -m "Add new schema fields"

# 3. Apply in CI/CD (on deploy)
revisium migrate apply --file ./revisium/migrations.json --commit \
  --url revisium://cloud.revisium.io/myorg/myproject/master

Add to package.json scripts:

{
  "scripts": {
    "revisium:save-migrations": "revisium migrate save --file ./revisium/migrations.json",
    "revisium:apply-migrations": "revisium migrate apply --file ./revisium/migrations.json --commit",
    "start:prod": "npm run revisium:apply-migrations && node dist/main"
  }
}

See Docker Deployment for complete CI/CD examples.

Export & Import (File-based)

┌─────────────┐                          ┌─────────────┐
│   SOURCE    │    migrations.json       │   TARGET    │
│  Revisium   │ ────────────────────▶    │  Revisium   │
│             │        data/             │             │
└─────────────┘                          └─────────────┘

Save project to files for backup or deployment to another instance:

# Export from source
revisium migrate save --file ./migrations.json
revisium rows save --folder ./data

# Import to target
revisium migrate apply --file ./migrations.json --commit \
  --url revisium://target.example.com/org/proj/main
revisium rows upload --folder ./data --commit \
  --url revisium://target.example.com/org/proj/master

Sync (Direct Transfer)

┌─────────────┐                          ┌─────────────┐
│   SOURCE    │    schema + data         │   TARGET    │
│  Revisium   │ ════════════════════▶    │  Revisium   │
│             │       (direct)           │   :draft    │
└─────────────┘                          └─────────────┘

Synchronize directly between two projects without intermediate files:

# With tokens in URL
revisium sync all \
  --source revisium://source.example.com/org/proj/master:head?token=xxx \
  --target revisium://target.example.com/org/proj/master?token=yyy \
  --commit

# With tokens via environment (recommended for CI/CD)
export REVISIUM_SOURCE_TOKEN=$SOURCE_TOKEN
export REVISIUM_TARGET_TOKEN=$TARGET_TOKEN
revisium sync all \
  --source revisium://source.example.com/org/proj/master:head \
  --target revisium://target.example.com/org/proj/master \
  --commit

Commands

Command Description Documentation
schema save Export table schemas to JSON files Schema Commands
schema create-migrations Convert schemas to migration format Schema Commands
migrate save Export migrations to JSON file Migrate Commands
migrate apply Apply migrations from JSON file Migrate Commands
rows save Export table data to JSON files Rows Commands
rows upload Upload table data from JSON files Rows Commands
sync schema Sync schema between projects Sync Commands
sync data Sync data between projects Sync Commands
sync all Full sync (schema + data) Sync Commands

Configuration

Configure via environment variables or .env file:

# Recommended: URL + Token
REVISIUM_URL=revisium://cloud.revisium.io/your_org/your_project/main
REVISIUM_TOKEN=your_jwt_token

# Alternative: URL + Username/Password
REVISIUM_URL=revisium://cloud.revisium.io/your_org/your_project/main
REVISIUM_USERNAME=your_username
REVISIUM_PASSWORD=your_password

Or use command-line --url option with credentials via environment:

# Token in environment, target in URL
export REVISIUM_TOKEN=$MY_TOKEN
revisium schema save --folder ./schemas \
  --url revisium://cloud.revisium.io/my-org/my-project/develop

# Token in URL query parameter
revisium schema save --folder ./schemas \
  --url revisium://cloud.revisium.io/my-org/my-project/develop?token=$TOKEN

See Configuration and URL Format for details.

Documentation

Development

git clone https://github.com/revisium/revisium-cli.git
cd revisium-cli
npm install
npm run build

License

MIT License - see LICENSE file for details.

About

CLI for managing Revisium projects: migrations, data export/import, patches, and project sync.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors