using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Mizuki.Migrations { /// public partial class Initialmigration : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Users", columns: table => new { Id = table.Column(type: "TEXT", nullable: false), Username = table.Column(type: "TEXT", nullable: false), PasswordHash = table.Column(type: "TEXT", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Users", x => x.Id); }); migrationBuilder.CreateTable( name: "Uploads", columns: table => new { Id = table.Column(type: "TEXT", nullable: false), Filename = table.Column(type: "TEXT", nullable: false), OriginalFilename = table.Column(type: "TEXT", nullable: false), SizeInBytes = table.Column(type: "INTEGER", nullable: false), TimeOfUpload = table.Column(type: "TEXT", nullable: false), AuthorId = table.Column(type: "TEXT", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Uploads", x => x.Id); table.ForeignKey( name: "FK_Uploads_Users_AuthorId", column: x => x.AuthorId, principalTable: "Users", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_Uploads_AuthorId", table: "Uploads", column: "AuthorId"); migrationBuilder.CreateIndex( name: "IX_Uploads_Filename", table: "Uploads", column: "Filename", unique: true); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Uploads"); migrationBuilder.DropTable( name: "Users"); } } }