using System; using Microsoft.EntityFrameworkCore.Migrations; namespace WCS.Service.Migrations { public partial class _21041407 : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_WCS_BCRDATA_WCS_DEVICEITEM_PROTOCOLID", table: "WCS_BCRDATA"); migrationBuilder.DropIndex( name: "IX_WCS_BCRDATA_PROTOCOLID", table: "WCS_BCRDATA"); migrationBuilder.DropColumn( name: "PROTOCOLID", table: "WCS_BCRDATA"); migrationBuilder.AddColumn( name: "DEVICECODE", table: "WCS_STATIONSTATUSDATA", type: "nvarchar(50)", nullable: true); migrationBuilder.AddColumn( name: "FRAME", table: "WCS_STATIONSTATUSDATA", type: "datetime2", nullable: false, defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); migrationBuilder.AddColumn( name: "ISLAST", table: "WCS_STATIONSTATUSDATA", type: "bit", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "DEVICECODE", table: "WCS_STATIONDATA", type: "nvarchar(50)", nullable: true); migrationBuilder.AddColumn( name: "FRAME", table: "WCS_STATIONDATA", type: "datetime2", nullable: false, defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); migrationBuilder.AddColumn( name: "ISLAST", table: "WCS_STATIONDATA", type: "bit", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "DEVICECODE", table: "WCS_BCRDATA", type: "nvarchar(50)", nullable: true); migrationBuilder.CreateIndex( name: "IX_WCS_STATIONSTATUSDATA_DEVICECODE", table: "WCS_STATIONSTATUSDATA", column: "DEVICECODE"); migrationBuilder.CreateIndex( name: "IX_WCS_STATIONDATA_DEVICECODE", table: "WCS_STATIONDATA", column: "DEVICECODE"); migrationBuilder.CreateIndex( name: "IX_WCS_BCRDATA_DEVICECODE", table: "WCS_BCRDATA", column: "DEVICECODE"); migrationBuilder.AddForeignKey( name: "FK_WCS_BCRDATA_WCS_DEVICE_DEVICECODE", table: "WCS_BCRDATA", column: "DEVICECODE", principalTable: "WCS_DEVICE", principalColumn: "CODE", onDelete: ReferentialAction.Restrict); migrationBuilder.AddForeignKey( name: "FK_WCS_STATIONDATA_WCS_DEVICE_DEVICECODE", table: "WCS_STATIONDATA", column: "DEVICECODE", principalTable: "WCS_DEVICE", principalColumn: "CODE", onDelete: ReferentialAction.Restrict); migrationBuilder.AddForeignKey( name: "FK_WCS_STATIONSTATUSDATA_WCS_DEVICE_DEVICECODE", table: "WCS_STATIONSTATUSDATA", column: "DEVICECODE", principalTable: "WCS_DEVICE", principalColumn: "CODE", onDelete: ReferentialAction.Restrict); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_WCS_BCRDATA_WCS_DEVICE_DEVICECODE", table: "WCS_BCRDATA"); migrationBuilder.DropForeignKey( name: "FK_WCS_STATIONDATA_WCS_DEVICE_DEVICECODE", table: "WCS_STATIONDATA"); migrationBuilder.DropForeignKey( name: "FK_WCS_STATIONSTATUSDATA_WCS_DEVICE_DEVICECODE", table: "WCS_STATIONSTATUSDATA"); migrationBuilder.DropIndex( name: "IX_WCS_STATIONSTATUSDATA_DEVICECODE", table: "WCS_STATIONSTATUSDATA"); migrationBuilder.DropIndex( name: "IX_WCS_STATIONDATA_DEVICECODE", table: "WCS_STATIONDATA"); migrationBuilder.DropIndex( name: "IX_WCS_BCRDATA_DEVICECODE", table: "WCS_BCRDATA"); migrationBuilder.DropColumn( name: "DEVICECODE", table: "WCS_STATIONSTATUSDATA"); migrationBuilder.DropColumn( name: "FRAME", table: "WCS_STATIONSTATUSDATA"); migrationBuilder.DropColumn( name: "ISLAST", table: "WCS_STATIONSTATUSDATA"); migrationBuilder.DropColumn( name: "DEVICECODE", table: "WCS_STATIONDATA"); migrationBuilder.DropColumn( name: "FRAME", table: "WCS_STATIONDATA"); migrationBuilder.DropColumn( name: "ISLAST", table: "WCS_STATIONDATA"); migrationBuilder.DropColumn( name: "DEVICECODE", table: "WCS_BCRDATA"); migrationBuilder.AddColumn( name: "PROTOCOLID", table: "WCS_BCRDATA", type: "int", nullable: true); migrationBuilder.CreateIndex( name: "IX_WCS_BCRDATA_PROTOCOLID", table: "WCS_BCRDATA", column: "PROTOCOLID"); migrationBuilder.AddForeignKey( name: "FK_WCS_BCRDATA_WCS_DEVICEITEM_PROTOCOLID", table: "WCS_BCRDATA", column: "PROTOCOLID", principalTable: "WCS_DEVICEITEM", principalColumn: "ID", onDelete: ReferentialAction.Restrict); } } }