using System; using Microsoft.EntityFrameworkCore.Migrations; namespace SuZhou_SIPAC_Client.Migrations { public partial class init : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "InverterAccumulatedDatas", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), 当日有功发电量 = table.Column(type: "TEXT", nullable: false), 当日无功发电量 = table.Column(type: "TEXT", nullable: false), 当月有功发电量 = table.Column(type: "TEXT", nullable: true), 当月无功发电量 = table.Column(type: "TEXT", nullable: true), 当年有功发电量 = table.Column(type: "TEXT", nullable: true), 当年无功发电量 = table.Column(type: "TEXT", nullable: true), CreatedTimeStamp = table.Column(type: "TEXT", nullable: false), HttpPostResponseReceivedTime = table.Column(type: "TEXT", nullable: true), HttpPostResponse = table.Column(type: "TEXT", nullable: true) }, constraints: table => { table.PrimaryKey("PK_InverterAccumulatedDatas", x => x.Id); }); migrationBuilder.CreateTable( name: "InverterRealTimeDatas", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), DeviceName = table.Column(type: "TEXT", nullable: true), DeviceDescription = table.Column(type: "TEXT", nullable: true), DeviceSlaveAddress = table.Column(type: "INTEGER", nullable: false), Raw_当日有功发电量 = table.Column(type: "TEXT", nullable: false), Raw_当日无功发电量 = table.Column(type: "TEXT", nullable: false), ReadTimeStamp = table.Column(type: "TEXT", nullable: false), InverterAccumulatedDataModelId = table.Column(type: "INTEGER", nullable: true) }, constraints: table => { table.PrimaryKey("PK_InverterRealTimeDatas", x => x.Id); table.ForeignKey( name: "FK_InverterRealTimeDatas_InverterAccumulatedDatas_InverterAccumulatedDataModelId", column: x => x.InverterAccumulatedDataModelId, principalTable: "InverterAccumulatedDatas", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateIndex( name: "IX_InverterAccumulatedDatas_Id", table: "InverterAccumulatedDatas", column: "Id", unique: true); migrationBuilder.CreateIndex( name: "IX_InverterRealTimeDatas_Id", table: "InverterRealTimeDatas", column: "Id", unique: true); migrationBuilder.CreateIndex( name: "IX_InverterRealTimeDatas_InverterAccumulatedDataModelId", table: "InverterRealTimeDatas", column: "InverterAccumulatedDataModelId"); migrationBuilder.CreateIndex( name: "IX_InverterRealTimeDatas_ReadTimeStamp", table: "InverterRealTimeDatas", column: "ReadTimeStamp"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "InverterRealTimeDatas"); migrationBuilder.DropTable( name: "InverterAccumulatedDatas"); } } }