Clear ORM
  • Welcome to Clear
  • Introduction
    • Setup
  • Model
    • Defining your model
      • Describing your columns
      • Primary Keys
      • Converters
    • Associations
      • belongs_to
      • has_many
      • has_many through
      • has_one
    • Lifecycle
      • Persistence
      • Validations
      • Triggers
    • Batchs operations
      • Bulk update
      • Bulk insert & delete
    • Transactions & Save Points
      • Transaction & Savepoints
      • Connection pool
    • Locks
  • Querying
    • The collection object
      • Filter the query
        • Filter the query – The Expression Engine
        • Find, First, Last, Offset, Limit
        • Aggregation
        • Ordering & Group by
      • Fetching the query
        • Each and Fetch
        • Cursored fetching
        • Model extra attributes
      • Joins
      • Eager Loading
      • Window and CTE
      • Scopes
    • Writing low-level SQL
      • Select Clause
      • Insert Clause
      • Delete Clause
  • Migrations
    • Manage migrations
    • Call migration script
    • Migration CLI
  • Additional and advanced features
    • JSONB
    • Symbol vs String
    • Enums
    • BCrypt
    • Full Text Search
    • Handling multi-connection
  • Other resources
    • API Documentation
    • Inline documentation
    • Github repository
    • Credits
    • Benchmark
Powered by GitBook
On this page
  • Available Commands
  • Generators
  • Migration
  1. Migrations

Migration CLI

Available Commands

There are a few commands that makes it a more enjoyable experience to your everyday usage of Clear ORM.

Generators

The model and scaffold generators will create migrations appropriate for adding a new model. Clear ORM provides a consice DSL for defining migrations, but these can also be generated via the CLI.

Usage:
  clear generate [flags...] [arg...]

Generate code automatically

Flags:
  --help         # Displays help for the current command.
  --no-color     # Cancel color output
  --verbose, -v  # Display verbose informations during execution

Subcommands:
  migration      # Generate a new migration
  model          # Create a new model and the first migration
  new:kemal      # Create a new project with Kemal

Migration

Migrations are a convenient way to alter the database schema over time in a consistent and easy way. Clear ORM provides a beautiful DSL so that you don't have to write SQL by hand, allowing your schema and changes to be database independent.

Usage:
  clear migrate [flags...] [arg...]

Manage migration state of your database

Flags:
  --help         # Displays help for the current command.
  --no-color     # Cancel color output
  --verbose, -v  # Display verbose informations during execution

Subcommands:
  down           # Downgrade your database to a specific migration version
  migrate
  rollback       # Rollback the last up migration
  seed           # Call the seeds data
  set
  status         # Return the current state of the database
  up             # Upgrade your database to a specific migration version
PreviousCall migration scriptNextJSONB

Last updated 5 years ago