Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EF Migrarions: How to select the appsettings.env.json for the appropriate database connection string #1273

Closed
fpiazza99 opened this issue Feb 7, 2019 · 5 comments

Comments

@fpiazza99
Copy link

fpiazza99 commented Feb 7, 2019

We have a Dev, Stage, Prod setup and would like to target only the environment being deployed during a EF Migration/Database-Update/"dotnet ef database update". We store each environments connection string in the environment specific appsettings.ENV.json config file. So how do we direct "dotnet ef database update" to use a specific environment?


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

@fpiazza99 fpiazza99 changed the title How to select the appsettings.env.json for the appropriate database connection string EF Migrarions: How to select the appsettings.env.json for the appropriate database connection string Feb 10, 2019
Copy link

I would also like to know how to update the database with a custom connection string please!

@bricelam
Copy link
Contributor

bricelam commented Mar 20, 2019

set ASPNETCORE_ENVIRONMENT=Stage
dotnet ef database update

@bricelam
Copy link
Contributor

See also dotnet/efcore#10750

Copy link

Setting the ASPNETCORE_ENVIRONMENT environment variable seems to have no affect for me.

Here's the command I used (in powershell)

$env:ASPNETCORE_ENVIRONMENT='Development'
dotnet ef database update -p FrontEnd.DataAccess -s FrontEnd.Api --no-build

@ajcvickers
Copy link
Contributor

Duplicate of #1050

@ajcvickers ajcvickers marked this as a duplicate of #1050 Sep 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants