You can pass extra parameters to update-database
that allow to:
- Specify a different connection string
- Generate a SQL script that you can apply yourself to the target DB
Full syntax of Update-Database
:
Update-Database [-SourceMigration <String>] [-TargetMigration <String>]
[-Script] [-Force] [-ProjectName <String>] [-StartUpProjectName <String>]
[-ConfigurationTypeName <String>] [-ConnectionStringName <String>]
[<CommonParameters>]
Update-Database [-SourceMigration <String>] [-TargetMigration <String>]
[-Script] [-Force] [-ProjectName <String>] [-StartUpProjectName <String>]
[-ConfigurationTypeName <String>] -ConnectionString <String>
-ConnectionProviderName <String> [<CommonParameters>]
To specify a connection string (which points to the correct folder in your project):
-StartUpProjectName
and-ConnectionStringName
, to specify a project that contains a .config file with a connection string with the provided name (1st syntax)-ConnectionString
, to specify directly the connection string (2nd syntax)
To create a SQL script that you can apply directly to the DB using other tool:
-SourceMigration
: current migration in the destination DB-TargetMigration
: migration to update to, and-Script
: to generate a script taht you can apply by hand