I have a scenario where I deploy to different environments (development, testing and production), and each of these databases use different table name prefixes, along with different schema names.
Currently, in my CD pipeline I generate an idempotent script, and do string replacement on my 'variables' in my migration, however I'd like to utilize the dotnet ef database update
command which makes it tricky as all my past migrations have been generated with a variable name within their table names, etc.
Is it possible that I can read from an environment file what that variable is while creating my DbContext and map/replace/infer what the actual table prefixes are when running the command line?
Edit 1:
- To make matters a little more complicated, we're using an Oracle database
- When generating our migrations, we have assistive functions that grant access to certain database users to view the newly added tables. These users too have different names per environment.
- Reworking the users, table names, etc isn't in scope of this - I'm aware of the inefficiencies