using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace TagVid.Migrations { /// public partial class InitialMigration : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Settings", columns: table => new { Name = table.Column(type: "int", nullable: false), Value = table.Column(type: "nvarchar(max)", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Settings", x => x.Name); }); migrationBuilder.CreateTable( name: "Tags", columns: table => new { Name = table.Column(type: "nvarchar(450)", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Tags", x => x.Name); }); migrationBuilder.CreateTable( name: "Videos", columns: table => new { Id = table.Column(type: "nvarchar(450)", nullable: false), Title = table.Column(type: "nvarchar(max)", nullable: true), Duration = table.Column(type: "time", nullable: false), Width = table.Column(type: "int", nullable: false), Height = table.Column(type: "int", nullable: false), Extension = table.Column(type: "nvarchar(max)", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Videos", x => x.Id); }); migrationBuilder.CreateTable( name: "VideoTags", columns: table => new { VideoId = table.Column(type: "nvarchar(450)", nullable: false), TagId = table.Column(type: "nvarchar(450)", nullable: false) }, constraints: table => { table.PrimaryKey("PK_VideoTags", x => new { x.VideoId, x.TagId }); table.ForeignKey( name: "FK_VideoTags_Tags_TagId", column: x => x.TagId, principalTable: "Tags", principalColumn: "Name", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_VideoTags_Videos_VideoId", column: x => x.VideoId, principalTable: "Videos", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_VideoTags_TagId", table: "VideoTags", column: "TagId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Settings"); migrationBuilder.DropTable( name: "VideoTags"); migrationBuilder.DropTable( name: "Tags"); migrationBuilder.DropTable( name: "Videos"); } } }