From 7b715eb1883c9caf7d4b5143b8f7720dd663acd8 Mon Sep 17 00:00:00 2001 From: ivarlovlie Date: Thu, 22 Dec 2022 16:31:58 +0100 Subject: feat: Add folder parent --- code/api/Migrations/20221222153132_FolderParent.cs | 211 +++++++++++++++++++++ 1 file changed, 211 insertions(+) create mode 100644 code/api/Migrations/20221222153132_FolderParent.cs (limited to 'code/api/Migrations/20221222153132_FolderParent.cs') diff --git a/code/api/Migrations/20221222153132_FolderParent.cs b/code/api/Migrations/20221222153132_FolderParent.cs new file mode 100644 index 0000000..1525d4c --- /dev/null +++ b/code/api/Migrations/20221222153132_FolderParent.cs @@ -0,0 +1,211 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace I2R.Storage.Api.Migrations +{ + /// + public partial class FolderParent : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "username", + table: "users", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "password", + table: "users", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "last_name", + table: "users", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "first_name", + table: "users", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "name", + table: "permission_groups", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "description", + table: "permission_groups", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "name", + table: "folders", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AddColumn( + name: "parent_id", + table: "folders", + type: "uuid", + nullable: true); + + migrationBuilder.AlterColumn( + name: "name", + table: "files", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "mime_type", + table: "files", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.CreateIndex( + name: "ix_folders_parent_id", + table: "folders", + column: "parent_id"); + + migrationBuilder.AddForeignKey( + name: "fk_folders_folders_parent_id", + table: "folders", + column: "parent_id", + principalTable: "folders", + principalColumn: "id"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "fk_folders_folders_parent_id", + table: "folders"); + + migrationBuilder.DropIndex( + name: "ix_folders_parent_id", + table: "folders"); + + migrationBuilder.DropColumn( + name: "parent_id", + table: "folders"); + + migrationBuilder.AlterColumn( + name: "username", + table: "users", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "password", + table: "users", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "last_name", + table: "users", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "first_name", + table: "users", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "name", + table: "permission_groups", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "description", + table: "permission_groups", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "name", + table: "folders", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "name", + table: "files", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "mime_type", + table: "files", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + } + } +} -- cgit v1.3