GIT: perform LF normalization
This commit is contained in:
+24
-24
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
+24
-24
File diff suppressed because one or more lines are too long
@@ -1,25 +1,25 @@
|
||||
namespace Disco.Data.Migrations
|
||||
{
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class DBv1 : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
AddColumn("DocumentTemplates", "FlattenForm", c => c.Boolean(nullable: false, defaultValue: false));
|
||||
AddColumn("JobMetaNonWarranties", "AccountingChargeRequiredDate", c => c.DateTime());
|
||||
AddColumn("JobMetaNonWarranties", "AccountingChargeRequiredUserId", c => c.String(maxLength: 50));
|
||||
AddForeignKey("JobMetaNonWarranties", "AccountingChargeRequiredUserId", "Users", "Id");
|
||||
CreateIndex("JobMetaNonWarranties", "AccountingChargeRequiredUserId");
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
DropIndex("JobMetaNonWarranties", new[] { "AccountingChargeRequiredUserId" });
|
||||
DropForeignKey("JobMetaNonWarranties", "AccountingChargeRequiredUserId", "Users");
|
||||
DropColumn("JobMetaNonWarranties", "AccountingChargeRequiredUserId");
|
||||
DropColumn("JobMetaNonWarranties", "AccountingChargeRequiredDate");
|
||||
DropColumn("DocumentTemplates", "FlattenForm");
|
||||
}
|
||||
}
|
||||
}
|
||||
namespace Disco.Data.Migrations
|
||||
{
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class DBv1 : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
AddColumn("DocumentTemplates", "FlattenForm", c => c.Boolean(nullable: false, defaultValue: false));
|
||||
AddColumn("JobMetaNonWarranties", "AccountingChargeRequiredDate", c => c.DateTime());
|
||||
AddColumn("JobMetaNonWarranties", "AccountingChargeRequiredUserId", c => c.String(maxLength: 50));
|
||||
AddForeignKey("JobMetaNonWarranties", "AccountingChargeRequiredUserId", "Users", "Id");
|
||||
CreateIndex("JobMetaNonWarranties", "AccountingChargeRequiredUserId");
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
DropIndex("JobMetaNonWarranties", new[] { "AccountingChargeRequiredUserId" });
|
||||
DropForeignKey("JobMetaNonWarranties", "AccountingChargeRequiredUserId", "Users");
|
||||
DropColumn("JobMetaNonWarranties", "AccountingChargeRequiredUserId");
|
||||
DropColumn("JobMetaNonWarranties", "AccountingChargeRequiredDate");
|
||||
DropColumn("DocumentTemplates", "FlattenForm");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+24
-24
File diff suppressed because one or more lines are too long
@@ -1,17 +1,17 @@
|
||||
namespace Disco.Data.Migrations
|
||||
{
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class DBv2 : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
AddColumn("Jobs", "Flags", c => c.Long());
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
DropColumn("Jobs", "Flags");
|
||||
}
|
||||
}
|
||||
}
|
||||
namespace Disco.Data.Migrations
|
||||
{
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class DBv2 : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
AddColumn("Jobs", "Flags", c => c.Long());
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
DropColumn("Jobs", "Flags");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+24
-24
File diff suppressed because one or more lines are too long
@@ -1,30 +1,30 @@
|
||||
namespace Disco.Data.Migrations
|
||||
{
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class DBv3 : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
AddColumn("DeviceProfiles", "ComputerNameTemplate", c => c.String(nullable: true));
|
||||
Sql(@"UPDATE DeviceProfiles SET ComputerNameTemplate='DeviceProfile.ShortName + ''-'' + SerialNumber'");
|
||||
AlterColumn("DeviceProfiles", "ComputerNameTemplate", c => c.String(nullable: false));
|
||||
|
||||
AddColumn("DeviceProfiles", "DistributionType", c => c.Int(nullable: false));
|
||||
AddColumn("DeviceProfiles", "OrganisationalUnit", c => c.String());
|
||||
AddColumn("DeviceProfiles", "AllocateWirelessCertificate", c => c.Boolean(nullable: false));
|
||||
AddColumn("DeviceProfiles", "EnforceComputerNameConvention", c => c.Boolean(nullable: false));
|
||||
AddColumn("DeviceProfiles", "EnforceOrganisationalUnit", c => c.Boolean(nullable: false));
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
DropColumn("DeviceProfiles", "EnforceOrganisationalUnit");
|
||||
DropColumn("DeviceProfiles", "EnforceComputerNameConvention");
|
||||
DropColumn("DeviceProfiles", "AllocateWirelessCertificate");
|
||||
DropColumn("DeviceProfiles", "OrganisationalUnit");
|
||||
DropColumn("DeviceProfiles", "DistributionType");
|
||||
DropColumn("DeviceProfiles", "ComputerNameTemplate");
|
||||
}
|
||||
}
|
||||
}
|
||||
namespace Disco.Data.Migrations
|
||||
{
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class DBv3 : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
AddColumn("DeviceProfiles", "ComputerNameTemplate", c => c.String(nullable: true));
|
||||
Sql(@"UPDATE DeviceProfiles SET ComputerNameTemplate='DeviceProfile.ShortName + ''-'' + SerialNumber'");
|
||||
AlterColumn("DeviceProfiles", "ComputerNameTemplate", c => c.String(nullable: false));
|
||||
|
||||
AddColumn("DeviceProfiles", "DistributionType", c => c.Int(nullable: false));
|
||||
AddColumn("DeviceProfiles", "OrganisationalUnit", c => c.String());
|
||||
AddColumn("DeviceProfiles", "AllocateWirelessCertificate", c => c.Boolean(nullable: false));
|
||||
AddColumn("DeviceProfiles", "EnforceComputerNameConvention", c => c.Boolean(nullable: false));
|
||||
AddColumn("DeviceProfiles", "EnforceOrganisationalUnit", c => c.Boolean(nullable: false));
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
DropColumn("DeviceProfiles", "EnforceOrganisationalUnit");
|
||||
DropColumn("DeviceProfiles", "EnforceComputerNameConvention");
|
||||
DropColumn("DeviceProfiles", "AllocateWirelessCertificate");
|
||||
DropColumn("DeviceProfiles", "OrganisationalUnit");
|
||||
DropColumn("DeviceProfiles", "DistributionType");
|
||||
DropColumn("DeviceProfiles", "ComputerNameTemplate");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+24
-24
File diff suppressed because one or more lines are too long
@@ -1,52 +1,52 @@
|
||||
namespace Disco.Data.Migrations
|
||||
{
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class DBv4 : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
AddColumn("DeviceProfiles", "ProvisionADAccount", c => c.Boolean(nullable: false));
|
||||
Sql(@"UPDATE [DeviceProfiles] SET [ProvisionADAccount]=1;");
|
||||
|
||||
DropColumn("Devices", "CertificateStoreReference");
|
||||
|
||||
RenameTable(name: "WirelessCertificates", newName: "DeviceCertificates");
|
||||
AddColumn("DeviceCertificates", "ProviderId", c => c.String(maxLength: 64));
|
||||
RenameColumn("DeviceCertificates", "Index", "ProviderIndex");
|
||||
Sql("UPDATE DeviceCertificates SET ProviderId='EduSTARnetCertificateProvider'");
|
||||
AlterColumn("DeviceCertificates", "ProviderId", c => c.String(nullable: false, maxLength: 64));
|
||||
|
||||
//RenameColumn("DeviceProfiles", "AllocateWirelessCertificate", "AllocateCertificate");
|
||||
AddColumn("DeviceProfiles", "CertificateProviderId", c => c.String(maxLength: 64));
|
||||
Sql(@"UPDATE [DeviceProfiles] SET [CertificateProviderId]='EduSTARnetCertificateProvider' WHERE [AllocateWirelessCertificate]=1;");
|
||||
|
||||
// Migrate eduSTAR.net Configuration
|
||||
Sql(@"UPDATE [Configuration] SET [Scope]='CertificateProvider_eduSTAR.net', [Key]='AutoBufferMin' WHERE [Scope]='Wireless' AND [Key]='CertificateAutoBufferLow';
|
||||
UPDATE [Configuration] SET [Scope]='CertificateProvider_eduSTAR.net', [Key]='AutoBufferMax' WHERE [Scope]='Wireless' AND [Key]='CertificateAutoBufferMax';
|
||||
UPDATE [Configuration] SET [Scope]='CertificateProvider_eduSTAR.net', [Key]='ServicePassword' WHERE [Scope]='Wireless_eduSTAR' AND [Key]='ServiceAccountPassword';
|
||||
UPDATE [Configuration] SET [Scope]='CertificateProvider_eduSTAR.net', [Key]='SchoolId' WHERE [Scope]='Wireless_eduSTAR' AND [Key]='ServiceAccountSchoolId';
|
||||
UPDATE [Configuration] SET [Scope]='CertificateProvider_eduSTAR.net', [Key]='ServiceUsername' WHERE [Scope]='Wireless_eduSTAR' AND [Key]='ServiceAccountUsername';"
|
||||
);
|
||||
|
||||
Sql(@"UPDATE [DeviceModels] SET [DefaultWarrantyProvider]='LWTWarrantyProvider' WHERE [DefaultWarrantyProvider]='LWT';");
|
||||
|
||||
DropColumn("DeviceProfiles", "AllocateWirelessCertificate");
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
AddColumn("DeviceProfiles", "AllocateWirelessCertificate", c => c.Boolean(nullable: false));
|
||||
|
||||
RenameColumn("DeviceCertificates", "ProviderIndex", "Index");
|
||||
DropColumn("DeviceCertificates", "ProviderId");
|
||||
RenameTable(name: "DeviceCertificates", newName: "WirelessCertificates");
|
||||
|
||||
DropColumn("DeviceProfiles", "CertificateProviderId");
|
||||
|
||||
AddColumn("Devices", "CertificateStoreReference", c => c.String(maxLength: 24));
|
||||
|
||||
DropColumn("DeviceProfiles", "ProvisionADAccount");
|
||||
}
|
||||
}
|
||||
}
|
||||
namespace Disco.Data.Migrations
|
||||
{
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class DBv4 : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
AddColumn("DeviceProfiles", "ProvisionADAccount", c => c.Boolean(nullable: false));
|
||||
Sql(@"UPDATE [DeviceProfiles] SET [ProvisionADAccount]=1;");
|
||||
|
||||
DropColumn("Devices", "CertificateStoreReference");
|
||||
|
||||
RenameTable(name: "WirelessCertificates", newName: "DeviceCertificates");
|
||||
AddColumn("DeviceCertificates", "ProviderId", c => c.String(maxLength: 64));
|
||||
RenameColumn("DeviceCertificates", "Index", "ProviderIndex");
|
||||
Sql("UPDATE DeviceCertificates SET ProviderId='EduSTARnetCertificateProvider'");
|
||||
AlterColumn("DeviceCertificates", "ProviderId", c => c.String(nullable: false, maxLength: 64));
|
||||
|
||||
//RenameColumn("DeviceProfiles", "AllocateWirelessCertificate", "AllocateCertificate");
|
||||
AddColumn("DeviceProfiles", "CertificateProviderId", c => c.String(maxLength: 64));
|
||||
Sql(@"UPDATE [DeviceProfiles] SET [CertificateProviderId]='EduSTARnetCertificateProvider' WHERE [AllocateWirelessCertificate]=1;");
|
||||
|
||||
// Migrate eduSTAR.net Configuration
|
||||
Sql(@"UPDATE [Configuration] SET [Scope]='CertificateProvider_eduSTAR.net', [Key]='AutoBufferMin' WHERE [Scope]='Wireless' AND [Key]='CertificateAutoBufferLow';
|
||||
UPDATE [Configuration] SET [Scope]='CertificateProvider_eduSTAR.net', [Key]='AutoBufferMax' WHERE [Scope]='Wireless' AND [Key]='CertificateAutoBufferMax';
|
||||
UPDATE [Configuration] SET [Scope]='CertificateProvider_eduSTAR.net', [Key]='ServicePassword' WHERE [Scope]='Wireless_eduSTAR' AND [Key]='ServiceAccountPassword';
|
||||
UPDATE [Configuration] SET [Scope]='CertificateProvider_eduSTAR.net', [Key]='SchoolId' WHERE [Scope]='Wireless_eduSTAR' AND [Key]='ServiceAccountSchoolId';
|
||||
UPDATE [Configuration] SET [Scope]='CertificateProvider_eduSTAR.net', [Key]='ServiceUsername' WHERE [Scope]='Wireless_eduSTAR' AND [Key]='ServiceAccountUsername';"
|
||||
);
|
||||
|
||||
Sql(@"UPDATE [DeviceModels] SET [DefaultWarrantyProvider]='LWTWarrantyProvider' WHERE [DefaultWarrantyProvider]='LWT';");
|
||||
|
||||
DropColumn("DeviceProfiles", "AllocateWirelessCertificate");
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
AddColumn("DeviceProfiles", "AllocateWirelessCertificate", c => c.Boolean(nullable: false));
|
||||
|
||||
RenameColumn("DeviceCertificates", "ProviderIndex", "Index");
|
||||
DropColumn("DeviceCertificates", "ProviderId");
|
||||
RenameTable(name: "DeviceCertificates", newName: "WirelessCertificates");
|
||||
|
||||
DropColumn("DeviceProfiles", "CertificateProviderId");
|
||||
|
||||
AddColumn("Devices", "CertificateStoreReference", c => c.String(maxLength: 24));
|
||||
|
||||
DropColumn("DeviceProfiles", "ProvisionADAccount");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+27
-27
@@ -1,27 +1,27 @@
|
||||
// <auto-generated />
|
||||
namespace Disco.Data.Migrations
|
||||
{
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Data.Entity.Migrations.Infrastructure;
|
||||
using System.Resources;
|
||||
|
||||
public sealed partial class DBv5 : IMigrationMetadata
|
||||
{
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(DBv5));
|
||||
|
||||
string IMigrationMetadata.Id
|
||||
{
|
||||
get { return "201211090325116_DBv5"; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Source
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Target
|
||||
{
|
||||
get { return Resources.GetString("Target"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
// <auto-generated />
|
||||
namespace Disco.Data.Migrations
|
||||
{
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Data.Entity.Migrations.Infrastructure;
|
||||
using System.Resources;
|
||||
|
||||
public sealed partial class DBv5 : IMigrationMetadata
|
||||
{
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(DBv5));
|
||||
|
||||
string IMigrationMetadata.Id
|
||||
{
|
||||
get { return "201211090325116_DBv5"; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Source
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Target
|
||||
{
|
||||
get { return Resources.GetString("Target"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,96 +1,96 @@
|
||||
namespace Disco.Data.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class DBv5 : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
// Drop Foreign Keys
|
||||
|
||||
// 2012-11-09 - G#
|
||||
// ForeignKey Names are not consistant among databases - Especially version 4.3.1 -> 5.0.0.net45
|
||||
#region "Support inconsistant foreign key names"
|
||||
// DeviceCertificates was renamed from WirelessCertificates
|
||||
Sql(@"
|
||||
BEGIN TRY
|
||||
ALTER TABLE [dbo].[DeviceCertificates] DROP CONSTRAINT [FK_dbo.DeviceCertificates_dbo.Devices_DeviceSerialNumber];
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
ALTER TABLE [dbo].[DeviceCertificates] DROP CONSTRAINT [FK_WirelessCertificates_Devices_DeviceSerialNumber];
|
||||
END CATCH;", true);
|
||||
// DeviceAttachments
|
||||
Sql(@"
|
||||
BEGIN TRY
|
||||
ALTER TABLE [dbo].[DeviceAttachments] DROP CONSTRAINT [FK_dbo.DeviceAttachments_dbo.Devices_DeviceSerialNumber];
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
ALTER TABLE [dbo].[DeviceAttachments] DROP CONSTRAINT [FK_DeviceAttachments_Devices_DeviceSerialNumber];
|
||||
END CATCH;", true);
|
||||
// DeviceDetails
|
||||
Sql(@"
|
||||
BEGIN TRY
|
||||
ALTER TABLE [dbo].[DeviceDetails] DROP CONSTRAINT [FK_dbo.DeviceDetails_dbo.Devices_DeviceSerialNumber];
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
ALTER TABLE [dbo].[DeviceDetails] DROP CONSTRAINT [FK_DeviceDetails_Devices_DeviceSerialNumber];
|
||||
END CATCH;", true);
|
||||
// Jobs
|
||||
Sql(@"
|
||||
BEGIN TRY
|
||||
ALTER TABLE [dbo].[Jobs] DROP CONSTRAINT [FK_dbo.Jobs_dbo.Devices_DeviceSerialNumber];
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
ALTER TABLE [dbo].[Jobs] DROP CONSTRAINT [FK_Jobs_Devices_DeviceSerialNumber];
|
||||
END CATCH;", true);
|
||||
// DeviceUserAssignments
|
||||
Sql(@"
|
||||
BEGIN TRY
|
||||
ALTER TABLE [dbo].[DeviceUserAssignments] DROP CONSTRAINT [FK_dbo.DeviceUserAssignments_dbo.Devices_DeviceSerialNumber];
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
ALTER TABLE [dbo].[DeviceUserAssignments] DROP CONSTRAINT [FK_DeviceUserAssignments_Devices_DeviceSerialNumber];
|
||||
END CATCH;", true);
|
||||
#endregion
|
||||
|
||||
AlterColumn("dbo.Devices", "SerialNumber", c => c.String(nullable: false, maxLength: 60));
|
||||
AlterColumn("dbo.DeviceUserAssignments", "DeviceSerialNumber", c => c.String(nullable: false, maxLength: 60));
|
||||
AlterColumn("dbo.Jobs", "DeviceSerialNumber", c => c.String(maxLength: 60));
|
||||
AlterColumn("dbo.DeviceDetails", "DeviceSerialNumber", c => c.String(nullable: false, maxLength: 60));
|
||||
AlterColumn("dbo.DeviceAttachments", "DeviceSerialNumber", c => c.String(maxLength: 60));
|
||||
AlterColumn("dbo.DeviceCertificates", "DeviceSerialNumber", c => c.String(maxLength: 60));
|
||||
|
||||
// Re-create Foreign Keys
|
||||
AddForeignKey("dbo.DeviceCertificates", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
AddForeignKey("dbo.DeviceAttachments", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
AddForeignKey("dbo.DeviceDetails", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
AddForeignKey("dbo.Jobs", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
AddForeignKey("dbo.DeviceUserAssignments", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
// Drop Foreign Keys
|
||||
DropForeignKey("dbo.DeviceCertificates", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
DropForeignKey("dbo.DeviceAttachments", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
DropForeignKey("dbo.DeviceDetails", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
DropForeignKey("dbo.Jobs", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
DropForeignKey("dbo.DeviceUserAssignments", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
|
||||
AlterColumn("dbo.DeviceCertificates", "DeviceSerialNumber", c => c.String(maxLength: 40));
|
||||
AlterColumn("dbo.DeviceAttachments", "DeviceSerialNumber", c => c.String(maxLength: 40));
|
||||
AlterColumn("dbo.DeviceDetails", "DeviceSerialNumber", c => c.String(nullable: false, maxLength: 40));
|
||||
AlterColumn("dbo.Jobs", "DeviceSerialNumber", c => c.String(maxLength: 40));
|
||||
AlterColumn("dbo.DeviceUserAssignments", "DeviceSerialNumber", c => c.String(nullable: false, maxLength: 40));
|
||||
AlterColumn("dbo.Devices", "SerialNumber", c => c.String(nullable: false, maxLength: 40));
|
||||
|
||||
// Re-create Foreign Keys
|
||||
AddForeignKey("dbo.DeviceCertificates", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
AddForeignKey("dbo.DeviceAttachments", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
AddForeignKey("dbo.DeviceDetails", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
AddForeignKey("dbo.Jobs", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
AddForeignKey("dbo.DeviceUserAssignments", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
}
|
||||
}
|
||||
}
|
||||
namespace Disco.Data.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class DBv5 : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
// Drop Foreign Keys
|
||||
|
||||
// 2012-11-09 - G#
|
||||
// ForeignKey Names are not consistant among databases - Especially version 4.3.1 -> 5.0.0.net45
|
||||
#region "Support inconsistant foreign key names"
|
||||
// DeviceCertificates was renamed from WirelessCertificates
|
||||
Sql(@"
|
||||
BEGIN TRY
|
||||
ALTER TABLE [dbo].[DeviceCertificates] DROP CONSTRAINT [FK_dbo.DeviceCertificates_dbo.Devices_DeviceSerialNumber];
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
ALTER TABLE [dbo].[DeviceCertificates] DROP CONSTRAINT [FK_WirelessCertificates_Devices_DeviceSerialNumber];
|
||||
END CATCH;", true);
|
||||
// DeviceAttachments
|
||||
Sql(@"
|
||||
BEGIN TRY
|
||||
ALTER TABLE [dbo].[DeviceAttachments] DROP CONSTRAINT [FK_dbo.DeviceAttachments_dbo.Devices_DeviceSerialNumber];
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
ALTER TABLE [dbo].[DeviceAttachments] DROP CONSTRAINT [FK_DeviceAttachments_Devices_DeviceSerialNumber];
|
||||
END CATCH;", true);
|
||||
// DeviceDetails
|
||||
Sql(@"
|
||||
BEGIN TRY
|
||||
ALTER TABLE [dbo].[DeviceDetails] DROP CONSTRAINT [FK_dbo.DeviceDetails_dbo.Devices_DeviceSerialNumber];
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
ALTER TABLE [dbo].[DeviceDetails] DROP CONSTRAINT [FK_DeviceDetails_Devices_DeviceSerialNumber];
|
||||
END CATCH;", true);
|
||||
// Jobs
|
||||
Sql(@"
|
||||
BEGIN TRY
|
||||
ALTER TABLE [dbo].[Jobs] DROP CONSTRAINT [FK_dbo.Jobs_dbo.Devices_DeviceSerialNumber];
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
ALTER TABLE [dbo].[Jobs] DROP CONSTRAINT [FK_Jobs_Devices_DeviceSerialNumber];
|
||||
END CATCH;", true);
|
||||
// DeviceUserAssignments
|
||||
Sql(@"
|
||||
BEGIN TRY
|
||||
ALTER TABLE [dbo].[DeviceUserAssignments] DROP CONSTRAINT [FK_dbo.DeviceUserAssignments_dbo.Devices_DeviceSerialNumber];
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
ALTER TABLE [dbo].[DeviceUserAssignments] DROP CONSTRAINT [FK_DeviceUserAssignments_Devices_DeviceSerialNumber];
|
||||
END CATCH;", true);
|
||||
#endregion
|
||||
|
||||
AlterColumn("dbo.Devices", "SerialNumber", c => c.String(nullable: false, maxLength: 60));
|
||||
AlterColumn("dbo.DeviceUserAssignments", "DeviceSerialNumber", c => c.String(nullable: false, maxLength: 60));
|
||||
AlterColumn("dbo.Jobs", "DeviceSerialNumber", c => c.String(maxLength: 60));
|
||||
AlterColumn("dbo.DeviceDetails", "DeviceSerialNumber", c => c.String(nullable: false, maxLength: 60));
|
||||
AlterColumn("dbo.DeviceAttachments", "DeviceSerialNumber", c => c.String(maxLength: 60));
|
||||
AlterColumn("dbo.DeviceCertificates", "DeviceSerialNumber", c => c.String(maxLength: 60));
|
||||
|
||||
// Re-create Foreign Keys
|
||||
AddForeignKey("dbo.DeviceCertificates", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
AddForeignKey("dbo.DeviceAttachments", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
AddForeignKey("dbo.DeviceDetails", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
AddForeignKey("dbo.Jobs", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
AddForeignKey("dbo.DeviceUserAssignments", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
// Drop Foreign Keys
|
||||
DropForeignKey("dbo.DeviceCertificates", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
DropForeignKey("dbo.DeviceAttachments", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
DropForeignKey("dbo.DeviceDetails", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
DropForeignKey("dbo.Jobs", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
DropForeignKey("dbo.DeviceUserAssignments", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
|
||||
AlterColumn("dbo.DeviceCertificates", "DeviceSerialNumber", c => c.String(maxLength: 40));
|
||||
AlterColumn("dbo.DeviceAttachments", "DeviceSerialNumber", c => c.String(maxLength: 40));
|
||||
AlterColumn("dbo.DeviceDetails", "DeviceSerialNumber", c => c.String(nullable: false, maxLength: 40));
|
||||
AlterColumn("dbo.Jobs", "DeviceSerialNumber", c => c.String(maxLength: 40));
|
||||
AlterColumn("dbo.DeviceUserAssignments", "DeviceSerialNumber", c => c.String(nullable: false, maxLength: 40));
|
||||
AlterColumn("dbo.Devices", "SerialNumber", c => c.String(nullable: false, maxLength: 40));
|
||||
|
||||
// Re-create Foreign Keys
|
||||
AddForeignKey("dbo.DeviceCertificates", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
AddForeignKey("dbo.DeviceAttachments", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
AddForeignKey("dbo.DeviceDetails", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
AddForeignKey("dbo.Jobs", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
AddForeignKey("dbo.DeviceUserAssignments", "DeviceSerialNumber", "dbo.Devices", "SerialNumber");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
+27
-27
@@ -1,27 +1,27 @@
|
||||
// <auto-generated />
|
||||
namespace Disco.Data.Migrations
|
||||
{
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Data.Entity.Migrations.Infrastructure;
|
||||
using System.Resources;
|
||||
|
||||
public sealed partial class DBv6 : IMigrationMetadata
|
||||
{
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(DBv6));
|
||||
|
||||
string IMigrationMetadata.Id
|
||||
{
|
||||
get { return "201301150107063_DBv6"; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Source
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Target
|
||||
{
|
||||
get { return Resources.GetString("Target"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
// <auto-generated />
|
||||
namespace Disco.Data.Migrations
|
||||
{
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Data.Entity.Migrations.Infrastructure;
|
||||
using System.Resources;
|
||||
|
||||
public sealed partial class DBv6 : IMigrationMetadata
|
||||
{
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(DBv6));
|
||||
|
||||
string IMigrationMetadata.Id
|
||||
{
|
||||
get { return "201301150107063_DBv6"; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Source
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Target
|
||||
{
|
||||
get { return Resources.GetString("Target"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
namespace Disco.Data.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class DBv6 : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
DropColumn("dbo.DeviceModels", "Image");
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
AddColumn("dbo.DeviceModels", "Image", c => c.Binary());
|
||||
}
|
||||
}
|
||||
}
|
||||
namespace Disco.Data.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class DBv6 : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
DropColumn("dbo.DeviceModels", "Image");
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
AddColumn("dbo.DeviceModels", "Image", c => c.Binary());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,21 +1,21 @@
|
||||
namespace Disco.Data.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity;
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Linq;
|
||||
using Disco.Data.Repository;
|
||||
|
||||
internal sealed class Configuration : DbMigrationsConfiguration<DiscoDataContext>
|
||||
{
|
||||
public Configuration()
|
||||
{
|
||||
AutomaticMigrationsEnabled = false;
|
||||
}
|
||||
|
||||
protected override void Seed(DiscoDataContext context)
|
||||
{
|
||||
context.SeedDatabase();
|
||||
}
|
||||
}
|
||||
}
|
||||
namespace Disco.Data.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity;
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Linq;
|
||||
using Disco.Data.Repository;
|
||||
|
||||
internal sealed class Configuration : DbMigrationsConfiguration<DiscoDataContext>
|
||||
{
|
||||
public Configuration()
|
||||
{
|
||||
AutomaticMigrationsEnabled = false;
|
||||
}
|
||||
|
||||
protected override void Seed(DiscoDataContext context)
|
||||
{
|
||||
context.SeedDatabase();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,97 +1,97 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Data.Entity.Migrations.Infrastructure;
|
||||
using Disco.Data.Repository;
|
||||
|
||||
namespace Disco.Data.Migrations
|
||||
{
|
||||
public static class DiscoDataMigrator
|
||||
{
|
||||
|
||||
private static DbMigrator GetMigrator()
|
||||
{
|
||||
var migContext = new DbMigrationsConfiguration<DiscoDataContext>();
|
||||
migContext.MigrationsAssembly = typeof(DiscoDataMigrator).Assembly;
|
||||
migContext.MigrationsNamespace = "Disco.Data.Migrations";
|
||||
|
||||
return new DbMigrator(migContext);
|
||||
}
|
||||
|
||||
public static void MigrateLatest(bool Seed)
|
||||
{
|
||||
var migrator = GetMigrator();
|
||||
|
||||
migrator.Update();
|
||||
|
||||
if (Seed)
|
||||
SeedDatabase();
|
||||
}
|
||||
public static void ForceMigration(string TargetMigration, bool Seed)
|
||||
{
|
||||
var migrator = GetMigrator();
|
||||
|
||||
migrator.Update(TargetMigration);
|
||||
|
||||
if (Seed)
|
||||
SeedDatabase();
|
||||
}
|
||||
|
||||
public static string MigrationScript(string CurrentMigration, string TargetMigration)
|
||||
{
|
||||
var migrator = GetMigrator();
|
||||
var scriptor = new MigratorScriptingDecorator(migrator);
|
||||
return scriptor.ScriptUpdate(CurrentMigration, TargetMigration);
|
||||
}
|
||||
|
||||
public static void SeedDatabase()
|
||||
{
|
||||
// Seed/Update Database
|
||||
using (DiscoDataContext dbContext = new DiscoDataContext())
|
||||
{
|
||||
dbContext.SeedDatabase();
|
||||
try
|
||||
{
|
||||
dbContext.SaveChanges();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine(ex.Message);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static MigrationStatus Status()
|
||||
{
|
||||
var migrator = GetMigrator();
|
||||
|
||||
var appliedMigrations = migrator.GetDatabaseMigrations().ToList();
|
||||
var pendingMigrations = migrator.GetPendingMigrations().ToList();
|
||||
var currentMigration = appliedMigrations.LastOrDefault();
|
||||
|
||||
return new MigrationStatus()
|
||||
{
|
||||
CurrentMigration = currentMigration,
|
||||
AppliedMigrations = appliedMigrations,
|
||||
PendingMigrations = pendingMigrations,
|
||||
AllMigrations = appliedMigrations.Union(pendingMigrations)
|
||||
};
|
||||
}
|
||||
|
||||
public class MigrationStatus
|
||||
{
|
||||
public string CurrentMigration { get; internal set; }
|
||||
public IEnumerable<string> AppliedMigrations { get; internal set; }
|
||||
public IEnumerable<string> PendingMigrations { get; internal set; }
|
||||
public IEnumerable<string> AllMigrations { get; internal set; }
|
||||
|
||||
internal MigrationStatus()
|
||||
{
|
||||
// Private Constructor
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Data.Entity.Migrations.Infrastructure;
|
||||
using Disco.Data.Repository;
|
||||
|
||||
namespace Disco.Data.Migrations
|
||||
{
|
||||
public static class DiscoDataMigrator
|
||||
{
|
||||
|
||||
private static DbMigrator GetMigrator()
|
||||
{
|
||||
var migContext = new DbMigrationsConfiguration<DiscoDataContext>();
|
||||
migContext.MigrationsAssembly = typeof(DiscoDataMigrator).Assembly;
|
||||
migContext.MigrationsNamespace = "Disco.Data.Migrations";
|
||||
|
||||
return new DbMigrator(migContext);
|
||||
}
|
||||
|
||||
public static void MigrateLatest(bool Seed)
|
||||
{
|
||||
var migrator = GetMigrator();
|
||||
|
||||
migrator.Update();
|
||||
|
||||
if (Seed)
|
||||
SeedDatabase();
|
||||
}
|
||||
public static void ForceMigration(string TargetMigration, bool Seed)
|
||||
{
|
||||
var migrator = GetMigrator();
|
||||
|
||||
migrator.Update(TargetMigration);
|
||||
|
||||
if (Seed)
|
||||
SeedDatabase();
|
||||
}
|
||||
|
||||
public static string MigrationScript(string CurrentMigration, string TargetMigration)
|
||||
{
|
||||
var migrator = GetMigrator();
|
||||
var scriptor = new MigratorScriptingDecorator(migrator);
|
||||
return scriptor.ScriptUpdate(CurrentMigration, TargetMigration);
|
||||
}
|
||||
|
||||
public static void SeedDatabase()
|
||||
{
|
||||
// Seed/Update Database
|
||||
using (DiscoDataContext dbContext = new DiscoDataContext())
|
||||
{
|
||||
dbContext.SeedDatabase();
|
||||
try
|
||||
{
|
||||
dbContext.SaveChanges();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine(ex.Message);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static MigrationStatus Status()
|
||||
{
|
||||
var migrator = GetMigrator();
|
||||
|
||||
var appliedMigrations = migrator.GetDatabaseMigrations().ToList();
|
||||
var pendingMigrations = migrator.GetPendingMigrations().ToList();
|
||||
var currentMigration = appliedMigrations.LastOrDefault();
|
||||
|
||||
return new MigrationStatus()
|
||||
{
|
||||
CurrentMigration = currentMigration,
|
||||
AppliedMigrations = appliedMigrations,
|
||||
PendingMigrations = pendingMigrations,
|
||||
AllMigrations = appliedMigrations.Union(pendingMigrations)
|
||||
};
|
||||
}
|
||||
|
||||
public class MigrationStatus
|
||||
{
|
||||
public string CurrentMigration { get; internal set; }
|
||||
public IEnumerable<string> AppliedMigrations { get; internal set; }
|
||||
public IEnumerable<string> PendingMigrations { get; internal set; }
|
||||
public IEnumerable<string> AllMigrations { get; internal set; }
|
||||
|
||||
internal MigrationStatus()
|
||||
{
|
||||
// Private Constructor
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user