using System; using BTCPayServer.Data; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; namespace BTCPayServer.Migrations { [DbContext(typeof(ApplicationDbContext))] [Migration("20190324141717_AddFiles")] public partial class AddFiles : Migration { protected override void Up(MigrationBuilder migrationBuilder) { int? maxLength = this.IsMySql(migrationBuilder.ActiveProvider) ? (int?)255 : null; migrationBuilder.CreateTable( name: "Files", columns: table => new { Id = table.Column(nullable: false, maxLength: maxLength), FileName = table.Column(nullable: true), StorageFileName = table.Column(nullable: true), Timestamp = table.Column(nullable: false), ApplicationUserId = table.Column(nullable: true, maxLength: maxLength) }, constraints: table => { table.PrimaryKey("PK_Files", x => x.Id); table.ForeignKey( name: "FK_Files_AspNetUsers_ApplicationUserId", column: x => x.ApplicationUserId, principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateIndex( name: "IX_Files_ApplicationUserId", table: "Files", column: "ApplicationUserId"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Files"); } } }