Files
infisical/docs/self-hosting/deployment-options/native/linux-package/migration.mdx

31 lines
1.7 KiB
Plaintext

---
title: "Migration"
description: "Learn how to run migration using Infisical linux package."
---
By default, migrations automatically run each time you execute `infisical-ctl reconfigure`. This behavior may not be desirable when deploying with horizontal scaling.
## Disable Auto Migration
To disable automatic migrations, add the following configuration to your `infisical.rb` file:
```ruby
infisical_core['auto_migration'] = false
```
## Migration Commands
`infisical-ctl` provides several commands to manage database migrations. You can run these commands in two ways:
- Provide the PostgreSQL database connection as an environment variable, or
- Let the system load the connection details from the Infisical application after reconfiguration
| Command | Description |
| ---------------------------------- | --------------------------------------------------------------------------- |
| `infisical-ctl migration up` | Runs the next migration that hasn't been applied yet |
| `infisical-ctl migration down` | Reverts the most recent migration, undoing its changes |
| `infisical-ctl migration list` | Lists all available migration files without applying them |
| `infisical-ctl migration status` | Displays the status of each migration, showing which have been applied |
| `infisical-ctl migration latest` | Applies all pending migrations to bring the database up to date |
| `infisical-ctl migration rollback` | Reverts all applied migrations, returning the database to its initial state |