using System; using DysonNetwork.Drive.Storage; using Microsoft.EntityFrameworkCore.Migrations; using NodaTime; #nullable disable namespace DysonNetwork.Drive.Migrations { /// public partial class AddCloudFilePool : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "pool_id", table: "files", type: "uuid", nullable: true); migrationBuilder.CreateTable( name: "pools", columns: table => new { id = table.Column(type: "uuid", nullable: false), name = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: false), storage_config = table.Column(type: "jsonb", nullable: false), billing_config = table.Column(type: "jsonb", 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_pools", x => x.id); }); migrationBuilder.CreateIndex( name: "ix_files_pool_id", table: "files", column: "pool_id"); migrationBuilder.AddForeignKey( name: "fk_files_pools_pool_id", table: "files", column: "pool_id", principalTable: "pools", principalColumn: "id"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "fk_files_pools_pool_id", table: "files"); migrationBuilder.DropTable( name: "pools"); migrationBuilder.DropIndex( name: "ix_files_pool_id", table: "files"); migrationBuilder.DropColumn( name: "pool_id", table: "files"); } } }