#138 device flag models
This commit is contained in:
@@ -175,6 +175,10 @@
|
||||
<Compile Include="Migrations\202304150715559_DBv22.Designer.cs">
|
||||
<DependentUpon>202304150715559_DBv22.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\202401130531317_DBv23.cs" />
|
||||
<Compile Include="Migrations\202401130531317_DBv23.Designer.cs">
|
||||
<DependentUpon>202401130531317_DBv23.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\Configuration.cs" />
|
||||
<Compile Include="Migrations\DiscoDataMigrator.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
@@ -256,6 +260,9 @@
|
||||
<EmbeddedResource Include="Migrations\202304150715559_DBv22.resx">
|
||||
<DependentUpon>202304150715559_DBv22.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Migrations\202401130531317_DBv23.resx">
|
||||
<DependentUpon>202401130531317_DBv23.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
|
||||
@@ -0,0 +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 DBv23 : IMigrationMetadata
|
||||
{
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(DBv23));
|
||||
|
||||
string IMigrationMetadata.Id
|
||||
{
|
||||
get { return "202401130531317_DBv23"; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Source
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Target
|
||||
{
|
||||
get { return Resources.GetString("Target"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
namespace Disco.Data.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class DBv23 : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
CreateTable(
|
||||
"dbo.DeviceFlagAssignments",
|
||||
c => new
|
||||
{
|
||||
Id = c.Int(nullable: false, identity: true),
|
||||
DeviceFlagId = c.Int(nullable: false),
|
||||
DeviceSerialNumber = c.String(nullable: false, maxLength: 60),
|
||||
AddedDate = c.DateTime(nullable: false),
|
||||
AddedUserId = c.String(nullable: false, maxLength: 50),
|
||||
RemovedDate = c.DateTime(),
|
||||
RemovedUserId = c.String(maxLength: 50),
|
||||
Comments = c.String(),
|
||||
OnAssignmentExpressionResult = c.String(),
|
||||
OnUnassignmentExpressionResult = c.String(),
|
||||
})
|
||||
.PrimaryKey(t => t.Id)
|
||||
.ForeignKey("dbo.DeviceFlags", t => t.DeviceFlagId)
|
||||
.ForeignKey("dbo.Devices", t => t.DeviceSerialNumber)
|
||||
.ForeignKey("dbo.Users", t => t.AddedUserId)
|
||||
.ForeignKey("dbo.Users", t => t.RemovedUserId)
|
||||
.Index(t => t.DeviceFlagId)
|
||||
.Index(t => t.DeviceSerialNumber)
|
||||
.Index(t => t.AddedUserId)
|
||||
.Index(t => t.RemovedUserId);
|
||||
|
||||
CreateTable(
|
||||
"dbo.DeviceFlags",
|
||||
c => new
|
||||
{
|
||||
Id = c.Int(nullable: false, identity: true),
|
||||
Name = c.String(nullable: false, maxLength: 100),
|
||||
Description = c.String(maxLength: 500),
|
||||
Icon = c.String(nullable: false, maxLength: 25),
|
||||
IconColour = c.String(nullable: false, maxLength: 10),
|
||||
DevicesLinkedGroup = c.String(),
|
||||
DeviceUsersLinkedGroup = c.String(),
|
||||
OnAssignmentExpression = c.String(),
|
||||
OnUnassignmentExpression = c.String(),
|
||||
})
|
||||
.PrimaryKey(t => t.Id);
|
||||
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
DropIndex("dbo.DeviceFlagAssignments", new[] { "RemovedUserId" });
|
||||
DropIndex("dbo.DeviceFlagAssignments", new[] { "AddedUserId" });
|
||||
DropIndex("dbo.DeviceFlagAssignments", new[] { "DeviceSerialNumber" });
|
||||
DropIndex("dbo.DeviceFlagAssignments", new[] { "DeviceFlagId" });
|
||||
DropForeignKey("dbo.DeviceFlagAssignments", "RemovedUserId", "dbo.Users");
|
||||
DropForeignKey("dbo.DeviceFlagAssignments", "AddedUserId", "dbo.Users");
|
||||
DropForeignKey("dbo.DeviceFlagAssignments", "DeviceSerialNumber", "dbo.Devices");
|
||||
DropForeignKey("dbo.DeviceFlagAssignments", "DeviceFlagId", "dbo.DeviceFlags");
|
||||
DropTable("dbo.DeviceFlags");
|
||||
DropTable("dbo.DeviceFlagAssignments");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -1,9 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Disco.Models.Repository;
|
||||
using System;
|
||||
using System.Data.Entity;
|
||||
using Disco.Models.Repository;
|
||||
using System.Data.Entity.ModelConfiguration.Conventions;
|
||||
|
||||
namespace Disco.Data.Repository
|
||||
@@ -38,6 +35,8 @@ namespace Disco.Data.Repository
|
||||
public virtual DbSet<DeviceBatchAttachment> DeviceBatchAttachments { get; set; }
|
||||
public virtual DbSet<DeviceComponent> DeviceComponents { get; set; }
|
||||
public virtual DbSet<DeviceAttachment> DeviceAttachments { get; set; }
|
||||
public virtual DbSet<DeviceFlag> DeviceFlags { get; set; }
|
||||
public virtual DbSet<DeviceFlagAssignment> DeviceFlagAssignments { get; set; }
|
||||
|
||||
public virtual DbSet<DeviceCertificate> DeviceCertificates { get; set; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user