using System; using System.Collections.Generic; using DysonNetwork.Shared.Data; using Microsoft.EntityFrameworkCore.Migrations; using NodaTime; #nullable disable namespace DysonNetwork.Pass.Migrations { /// public partial class RemoveDevelopers : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "fk_auth_sessions_custom_apps_app_id", table: "auth_sessions"); migrationBuilder.DropTable( name: "custom_app_secrets"); migrationBuilder.DropTable( name: "custom_apps"); migrationBuilder.DropIndex( name: "ix_auth_sessions_app_id", table: "auth_sessions"); migrationBuilder.CreateTable( name: "punishments", columns: table => new { id = table.Column(type: "uuid", nullable: false), reason = table.Column(type: "character varying(8192)", maxLength: 8192, nullable: false), expired_at = table.Column(type: "timestamp with time zone", nullable: true), type = table.Column(type: "integer", nullable: false), blocked_permissions = table.Column>(type: "jsonb", nullable: true), account_id = table.Column(type: "uuid", 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_punishments", x => x.id); table.ForeignKey( name: "fk_punishments_accounts_account_id", column: x => x.account_id, principalTable: "accounts", principalColumn: "id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "ix_punishments_account_id", table: "punishments", column: "account_id"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "punishments"); migrationBuilder.CreateTable( name: "custom_apps", columns: table => new { id = table.Column(type: "uuid", nullable: false), background = table.Column(type: "jsonb", nullable: true), created_at = table.Column(type: "timestamp with time zone", nullable: false), deleted_at = table.Column(type: "timestamp with time zone", nullable: true), description = table.Column(type: "character varying(4096)", maxLength: 4096, nullable: true), name = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: false), picture = table.Column(type: "jsonb", nullable: true), slug = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: false), status = table.Column(type: "integer", nullable: false), updated_at = table.Column(type: "timestamp with time zone", nullable: false), verification = table.Column(type: "jsonb", nullable: true) }, constraints: table => { table.PrimaryKey("pk_custom_apps", x => x.id); }); migrationBuilder.CreateTable( name: "custom_app_secrets", columns: table => new { id = table.Column(type: "uuid", nullable: false), app_id = table.Column(type: "uuid", nullable: false), created_at = table.Column(type: "timestamp with time zone", nullable: false), deleted_at = table.Column(type: "timestamp with time zone", nullable: true), description = table.Column(type: "character varying(4096)", maxLength: 4096, nullable: true), expired_at = table.Column(type: "timestamp with time zone", nullable: true), is_oidc = table.Column(type: "boolean", nullable: false), secret = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: false), updated_at = table.Column(type: "timestamp with time zone", nullable: false) }, constraints: table => { table.PrimaryKey("pk_custom_app_secrets", x => x.id); table.ForeignKey( name: "fk_custom_app_secrets_custom_apps_app_id", column: x => x.app_id, principalTable: "custom_apps", principalColumn: "id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "ix_auth_sessions_app_id", table: "auth_sessions", column: "app_id"); migrationBuilder.CreateIndex( name: "ix_custom_app_secrets_app_id", table: "custom_app_secrets", column: "app_id"); migrationBuilder.AddForeignKey( name: "fk_auth_sessions_custom_apps_app_id", table: "auth_sessions", column: "app_id", principalTable: "custom_apps", principalColumn: "id"); } } }