Skip to main content

Supported databases


SQL Server

If you don't find a desired database, you can contribute and add support by yourself.

PostgreSQL​

Installation​

dotnet add package Curiosus.Migrations.PostgreSQL

Configuration​

// Configure the migration engine for PostgreSQL
var builder = new MigrationEngineBuilder(services)
.UseScriptMigrations().FromDirectory("./Migrations")
.UseCodeMigrations().FromAssembly(Assembly.GetExecutingAssembly())
.ConfigureForPostgreSql("Host=localhost;Database=myapp;Username=postgres;Password=secret")
.UseUpgradeMigrationPolicy(MigrationPolicy.AllAllowed);

var migrationEngine = builder.Build();

Options​

OptionDescriptionDefault
connectionStringPostgreSQL connection stringrequired
migrationTableHistoryNameName of the table to store migration historymigration_history
databaseEncodingCharacter set encoding for new databasetemplate database encoding
lcCollateCollation order (LC_COLLATE) for new databasetemplate database value
lcCtypeCharacter classification (LC_CTYPE) for new databasetemplate database value
connectionLimitMax concurrent connections to databaseDB default (-1, no limit)
templateTemplate database name for new database creationtemplate1
tableSpaceDefault tablespace for the new databaseDB default

SQL Server​

Installation​

dotnet add package Curiosus.Migrations.SqlServer

Configuration​

// Configure the migration engine for SQL Server
var builder = new MigrationEngineBuilder(services)
.UseScriptMigrations().FromDirectory("./Migrations")
.UseCodeMigrations().FromAssembly(Assembly.GetExecutingAssembly())
.ConfigureForSqlServer("Server=localhost;Database=myapp;User Id=sa;Password=YourStrong@Passw0rd;")
.UseUpgradeMigrationPolicy(MigrationPolicy.AllAllowed);

var migrationEngine = builder.Build();

Options​

OptionDescriptionDefault
connectionStringSQL Server connection stringrequired
migrationHistoryTableNameName of table to store migration historymigration_history
schemaNameSchema name for migration history tabledefault user schema (typically dbo)
defaultDatabaseDatabase to connect when target database does not existmaster
allowSnapshotIsolationWhether to enable snapshot isolationfalse
readCommittedSnapshotWhether to enable read committed snapshotfalse
collationDatabase collationserver default
dataFilePathPath to data fileSQL Server default
logFilePathPath to log fileSQL Server default
initialSizeInitial size of database (MB)SQL Server default
maxSizeMaximum size of database (MB)SQL Server default
fileGrowthFile growth increment (MB)SQL Server default