revisium
v2.0.0
Published
A CLI tool for interacting with Revisium instances, providing migration management, schema export, and data export capabilities.
Readme
Revisium CLI
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 --helpExamples
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://cloud.revisium.io/myorg/myproject/master?token=$TOKEN
# 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/masterAdd 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/masterSync (Direct Transfer)
┌─────────────┐ ┌─────────────┐
│ SOURCE │ schema + data │ TARGET │
│ Revisium │ ════════════════════▶ │ Revisium │
│ │ (direct) │ :draft │
└─────────────┘ └─────────────┘Synchronize directly between two projects without intermediate files:
revisium sync all \
--source revisium://source.example.com/org/proj/master:head?token=xxx \
--target revisium://target.example.com/org/proj?token=yyy \
--commitCommands
| 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:
REVISIUM_URL=revisium://cloud.revisium.io/your_org/your_project/main
REVISIUM_USERNAME=your_username
REVISIUM_PASSWORD=your_passwordOr use command-line options with URL:
revisium schema save --folder ./schemas \
--url revisium://cloud.revisium.io/my-org/my-project/develop?token=$TOKENSee Configuration and URL Format for details.
Documentation
- Configuration - Environment variables and .env files
- URL Format - Revisium URL syntax
- Authentication - Token, API key, and password auth
- Schema Commands - schema save, create-migrations
- Migrate Commands - migrate save, apply
- Rows Commands - rows save, upload
- Sync Commands - sync schema, data, all
- Docker Deployment - Docker, Kubernetes, CI/CD
Development
git clone https://github.com/revisium/revisium-cli.git
cd revisium-cli
npm install
npm run buildLicense
MIT License - see LICENSE file for details.
