Evolve Database Migration Tool
repository·master·Indexed 20 days ago
https://github.com/lecaillon/evolveA cross-platform database migration tool that uses plain SQL scripts to automate schema changes. Evolve supports SQL Server, PostgreSQL, MySQL, MariaDB, SQLite, Cassandra, and CockroachDB. It is available as a .NET library, a .NET global tool, and a standalone CLI, making it suitable for CI/CD workflows. The CLI provides commands to migrate, erase, repair, validate, and view info regarding database schema evolutions.
What's inside Evolve
- Evolve is a cross-platform database migration tool inspired by Flyway. It uses plain SQL scripts to automate database changes, helping keep schemas synchronized across different environments and development teams. It is designed for simplicity and is suitable for continuous integration and delivery (CI/CD) pipelines.
Install Evolve
masterEvolve can be integrated into your workflow in three different ways depending on your needs:
- .NET Library: Use the
EvolveNuGet package to embed migrations directly into your .NET applications. - .NET Tool: Use the
Evolve.ToolNuGet package to run Evolve as a .NET global tool. - Standalone CLI: Download the pre-compiled CLI from the GitHub Releases page for use in any environment.
- .NET Library: Use the
Use the Evolve CLI to manage database migrations
masterThe Evolve CLI allows you to manage database schema evolutions using various commands. The basic syntax requires a command, a database type, and a connection string.
Available Commands:
migrate: Apply pending migrations.erase: Erase the database schemas (use with caution).repair: Repair the migration state.info: Show information about the current state.validate: Validate the migration scripts.
Supported Databases:
postgresqlsqlitesqlservermysqlmariadbcassandracockroachdb
Basic Usage Example:
evolve migrate postgresql --connection-string "Host=myhost;Database=mydb;Username=user;Password=pass" --location ./migrationsevolve migrate postgresql --connection-string "Host=myhost;Database=mydb;Username=user;Password=pass" --location ./migrationsSupported databases for Evolve
masterEvolve is a cross-platform migration tool that uses plain SQL scripts. It supports the following database engines:
- SQL Server
- PostgreSQL
- MySQL
- MariaDB
- SQLite
- Cassandra
- CockroachDB
Reference: Evolve CLI Arguments and Options
masterThe following table lists the arguments and options available to the Evolve CLI. Note that some options are specific to certain database engines (e.g., Cassandra or SQL Server).
Arguments
Argument Description Required Allowed Values CommandThe action to perform Yes migrate,erase,repair,info,validateDatabaseThe target database engine Yes postgresql,sqlite,sqlserver,mysql,mariadb,cassandra,cockroachdbGlobal Options
Option Description Default -c,--connection-stringConnection string to the target database engine. (Required) -l,--locationPaths to scan recursively for migration scripts. Sql_Scripts-s,--schemaA list of schemas managed by Evolve. (Connection default) --metadata-table-schemaThe schema in which the metadata table is/should be. (First schema or connection default) --metadata-tableThe name of the metadata table. changelog-p,--placeholderPlaceholders for replacement in scripts (format: key:value).None --placeholder-prefixPrefix of the placeholders. ${--placeholder-suffixSuffix of the placeholders. }--target-versionTarget version to reach. None --start-versionVersion used as starting point for existing databases. 0--scripts-prefixMigration scripts file names prefix. V--repeatable-scripts-prefixRepeatable migration scripts file names prefix. R--scripts-suffixMigration scripts files extension. .sql--scripts-separatorMigration scripts file names separator. __--encodingEncoding of migration scripts. UTF-8--command-timeoutWait time in seconds before terminating a migration attempt. 30--ambient-tx-timeoutWait time in seconds before terminating an ambient transaction. 60--out-of-orderAllows migration scripts to be run “out of order”. false--erase-disabledEnsures Evolve will never erase schemas (recommended for production). false--erase-on-validation-errorErases database and re-executes from scratch if validation fails (dev only). false--enable-cluster-modeUses a session level lock to coordinate migrations on multiple nodes. true-a,--embedded-resource-assemblyAssemblies to scan for embedded migration scripts. None -f,--embedded-resource-filterExclude embedded scripts that do not start with these filters. None --retry-repeatableExecute repeatable migrations repeatedly until no errors occur. false--transaction-modeScope of the Evolve transaction. CommitEach,CommitAll,RollbackAll--skip-next-migrationsMark all subsequent migrations as applied. falseDatabase Specific Options
Cassandra:
--keyspace: List of keyspaces managed by Evolve.--metadata-table-keyspace: The keyspace for the metadata table.
SQL Server:
--sql-server-access-token: An Azure-issued access token for connection.