using System; using Microsoft.EntityFrameworkCore.Migrations; using NodaTime; #nullable disable namespace DysonNetwork.Drive.Migrations { /// public partial class AddFileIndex : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "path", table: "tasks", type: "text", nullable: true); migrationBuilder.CreateTable( name: "file_indexes", columns: table => new { id = table.Column(type: "uuid", nullable: false), path = table.Column(type: "character varying(8192)", maxLength: 8192, nullable: false), file_id = table.Column(type: "character varying(32)", maxLength: 32, nullable: false), 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_file_indexes", x => x.id); table.ForeignKey( name: "fk_file_indexes_files_file_id", column: x => x.file_id, principalTable: "files", principalColumn: "id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "ix_file_indexes_file_id", table: "file_indexes", column: "file_id"); migrationBuilder.CreateIndex( name: "ix_file_indexes_path_account_id", table: "file_indexes", columns: new[] { "path", "account_id" }); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "file_indexes"); migrationBuilder.DropColumn( name: "path", table: "tasks"); } } }