using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Mws.Infrastructure.Migrations { /// public partial class AddMemberDocumentPermissions : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "CanCreateDocuments", table: "project_members", type: "boolean", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "CanDeleteDocuments", table: "project_members", type: "boolean", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "CanEditDocuments", table: "project_members", type: "boolean", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "CanViewDocuments", table: "project_members", type: "boolean", nullable: false, defaultValue: false); migrationBuilder.Sql("UPDATE \"project_members\" SET \"CanViewDocuments\" = true, \"CanCreateDocuments\" = true, \"CanEditDocuments\" = true, \"CanDeleteDocuments\" = true WHERE \"Role\" = 'Owner';"); migrationBuilder.Sql("UPDATE \"project_members\" SET \"CanViewDocuments\" = true WHERE \"Role\" = 'Member';"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropColumn( name: "CanCreateDocuments", table: "project_members"); migrationBuilder.DropColumn( name: "CanDeleteDocuments", table: "project_members"); migrationBuilder.DropColumn( name: "CanEditDocuments", table: "project_members"); migrationBuilder.DropColumn( name: "CanViewDocuments", table: "project_members"); } } }