app / src /ClipForge.Infrastructure /Data /Migrations /20260517232254_InitialCreate.cs
Vanderson da Silva Quintino
Initial deploy: ClipForge video generator
8fb6238
Raw History Blame Contribute Delete
13.9 kB
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace ClipForge.Infrastructure.Data.Migrations
{
/// <inheritdoc />
public partial class InitialCreate : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "SocialAccounts",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
Platform = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
AccountName = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false),
AccessToken = table.Column<string>(type: "character varying(2000)", maxLength: 2000, nullable: true),
RefreshToken = table.Column<string>(type: "character varying(2000)", maxLength: 2000, nullable: true),
TokenExpiresAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
IsActive = table.Column<bool>(type: "boolean", nullable: false),
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
UpdatedAt = table.Column<DateTime>(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<Guid>(type: "uuid", nullable: false),
Topic = table.Column<string>(type: "character varying(500)", maxLength: 500, nullable: false),
Title = table.Column<string>(type: "character varying(500)", maxLength: 500, nullable: false),
Hook = table.Column<string>(type: "character varying(1000)", maxLength: 1000, nullable: false),
TargetAudience = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false),
Platform = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
Status = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
Niche = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: true),
Tags = table.Column<string>(type: "character varying(1000)", maxLength: 1000, nullable: true),
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
UpdatedAt = table.Column<DateTime>(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<Guid>(type: "uuid", nullable: false),
VideoIdeaId = table.Column<Guid>(type: "uuid", nullable: false),
ScriptText = table.Column<string>(type: "text", nullable: false),
Scenes = table.Column<string>(type: "text", nullable: false),
EstimatedDurationSeconds = table.Column<int>(type: "integer", nullable: false),
Tone = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
Language = table.Column<string>(type: "character varying(10)", maxLength: 10, nullable: false),
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
UpdatedAt = table.Column<DateTime>(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<Guid>(type: "uuid", nullable: false),
VideoScriptId = table.Column<Guid>(type: "uuid", nullable: false),
FilePath = table.Column<string>(type: "character varying(1000)", maxLength: 1000, nullable: false),
ThumbnailPath = table.Column<string>(type: "character varying(1000)", maxLength: 1000, nullable: false),
Width = table.Column<int>(type: "integer", nullable: false),
Height = table.Column<int>(type: "integer", nullable: false),
DurationSeconds = table.Column<double>(type: "double precision", nullable: false),
FileSizeBytes = table.Column<long>(type: "bigint", nullable: false),
Format = table.Column<string>(type: "character varying(10)", maxLength: 10, nullable: false),
Status = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
UpdatedAt = table.Column<DateTime>(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<Guid>(type: "uuid", nullable: false),
VideoScriptId = table.Column<Guid>(type: "uuid", nullable: false),
FilePath = table.Column<string>(type: "character varying(1000)", maxLength: 1000, nullable: false),
VoiceProvider = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
VoiceId = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
DurationSeconds = table.Column<double>(type: "double precision", nullable: false),
FileSizeBytes = table.Column<long>(type: "bigint", nullable: false),
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
UpdatedAt = table.Column<DateTime>(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<Guid>(type: "uuid", nullable: false),
VideoAssetId = table.Column<Guid>(type: "uuid", nullable: false),
SrtFilePath = table.Column<string>(type: "character varying(1000)", maxLength: 1000, nullable: false),
CaptionStyle = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
FontFamily = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
FontSize = table.Column<int>(type: "integer", nullable: false),
FontColor = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false),
StrokeColor = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false),
StrokeWidth = table.Column<int>(type: "integer", nullable: false),
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
UpdatedAt = table.Column<DateTime>(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<Guid>(type: "uuid", nullable: false),
VideoAssetId = table.Column<Guid>(type: "uuid", nullable: false),
SocialAccountId = table.Column<Guid>(type: "uuid", nullable: true),
Platform = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
Status = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
ScheduledAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
PublishedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
ExternalId = table.Column<string>(type: "character varying(500)", maxLength: 500, nullable: true),
ErrorMessage = table.Column<string>(type: "character varying(2000)", maxLength: 2000, nullable: true),
Caption = table.Column<string>(type: "character varying(2000)", maxLength: 2000, nullable: true),
Hashtags = table.Column<string>(type: "character varying(1000)", maxLength: 1000, nullable: true),
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
UpdatedAt = table.Column<DateTime>(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);
}
/// <inheritdoc />
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");
}
}
}