Closed frankyjquintero closed 2 years ago
@iammukeshm
For Oracle migrations the schema will be totally different due to its behavior (Schema is user), in addition to having to be refactored and replaced by capital letters because Oracle.EntityFrameworkCore when performing the validation will look for the user under query to the engine users table .
Based on this implementation, a user called IDENTITY should be created and later the user "FULLSTACK" that will be used for the standard tables.
The previous change will force to create new migrations for the other database providers (or modify the existing ones)
I leave a repository link where the migrations for Oracle are initially implemented:
https://github.com/frankyjquintero/dotnet-webapi-boilerplate
Steps to verify migrations running perfectly:
Install Docker
register and pull image of Oracle:
https://hub.docker.com/_/oracle-database-enterprise-edition
docker run -d -it --name oracle -p 49154:1521 store/oracle/database-enterprise:12.2.0.1
by default it has the following pdb
ORCLCDB = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = 127.0.0.1) (PORT = 49154))
(CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ORCLCDB.localdomain)))
ORCLPDB1 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = 127.0.0.1) (PORT = 49154))
(CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ORCLPDB1.localdomain)))
sqlplus sys /Oradoc_db1@ORCLCDB as sysdba
or
create user Identity identified by password123;
grant connect to Identity;
grant all privileges to Identity identified by password123;
create user fullstack identified by password123;
grant connect to fullstack;
grant all privileges to fullstack identified by password123;
{
"DatabaseSettings": {
"DBProvider": "oracle",
"ConnectionString": "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=49154))(CONNECT_DATA =(SERVER=DEDICATED)(SERVICE_NAME=ORCLPDB1.localdomain)));User Id=fullstack;Password=password123"
}
}
dotnet ef migrations add initial --project .././Migrators/Migrators.Oracle/ --context TenantManagementDbContext -o Migrations / Root
dotnet ef migrations add initial --project .././Migrators/Migrators.Oracle/ --context ApplicationDbContext -o Migrations / Application
When i dotnet run the WebAPI and when Applying Root Migrations, i am getting this error Oracle.ManagedDataAccess.Client.OracleException (0x80004005): ORA-01435: user does not exist.......
Hi, Oracle is a bit different world ... In that world this is a generic errors, this one of them.. Check documentation please. And good luck with locks
https://support.oracle.com/knowledge/Oracle%20Cloud/2718606_1.html
Is your feature request related to a problem? Please describe. Establish a support for Oracle in the route design as soon as the version compatible with .Net 6 is released by oracle
Describe the solution you'd like
Generation of migrations with Oracle support
Describe alternatives you've considered none
Additional context
https://medium.com/oracledevs/oracle-support-for-net-6-and-entity-framework-core-6-statement-of-direction-cfa5d1c59ff8
https://www.nuget.org/packages/Oracle.EntityFrameworkCore/