atlas-ef 0.3.1

dotnet tool install --global atlas-ef --version 0.3.1
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local atlas-ef --version 0.3.1
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=atlas-ef&version=0.3.1
                    
nuke :add-package atlas-ef --version 0.3.1
                    

Atlas Provider for EF Core

AtlasEF NuGet Package

Use Atlas with Entity Framework Core to manage your database schema as code. By connecting your EF Core models to Atlas, you can define and edit your schema directly in C#. Atlas will then automatically plan and apply database schema migrations for you, eliminating the need to write migrations manually.

Atlas brings automated CI/CD workflows to your database, along with built-in support for testing, linting, schema drift detection, and schema monitoring. It also allows you to extend EF Core with advanced database objects such as triggers, row-level security, and custom functions that are not supported natively.

Use-cases

  1. Declarative migrations - Use the Terraform-like atlas schema apply --env ef command to apply your EF Core schema to the database.
  2. Automatic migration planning - Use atlas migrate diff --env ef to automatically plan database schema changes and generate a migration from the current database version to the desired version defined by your EF Core schema.

Installation

Windows:

Use PowerShell to download the file:

Invoke-WebRequest https://release.ariga.io/atlas/atlas-windows-amd64-latest.exe -OutFile atlas.exe

Then move the atlas binary to a directory that is included in your system PATH. If you prefer a different directory, you can add it to your system PATH by editing the environment variables.

macOS + Linux:

curl -sSf https://atlasgo.sh | sh

See atlasgo.io for more installation options.

AtlasEF Package

Make sure to have a tool manifest available in your repository or create one using the following command:

dotnet new tool-manifest

Install the AtlasEF package from the command line:

dotnet tool install atlas-ef

Let's check if the tool is installed correctly:

dotnet atlas-ef --version

Configuration

By default, this tool will scan for implementation of the DbContext class in the current project and will generate a database schema based on it.

This tool does not require a database connection, but it does need Database Providers restored.

Setup Atlas

In your project directory, create a new file named atlas.hcl with the following contents:

data "external_schema" "ef" {
  program = [
    "dotnet",
    "atlas-ef",
  ]
}

env {
  name = atlas.env
  src = data.external_schema.ef.url
  dev = "docker://mysql/8/dev" # list of dev dbs can be found here: https://atlasgo.io/concepts/dev-database
  migration {
    dir = "file://atlas-migrations"
  }
  format {
    migrate {
      diff = "{{ sql . \"  \" }}"
    }
  }
}

Usage

Once you have the provider tool and Atlas configured, you can use them to manage your database schema.

Apply

You can use the atlas schema apply command to plan and apply a migration on your database from your current EF schema. This works by inspecting the target database schema and comparing it to the EF schema, creating a migration plan. Atlas will prompt you to confirm the migration plan before applying it to the database.

atlas schema apply --env ef -u "mysql://root:password@localhost:3306/mydb"

The -u flag accepts the URL to the target database.

Diff

Atlas supports a versioned migration workflow, where each change to the database is versioned and recorded in a migration file. You can use the atlas migrate diff command to automatically generate a migration file that will migrate the database from its latest revision to the current EF schema.

atlas migrate diff --env ef 

Supported Databases

The provider supports the following databases:

  • SQL Server
  • MySQL
  • PostgreSQL
  • SQLite

Docs

To learn more about the EF Core integration, check out the documentation.

License

This project is licensed under the Apache License 2.0.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last Updated
0.3.1 302 10/21/2025
0.3.0 883 6/12/2025
0.2.0 521 8/8/2024
0.1.0 145 8/5/2024
0.0.2 140 8/5/2024