using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace ClipForge.Infrastructure.Data.Migrations { /// public partial class InitialCreate : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "SocialAccounts", columns: table => new { Id = table.Column(type: "uuid", nullable: false), Platform = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), AccountName = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), AccessToken = table.Column(type: "character varying(2000)", maxLength: 2000, nullable: true), RefreshToken = table.Column(type: "character varying(2000)", maxLength: 2000, nullable: true), TokenExpiresAt = table.Column(type: "timestamp with time zone", nullable: true), IsActive = table.Column(type: "boolean", nullable: false), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true) }, constraints: table => { table.PrimaryKey("PK_SocialAccounts", x => x.Id); }); migrationBuilder.CreateTable( name: "VideoIdeas", columns: table => new { Id = table.Column(type: "uuid", nullable: false), Topic = table.Column(type: "character varying(500)", maxLength: 500, nullable: false), Title = table.Column(type: "character varying(500)", maxLength: 500, nullable: false), Hook = table.Column(type: "character varying(1000)", maxLength: 1000, nullable: false), TargetAudience = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), Platform = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), Status = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), Niche = table.Column(type: "character varying(200)", maxLength: 200, nullable: true), Tags = table.Column(type: "character varying(1000)", maxLength: 1000, nullable: true), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true) }, constraints: table => { table.PrimaryKey("PK_VideoIdeas", x => x.Id); }); migrationBuilder.CreateTable( name: "VideoScripts", columns: table => new { Id = table.Column(type: "uuid", nullable: false), VideoIdeaId = table.Column(type: "uuid", nullable: false), ScriptText = table.Column(type: "text", nullable: false), Scenes = table.Column(type: "text", nullable: false), EstimatedDurationSeconds = table.Column(type: "integer", nullable: false), Tone = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), Language = table.Column(type: "character varying(10)", maxLength: 10, nullable: false), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true) }, constraints: table => { table.PrimaryKey("PK_VideoScripts", x => x.Id); table.ForeignKey( name: "FK_VideoScripts_VideoIdeas_VideoIdeaId", column: x => x.VideoIdeaId, principalTable: "VideoIdeas", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "VideoAssets", columns: table => new { Id = table.Column(type: "uuid", nullable: false), VideoScriptId = table.Column(type: "uuid", nullable: false), FilePath = table.Column(type: "character varying(1000)", maxLength: 1000, nullable: false), ThumbnailPath = table.Column(type: "character varying(1000)", maxLength: 1000, nullable: false), Width = table.Column(type: "integer", nullable: false), Height = table.Column(type: "integer", nullable: false), DurationSeconds = table.Column(type: "double precision", nullable: false), FileSizeBytes = table.Column(type: "bigint", nullable: false), Format = table.Column(type: "character varying(10)", maxLength: 10, nullable: false), Status = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true) }, constraints: table => { table.PrimaryKey("PK_VideoAssets", x => x.Id); table.ForeignKey( name: "FK_VideoAssets_VideoScripts_VideoScriptId", column: x => x.VideoScriptId, principalTable: "VideoScripts", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "VoiceAssets", columns: table => new { Id = table.Column(type: "uuid", nullable: false), VideoScriptId = table.Column(type: "uuid", nullable: false), FilePath = table.Column(type: "character varying(1000)", maxLength: 1000, nullable: false), VoiceProvider = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), VoiceId = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), DurationSeconds = table.Column(type: "double precision", nullable: false), FileSizeBytes = table.Column(type: "bigint", nullable: false), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true) }, constraints: table => { table.PrimaryKey("PK_VoiceAssets", x => x.Id); table.ForeignKey( name: "FK_VoiceAssets_VideoScripts_VideoScriptId", column: x => x.VideoScriptId, principalTable: "VideoScripts", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "CaptionAssets", columns: table => new { Id = table.Column(type: "uuid", nullable: false), VideoAssetId = table.Column(type: "uuid", nullable: false), SrtFilePath = table.Column(type: "character varying(1000)", maxLength: 1000, nullable: false), CaptionStyle = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), FontFamily = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), FontSize = table.Column(type: "integer", nullable: false), FontColor = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), StrokeColor = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), StrokeWidth = table.Column(type: "integer", nullable: false), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true) }, constraints: table => { table.PrimaryKey("PK_CaptionAssets", x => x.Id); table.ForeignKey( name: "FK_CaptionAssets_VideoAssets_VideoAssetId", column: x => x.VideoAssetId, principalTable: "VideoAssets", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "PublishJobs", columns: table => new { Id = table.Column(type: "uuid", nullable: false), VideoAssetId = table.Column(type: "uuid", nullable: false), SocialAccountId = table.Column(type: "uuid", nullable: true), Platform = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), Status = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), ScheduledAt = table.Column(type: "timestamp with time zone", nullable: true), PublishedAt = table.Column(type: "timestamp with time zone", nullable: true), ExternalId = table.Column(type: "character varying(500)", maxLength: 500, nullable: true), ErrorMessage = table.Column(type: "character varying(2000)", maxLength: 2000, nullable: true), Caption = table.Column(type: "character varying(2000)", maxLength: 2000, nullable: true), Hashtags = table.Column(type: "character varying(1000)", maxLength: 1000, nullable: true), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true) }, constraints: table => { table.PrimaryKey("PK_PublishJobs", x => x.Id); table.ForeignKey( name: "FK_PublishJobs_SocialAccounts_SocialAccountId", column: x => x.SocialAccountId, principalTable: "SocialAccounts", principalColumn: "Id"); table.ForeignKey( name: "FK_PublishJobs_VideoAssets_VideoAssetId", column: x => x.VideoAssetId, principalTable: "VideoAssets", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_CaptionAssets_VideoAssetId", table: "CaptionAssets", column: "VideoAssetId", unique: true); migrationBuilder.CreateIndex( name: "IX_PublishJobs_SocialAccountId", table: "PublishJobs", column: "SocialAccountId"); migrationBuilder.CreateIndex( name: "IX_PublishJobs_VideoAssetId", table: "PublishJobs", column: "VideoAssetId"); migrationBuilder.CreateIndex( name: "IX_VideoAssets_VideoScriptId", table: "VideoAssets", column: "VideoScriptId", unique: true); migrationBuilder.CreateIndex( name: "IX_VideoScripts_VideoIdeaId", table: "VideoScripts", column: "VideoIdeaId", unique: true); migrationBuilder.CreateIndex( name: "IX_VoiceAssets_VideoScriptId", table: "VoiceAssets", column: "VideoScriptId", unique: true); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "CaptionAssets"); migrationBuilder.DropTable( name: "PublishJobs"); migrationBuilder.DropTable( name: "VoiceAssets"); migrationBuilder.DropTable( name: "SocialAccounts"); migrationBuilder.DropTable( name: "VideoAssets"); migrationBuilder.DropTable( name: "VideoScripts"); migrationBuilder.DropTable( name: "VideoIdeas"); } } }