Access to database in migration
See original GitHub issueIn our project we used migrations in environment with data which we don’t want to lose. Actually we are forced to use some compression directly on model. I created migration where I connect to database and, using SqlClient etc., get, transform and save data.
Connection string is saved in config.json file. We also used another config file depend on environment.
Is it any possibility to access to connection string from migration or just to environment specified by -e
switch in dotnet ef cli?
EF Core version: 1.0.0 Database Provider: Microsoft.EntityFrameworkCore.SqlServer
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Migrate an Access database to SQL Server
Microsoft provides Microsoft SQL Server Migration Assistant (SSMA) to make migration easier. SSMA mainly migrates tables and select queries with no parameters.
Read more >MS Access Database to SQL Server Migration in 6 Steps
To migrate some particular tables, Open the database, expand Tables, and then click on the check boxes next to the tables to transfer...
Read more >Migrating from MS Access to SQL Server Made Easy 101
Right-click the database you wish to migrate in Access Metadata Explorer and choose Migrate Data. Note that if you want to migrate the...
Read more >Migrate or Convert Access to SQL Server: Step-by-Step Process
How To Convert Access To SQL Server? · Step 1: Technical Discovery · Step 2: Microsoft SQL Server Migration Assistant (SSMA) Execution ·...
Read more >Migrating a Microsoft Access Database to SQL Server
Microsoft provides a handy tool called the “Microsoft SQL Server Migration Assistant for MS Access” (SSMA) to assist in moving the database tables...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Actually you can access your
dbContext
in a migration, see: https://stackoverflow.com/questions/42644253/can-i-inject-dependency-into-migration-using-ef-core-code-first-migrations Once you have your dbContext, you can probably access the connection-string through:(I actually use this to add new (non-seeding) data in a separate migration. However, be very careful when changing data this way. Your
_dbContext.Save
is executed before any (other) migrations are run.)One alternative would be to do this while the migrations are applying in your application: