Files
Swarm/DysonNetwork.Sphere/Migrations/20250812041519_AddPostFeaturedRecord.cs
2025-08-12 12:17:26 +08:00

52 lines
2.0 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
using NodaTime;
#nullable disable
namespace DysonNetwork.Sphere.Migrations
{
/// <inheritdoc />
public partial class AddPostFeaturedRecord : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "post_featured_records",
columns: table => new
{
id = table.Column<Guid>(type: "uuid", nullable: false),
post_id = table.Column<Guid>(type: "uuid", nullable: false),
featured_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
social_credits = table.Column<int>(type: "integer", nullable: false),
created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("pk_post_featured_records", x => x.id);
table.ForeignKey(
name: "fk_post_featured_records_posts_post_id",
column: x => x.post_id,
principalTable: "posts",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "ix_post_featured_records_post_id",
table: "post_featured_records",
column: "post_id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "post_featured_records");
}
}
}