55 lines
2.4 KiB
C#
55 lines
2.4 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace Musify.Infrastructure.Persistence.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddUploadIntentTable : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "UploadIntents",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
UserId = table.Column<Guid>(type: "uuid", nullable: false),
|
|
Bucket = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
|
|
Key = table.Column<string>(type: "character varying(512)", maxLength: 512, nullable: false),
|
|
ObjectName = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
|
|
ContentType = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
|
|
ExpectedSizeBytes = table.Column<long>(type: "bigint", nullable: true),
|
|
Purpose = table.Column<int>(type: "integer", nullable: false),
|
|
Status = table.Column<int>(type: "integer", nullable: false),
|
|
ExpiresAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
|
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_UploadIntents", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_UploadIntents_User_UserId",
|
|
column: x => x.UserId,
|
|
principalTable: "User",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_UploadIntents_UserId",
|
|
table: "UploadIntents",
|
|
column: "UserId");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "UploadIntents");
|
|
}
|
|
}
|
|
}
|