using System;
using Microsoft.EntityFrameworkCore.Migrations;
using NodaTime;
#nullable disable
namespace DysonNetwork.Sphere.Migrations
{
///
public partial class AddPermission : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn(
name: "topic",
table: "notifications",
type: "character varying(1024)",
maxLength: 1024,
nullable: false,
defaultValue: "");
migrationBuilder.CreateTable(
name: "permission_groups",
columns: table => new
{
id = table.Column(type: "uuid", nullable: false),
key = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: false),
created_at = table.Column(type: "timestamp with time zone", nullable: false),
updated_at = table.Column(type: "timestamp with time zone", nullable: false),
deleted_at = table.Column(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("pk_permission_groups", x => x.id);
});
migrationBuilder.CreateTable(
name: "permission_group_member",
columns: table => new
{
group_id = table.Column(type: "uuid", nullable: false),
account_id = table.Column(type: "bigint", nullable: false),
expired_at = table.Column(type: "timestamp with time zone", nullable: true),
affected_at = table.Column(type: "timestamp with time zone", nullable: true),
created_at = table.Column(type: "timestamp with time zone", nullable: false),
updated_at = table.Column(type: "timestamp with time zone", nullable: false),
deleted_at = table.Column(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("pk_permission_group_member", x => new { x.group_id, x.account_id });
table.ForeignKey(
name: "fk_permission_group_member_accounts_account_id",
column: x => x.account_id,
principalTable: "accounts",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "fk_permission_group_member_permission_groups_group_id",
column: x => x.group_id,
principalTable: "permission_groups",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "permission_nodes",
columns: table => new
{
id = table.Column(type: "uuid", nullable: false),
actor = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: false),
area = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: false),
key = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: false),
value = table.Column