using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Manager.Data.Migrations { /// public partial class InitialLibrary : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "channels", columns: table => new { Id = table.Column(type: "TEXT", maxLength: 100, nullable: false), Name = table.Column(type: "TEXT", maxLength: 100, nullable: true), Description = table.Column(type: "TEXT", maxLength: 500, nullable: true), JoinedDate = table.Column(type: "TEXT", nullable: false), Subscribers = table.Column(type: "INTEGER", nullable: false), TotalVideos = table.Column(type: "INTEGER", nullable: false), TotalViews = table.Column(type: "INTEGER", nullable: false), CreatedAtUtc = table.Column(type: "TEXT", nullable: false), LastModifiedUtc = table.Column(type: "TEXT", nullable: false) }, constraints: table => { table.PrimaryKey("PK_channels", x => x.Id); }); migrationBuilder.CreateTable( name: "client_accounts", columns: table => new { Id = table.Column(type: "TEXT", maxLength: 100, nullable: false), UserAgent = table.Column(type: "TEXT", maxLength: 100, nullable: true), CreatedAtUtc = table.Column(type: "TEXT", nullable: false), LastModifiedUtc = table.Column(type: "TEXT", nullable: false) }, constraints: table => { table.PrimaryKey("PK_client_accounts", x => x.Id); table.ForeignKey( name: "FK_client_accounts_channels_Id", column: x => x.Id, principalTable: "channels", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "media", columns: table => new { Id = table.Column(type: "TEXT", maxLength: 100, nullable: false), Title = table.Column(type: "TEXT", maxLength: 100, nullable: true), Description = table.Column(type: "TEXT", maxLength: 500, nullable: true), UploadDateUtc = table.Column(type: "TEXT", nullable: false), ChannelId = table.Column(type: "TEXT", maxLength: 100, nullable: false), ExternalState = table.Column(type: "INTEGER", nullable: false), IsDownloaded = table.Column(type: "INTEGER", nullable: false), State = table.Column(type: "INTEGER", nullable: false), CreatedAtUtc = table.Column(type: "TEXT", nullable: false), LastModifiedUtc = table.Column(type: "TEXT", nullable: false) }, constraints: table => { table.PrimaryKey("PK_media", x => x.Id); table.ForeignKey( name: "FK_media_channels_ChannelId", column: x => x.ChannelId, principalTable: "channels", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "playlists", columns: table => new { Id = table.Column(type: "TEXT", maxLength: 100, nullable: false), Name = table.Column(type: "TEXT", maxLength: 100, nullable: false), Description = table.Column(type: "TEXT", maxLength: 500, nullable: true), ChannelId = table.Column(type: "TEXT", maxLength: 100, nullable: false), CreatedAtUtc = table.Column(type: "TEXT", nullable: false), LastModifiedUtc = table.Column(type: "TEXT", nullable: false) }, constraints: table => { table.PrimaryKey("PK_playlists", x => x.Id); table.ForeignKey( name: "FK_playlists_channels_ChannelId", column: x => x.ChannelId, principalTable: "channels", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "http_cookies", columns: table => new { Name = table.Column(type: "TEXT", maxLength: 100, nullable: false), Value = table.Column(type: "TEXT", maxLength: 100, nullable: true), Domain = table.Column(type: "TEXT", maxLength: 100, nullable: true), Path = table.Column(type: "TEXT", maxLength: 100, nullable: true), ExpiresUtc = table.Column(type: "TEXT", nullable: true), Secure = table.Column(type: "INTEGER", nullable: false), HttpOnly = table.Column(type: "INTEGER", nullable: false), SameSite = table.Column(type: "TEXT", maxLength: 100, nullable: true), ClientId = table.Column(type: "TEXT", maxLength: 100, nullable: false), CreatedAtUtc = table.Column(type: "TEXT", nullable: false), LastModifiedUtc = table.Column(type: "TEXT", nullable: false) }, constraints: table => { table.PrimaryKey("PK_http_cookies", x => x.Name); table.ForeignKey( name: "FK_http_cookies_client_accounts_ClientId", column: x => x.ClientId, principalTable: "client_accounts", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "captions", columns: table => new { MediaId = table.Column(type: "TEXT", maxLength: 100, nullable: false), LanguageCode = table.Column(type: "TEXT", maxLength: 100, nullable: false), Name = table.Column(type: "TEXT", maxLength: 100, nullable: false) }, constraints: table => { table.PrimaryKey("PK_captions", x => new { x.MediaId, x.LanguageCode }); table.ForeignKey( name: "FK_captions_media_MediaId", column: x => x.MediaId, principalTable: "media", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "media_formats", columns: table => new { MediaId = table.Column(type: "TEXT", maxLength: 100, nullable: false), Itag = table.Column(type: "INTEGER", nullable: false), Quality = table.Column(type: "TEXT", maxLength: 100, nullable: true), IsAdaptive = table.Column(type: "INTEGER", nullable: false), MimeType = table.Column(type: "TEXT", maxLength: 100, nullable: true), Bitrate = table.Column(type: "INTEGER", nullable: false), AverageBitrate = table.Column(type: "INTEGER", nullable: false), LastModifiedUnixEpoch = table.Column(type: "INTEGER", nullable: false), ContentLengthBytes = table.Column(type: "INTEGER", nullable: false), ApproxDurationMs = table.Column(type: "INTEGER", nullable: false), Width = table.Column(type: "INTEGER", nullable: true), Height = table.Column(type: "INTEGER", nullable: true), Framerate = table.Column(type: "REAL", nullable: true), QualityLabel = table.Column(type: "TEXT", maxLength: 100, nullable: true), AudioChannels = table.Column(type: "INTEGER", nullable: true), AudioSampleRate = table.Column(type: "TEXT", maxLength: 100, nullable: true), LoudnessDb = table.Column(type: "REAL", nullable: true) }, constraints: table => { table.PrimaryKey("PK_media_formats", x => new { x.MediaId, x.Itag }); table.ForeignKey( name: "FK_media_formats_media_MediaId", column: x => x.MediaId, principalTable: "media", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "join_playlist_media", columns: table => new { PlaylistId = table.Column(type: "TEXT", maxLength: 100, nullable: false), MediaId = table.Column(type: "TEXT", maxLength: 100, nullable: false), DateAddedUtc = table.Column(type: "TEXT", nullable: false), DateModifiedUtc = table.Column(type: "TEXT", nullable: false) }, constraints: table => { table.PrimaryKey("PK_join_playlist_media", x => new { x.PlaylistId, x.MediaId }); table.ForeignKey( name: "FK_join_playlist_media_media_MediaId", column: x => x.MediaId, principalTable: "media", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_join_playlist_media_playlists_PlaylistId", column: x => x.PlaylistId, principalTable: "playlists", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_http_cookies_ClientId", table: "http_cookies", column: "ClientId"); migrationBuilder.CreateIndex( name: "IX_join_playlist_media_MediaId", table: "join_playlist_media", column: "MediaId"); migrationBuilder.CreateIndex( name: "IX_media_ChannelId", table: "media", column: "ChannelId"); migrationBuilder.CreateIndex( name: "IX_playlists_ChannelId", table: "playlists", column: "ChannelId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "captions"); migrationBuilder.DropTable( name: "http_cookies"); migrationBuilder.DropTable( name: "join_playlist_media"); migrationBuilder.DropTable( name: "media_formats"); migrationBuilder.DropTable( name: "client_accounts"); migrationBuilder.DropTable( name: "playlists"); migrationBuilder.DropTable( name: "media"); migrationBuilder.DropTable( name: "channels"); } } }