Home
Do you know the best tools for Database Schema Update?
  v9.0 Posted at 31/07/2019 12:05 PM by Tiago Araujo

It is important when deploying your database for the database to be updated automatically.​​​

There are a number of tools that can be used to update the database as the application can be updated.

Legacy full framework

Bad options for updating database schema - No ability to validate that the database hasn't been tampered with 

  • SQL Management Studio + OSQL  (Free and roll your own)
  • Visual Studio 2017 + SQL Server Data Tools  (Formerly Data Dude) + Deploy (post-development model)
  • Red Gate SQL Compare + Red Gate SQL Packager (post-development model)
Figure: Don't use Data Dude

public partial class GenderToString : DbMigration
{
public override void Up()
{
AddColumn("dbo.Customers", "GenderTemp", c => c.Boolean(nullable: false));
Sql("UPDATE [dbo].[Customers] set GenderTemp = Gender");
DropColumn("dbo.Customers", "Gender");
AddColumn("dbo.Customers", "Gender", c => c.String(maxLength: 2));
Sql("UPDATE [dbo].[Customers] set Gender = 'M' where GenderTemp=1");
Sql("UPDATE [dbo].[Customers] set Gender = 'F' where GenderTemp=0");
DropColumn("dbo.Customers", "GenderTemp");
}

​Good Example - Data motion with EF Migrations

Related Rule​​

Related rules

    Do you feel this rule needs an update?

    If you want to be notified when this rule is updated, please enter your email address:

    Comments: