mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2024-11-19 18:11:36 +01:00
49 lines
1.8 KiB
C#
49 lines
1.8 KiB
C#
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<string>(nullable: false, maxLength: maxLength),
|
|
FileName = table.Column<string>(nullable: true),
|
|
StorageFileName = table.Column<string>(nullable: true),
|
|
Timestamp = table.Column<DateTime>(nullable: false),
|
|
ApplicationUserId = table.Column<string>(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");
|
|
}
|
|
}
|
|
}
|