using System; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace AmtScanner.Api.Migrations { /// public partial class InitialCreate : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AlterDatabase() .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "AmtCredentials", columns: table => new { Id = table.Column(type: "bigint", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), Name = table.Column(type: "varchar(200)", maxLength: 200, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), Username = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), Password = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), IsDefault = table.Column(type: "tinyint(1)", nullable: false), Description = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), CreatedAt = table.Column(type: "datetime(6)", nullable: false), UpdatedAt = table.Column(type: "datetime(6)", nullable: false) }, constraints: table => { table.PrimaryKey("PK_AmtCredentials", x => x.Id); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "AmtDevices", columns: table => new { Id = table.Column(type: "bigint", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), IpAddress = table.Column(type: "varchar(50)", maxLength: 50, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), Hostname = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), MajorVersion = table.Column(type: "int", nullable: false), MinorVersion = table.Column(type: "int", nullable: false), ProvisioningState = table.Column(type: "int", nullable: false), Description = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), Online = table.Column(type: "tinyint(1)", nullable: false), DiscoveredAt = table.Column(type: "datetime(6)", nullable: false), LastSeenAt = table.Column(type: "datetime(6)", nullable: false) }, constraints: table => { table.PrimaryKey("PK_AmtDevices", x => x.Id); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateIndex( name: "IX_AmtCredentials_Name", table: "AmtCredentials", column: "Name"); migrationBuilder.CreateIndex( name: "IX_AmtDevices_IpAddress", table: "AmtDevices", column: "IpAddress", unique: true); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "AmtCredentials"); migrationBuilder.DropTable( name: "AmtDevices"); } } }