using System; using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace Backend.Migrations { /// public partial class AddTeamManagement : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "TeamMembers", columns: table => new { Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Login = table.Column(type: "character varying(80)", maxLength: 80, nullable: false), DisplayName = table.Column(type: "character varying(120)", maxLength: 120, nullable: false), Role = table.Column(type: "character varying(40)", maxLength: 40, nullable: false), PasswordHash = table.Column(type: "character varying(120)", maxLength: 120, nullable: false), PasswordSalt = table.Column(type: "character varying(80)", maxLength: 80, nullable: false), MustChangePassword = table.Column(type: "boolean", nullable: false), IsActive = table.Column(type: "boolean", nullable: false), CreatedByTwitchId = table.Column(type: "character varying(120)", maxLength: 120, nullable: false), UpdatedByTwitchId = table.Column(type: "character varying(120)", maxLength: 120, nullable: true), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), LastLoginAt = table.Column(type: "timestamp with time zone", nullable: true), PasswordResetAt = table.Column(type: "timestamp with time zone", nullable: true) }, constraints: table => { table.PrimaryKey("PK_TeamMembers", x => x.Id); }); migrationBuilder.CreateTable( name: "TeamRolePermissions", columns: table => new { Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Role = table.Column(type: "character varying(40)", maxLength: 40, nullable: false), PermissionsJson = table.Column(type: "text", nullable: false), UpdatedByTwitchId = table.Column(type: "character varying(120)", maxLength: 120, nullable: false), UpdatedAt = table.Column(type: "timestamp with time zone", nullable: false) }, constraints: table => { table.PrimaryKey("PK_TeamRolePermissions", x => x.Id); }); migrationBuilder.CreateIndex( name: "IX_TeamMembers_Login", table: "TeamMembers", column: "Login", unique: true); migrationBuilder.CreateIndex( name: "IX_TeamRolePermissions_Role", table: "TeamRolePermissions", column: "Role", unique: true); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "TeamMembers"); migrationBuilder.DropTable( name: "TeamRolePermissions"); } } }