80 lines
2.7 KiB
C#
80 lines
2.7 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace LightlessSyncServer.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddGroupProfilesAndDates : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.AddColumn<DateTime>(
|
|
name: "created_date",
|
|
table: "groups",
|
|
type: "timestamp with time zone",
|
|
nullable: false,
|
|
defaultValueSql: "CURRENT_TIMESTAMP");
|
|
|
|
migrationBuilder.AddColumn<bool>(
|
|
name: "from_finder",
|
|
table: "group_pairs",
|
|
type: "boolean",
|
|
nullable: false,
|
|
defaultValue: false);
|
|
|
|
migrationBuilder.AddColumn<DateTime>(
|
|
name: "joined_group_on",
|
|
table: "group_pairs",
|
|
type: "timestamp with time zone",
|
|
nullable: true);
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "group_profiles",
|
|
columns: table => new
|
|
{
|
|
group_gid = table.Column<string>(type: "character varying(20)", nullable: false),
|
|
description = table.Column<string>(type: "text", nullable: true),
|
|
tags = table.Column<string>(type: "text", nullable: true),
|
|
base64group_profile_image = table.Column<string>(type: "text", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("pk_group_profiles", x => x.group_gid);
|
|
table.ForeignKey(
|
|
name: "fk_group_profiles_groups_group_gid",
|
|
column: x => x.group_gid,
|
|
principalTable: "groups",
|
|
principalColumn: "gid",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "ix_group_profiles_group_gid",
|
|
table: "group_profiles",
|
|
column: "group_gid");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "group_profiles");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "created_date",
|
|
table: "groups");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "from_finder",
|
|
table: "group_pairs");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "joined_group_on",
|
|
table: "group_pairs");
|
|
}
|
|
}
|
|
}
|