37 lines
976 B
C#
37 lines
976 B
C#
namespace EgtBEAMWALL.DataLayer.Migrations
|
|
{
|
|
using Mysqlx.Crud;
|
|
using System;
|
|
using System.Data.Entity.Migrations;
|
|
using System.IO;
|
|
using System.Reflection;
|
|
|
|
public partial class AddStoredProc01 : DbMigration
|
|
{
|
|
public override void Up()
|
|
{
|
|
// aggiunta stored
|
|
addStored("stp_LogMachineFixPid");
|
|
}
|
|
|
|
public override void Down()
|
|
{
|
|
// rimozione stored
|
|
remStored("stp_LogMachineFixPid");
|
|
}
|
|
|
|
private void addStored(string objName)
|
|
{
|
|
string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "SqlScripts", "Stored", $"{objName}.sql");
|
|
string sqlBody = File.ReadAllText(path);
|
|
Sql(sqlBody);
|
|
}
|
|
|
|
private void remStored(string objName)
|
|
{
|
|
string sqlBody = $"DROP PROCEDURE IF EXISTS {objName};";
|
|
Sql(sqlBody);
|
|
}
|
|
}
|
|
}
|