Files
Swarm/DysonNetwork.Zone/Migrations/20251119140708_AddPublicationSites.cs

76 lines
3.5 KiB
C#

using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Migrations;
using NodaTime;
#nullable disable
namespace DysonNetwork.Zone.Migrations
{
/// <inheritdoc />
public partial class AddPublicationSites : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "publication_sites",
columns: table => new
{
id = table.Column<Guid>(type: "uuid", nullable: false),
slug = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: false),
name = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: false),
description = table.Column<string>(type: "character varying(8192)", maxLength: 8192, nullable: true),
publisher_id = table.Column<Guid>(type: "uuid", nullable: false),
account_id = table.Column<Guid>(type: "uuid", 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_publication_sites", x => x.id);
});
migrationBuilder.CreateTable(
name: "publication_pages",
columns: table => new
{
id = table.Column<Guid>(type: "uuid", nullable: false),
preset = table.Column<string>(type: "character varying(8192)", maxLength: 8192, nullable: false),
path = table.Column<string>(type: "character varying(8192)", maxLength: 8192, nullable: false),
config = table.Column<Dictionary<string, object>>(type: "jsonb", nullable: false),
site_id = table.Column<Guid>(type: "uuid", 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_publication_pages", x => x.id);
table.ForeignKey(
name: "fk_publication_pages_publication_sites_site_id",
column: x => x.site_id,
principalTable: "publication_sites",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "ix_publication_pages_site_id",
table: "publication_pages",
column: "site_id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "publication_pages");
migrationBuilder.DropTable(
name: "publication_sites");
}
}
}