Is there something like ActiveRecord :: Migration for.NET?

I played with the ruby ​​on rails class ActiveRecord::Migration and I like how easy it is to maintain database versions. I want to do something like this in my ASP.NET project, and I wonder if anyone has heard of what ActiveRecord::Migration does, but for .NET.

I don’t see the need to define my SQL scripts in C # or ruby ​​code, I just want to write SQL. But is there a tool that manages SQL scripts and keeps track of which scripts you need for synchronization?

+4
source share
4 answers

migratordotnet is a database version control system similar to Ruby on Rail Migrations. Its goal is to automate database changes and help keep these changes in sync in your environment.

+3
source

Here's one that focuses on cross-database compatibility: https://github.com/dradovic/MigSharp/wiki/Feature-Overview

Write your migration once and let them work on different platforms.

+3
source

Database projects in Visual Studio have the features you need. You can compare schemas to track differences between schema versions. They can also handle deployment, although your deployment needs may vary.

@MSDN Database Projects

There are other third-party tools that can be used, such as SQL Compare by Redgate.

SQL Compare by Redgate

Added:

Unfortunately, none of them have built-in support for git. But that would not stop you from overcoming this gap if you don't mind doing most of the work yourself.

With Visual Studio, you can use MSBuild to automatically run scripts / executables related to compilation actions. From there, you can attach your own interactions using git.

MSBuild Reference @MSDN

If you are looking for a tool that can automatically deploy a schema change from git, I do not know any existing at this time; but you can roll on your own using SMO. It has all the functions necessary for scripting SQL Server objects and scripting for SQL Server. You may have to run your own incremental scripts to modify tables (as a security issue), but you can do drop / replace for many other objects that are not data (stored procedures, user-defined functions, etc.).

SQL Server @MSDN Management Objects

+1
source

Red Gate is considering a migration option that will integrate with SQL Source Control and SQL Compare. If you are interested, consider filling out our survey and letting us know what your requirements are. Filling out the survey will also give you the right to join our early access program.

http://www.surveymk.com/s/migrations

+1
source

Source: https://habr.com/ru/post/1342377/


All Articles