using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using System; using System.Collections.Generic; namespace YTManager.Migrations { public partial class initial : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Channels", columns: table => new { ChannelId = table.Column(type: "int8", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn), Description = table.Column(type: "text", nullable: false), ThumbnailURL = table.Column(type: "text", nullable: false), Title = table.Column(type: "text", nullable: false), YTChannelID = table.Column(type: "text", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Channels", x => x.ChannelId); }); migrationBuilder.CreateTable( name: "Videos", columns: table => new { VideoId = table.Column(type: "int8", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn), AddedtoDB = table.Column(type: "timestamp", nullable: false), ChannelId = table.Column(type: "int8", nullable: false), Description = table.Column(type: "text", nullable: false), ThumbnailURL = table.Column(type: "text", nullable: false), Title = table.Column(type: "text", nullable: false), Uploaded = table.Column(type: "timestamp", nullable: false), YTVideoID = table.Column(type: "text", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Videos", x => x.VideoId); table.ForeignKey( name: "FK_Videos_Channels_ChannelId", column: x => x.ChannelId, principalTable: "Channels", principalColumn: "ChannelId", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_Videos_ChannelId", table: "Videos", column: "ChannelId"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Videos"); migrationBuilder.DropTable( name: "Channels"); } } }