using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace FreeTubeSync.Migrations { /// public partial class UpdateNewLayout : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Subscriptions"); migrationBuilder.DropTable( name: "Videos"); migrationBuilder.CreateTable( name: "Subscription", columns: table => new { id = table.Column(type: "TEXT", nullable: false), Profile_id = table.Column(type: "TEXT", nullable: false), name = table.Column(type: "TEXT", nullable: false), thumbnail = table.Column(type: "TEXT", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Subscription", x => new { x.Profile_id, x.id }); table.ForeignKey( name: "FK_Subscription_Profiles_Profile_id", column: x => x.Profile_id, principalTable: "Profiles", principalColumn: "_id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "Video", columns: table => new { videoId = table.Column(type: "TEXT", nullable: false), Playlist_id = table.Column(type: "TEXT", nullable: false), title = table.Column(type: "TEXT", nullable: false), author = table.Column(type: "TEXT", nullable: false), authorId = table.Column(type: "TEXT", nullable: false), lengthSeconds = table.Column(type: "TEXT", nullable: false), published = table.Column(type: "INTEGER", nullable: false), timeAdded = table.Column(type: "INTEGER", nullable: false), playlistItemId = table.Column(type: "TEXT", nullable: false), type = table.Column(type: "TEXT", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Video", x => new { x.Playlist_id, x.videoId }); table.ForeignKey( name: "FK_Video_Playlists_Playlist_id", column: x => x.Playlist_id, principalTable: "Playlists", principalColumn: "_id", onDelete: ReferentialAction.Cascade); }); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Subscription"); migrationBuilder.DropTable( name: "Video"); migrationBuilder.CreateTable( name: "Subscriptions", columns: table => new { id = table.Column(type: "TEXT", nullable: false), Profile_id = table.Column(type: "TEXT", nullable: true), name = table.Column(type: "TEXT", nullable: false), thumbnail = table.Column(type: "TEXT", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Subscriptions", x => x.id); table.ForeignKey( name: "FK_Subscriptions_Profiles_Profile_id", column: x => x.Profile_id, principalTable: "Profiles", principalColumn: "_id"); }); migrationBuilder.CreateTable( name: "Videos", columns: table => new { playlistItemId = table.Column(type: "TEXT", nullable: false), Playlist_id = table.Column(type: "TEXT", nullable: true), author = table.Column(type: "TEXT", nullable: false), authorId = table.Column(type: "TEXT", nullable: false), lengthSeconds = table.Column(type: "TEXT", nullable: false), pubished = table.Column(type: "INTEGER", nullable: false), timeAdded = table.Column(type: "INTEGER", nullable: false), title = table.Column(type: "TEXT", nullable: false), type = table.Column(type: "TEXT", nullable: false), videoId = table.Column(type: "TEXT", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Videos", x => x.playlistItemId); table.ForeignKey( name: "FK_Videos_Playlists_Playlist_id", column: x => x.Playlist_id, principalTable: "Playlists", principalColumn: "_id"); }); migrationBuilder.CreateIndex( name: "IX_Subscriptions_Profile_id", table: "Subscriptions", column: "Profile_id"); migrationBuilder.CreateIndex( name: "IX_Videos_Playlist_id", table: "Videos", column: "Playlist_id"); } } }