Can Script-Migration create script for Oracle?

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
mikep
Posts: 4
Joined: Wed 22 Aug 2018 11:11

Can Script-Migration create script for Oracle?

Post by mikep » Thu 27 Sep 2018 19:11

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.

Shalex
Site Admin
Posts: 8597
Joined: Thu 14 Aug 2008 12:44

Re: Can Script-Migration create script for Oracle?

Post by Shalex » Fri 28 Sep 2018 13:21

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.

mikep
Posts: 4
Joined: Wed 22 Aug 2018 11:11

Re: Can Script-Migration create script for Oracle?

Post by mikep » Fri 28 Sep 2018 16:09

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.

Post Reply