Page 1 of 1

Can Script-Migration create script for Oracle?

Posted: Thu 27 Sep 2018 19:11
by mikep
I'm using dotConnect Oracle and EF Core 2 Code First Migrations. If I use Update-Database, migrations are applied correctly to the database. However, if I use Script-Migration, the generated SQL is for SQL Server, not Oracle. For example:

Code: Select all

IF OBJECT_ID(N'[__EFMigrationsHistory]') IS NULL
BEGIN
    CREATE TABLE [__EFMigrationsHistory] (
        [MigrationId] nvarchar(150) NOT NULL,
        [ProductVersion] nvarchar(32) NOT NULL,
        CONSTRAINT [PK___EFMigrationsHistory] PRIMARY KEY ([MigrationId])
    );
END;
and

Code: Select all

SET IDENTITY_INSERT [Lookup] OFF;
How can I script the migration for Oracle?

Thanks.

Re: Can Script-Migration create script for Oracle?

Posted: Fri 28 Sep 2018 13:21
by Shalex
Have you configured your context to connect to an Oracle database via .UseOracle() ?

If this doesn't help, upload a simple test project to some file exchange server and send us the download link.

Re: Can Script-Migration create script for Oracle?

Posted: Fri 28 Sep 2018 16:09
by mikep
Yes. Just double-checked my code and I figured it out. I switch between SQL Server and Oracle and the switch statement didn't have a case for a new target environment.

Thanks.