74 lines
3.1 KiB
C#
74 lines
3.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using DysonNetwork.Shared.Models;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
using NodaTime;
|
|
|
|
#nullable disable
|
|
|
|
namespace DysonNetwork.Insight.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddThinkingThought : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "thinking_sequences",
|
|
columns: table => new
|
|
{
|
|
id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
topic = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: true),
|
|
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_thinking_sequences", x => x.id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "thinking_thoughts",
|
|
columns: table => new
|
|
{
|
|
id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
content = table.Column<string>(type: "text", nullable: true),
|
|
files = table.Column<List<SnCloudFileReferenceObject>>(type: "jsonb", nullable: false),
|
|
role = table.Column<int>(type: "integer", nullable: false),
|
|
sequence_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_thinking_thoughts", x => x.id);
|
|
table.ForeignKey(
|
|
name: "fk_thinking_thoughts_thinking_sequences_sequence_id",
|
|
column: x => x.sequence_id,
|
|
principalTable: "thinking_sequences",
|
|
principalColumn: "id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "ix_thinking_thoughts_sequence_id",
|
|
table: "thinking_thoughts",
|
|
column: "sequence_id");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "thinking_thoughts");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "thinking_sequences");
|
|
}
|
|
}
|
|
}
|