using System; using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace ROLAC.API.Migrations { /// public partial class AddUserInvitations : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "UserInvitations", columns: table => new { Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), UserId = table.Column(type: "character varying(450)", maxLength: 450, nullable: false), TokenHash = table.Column(type: "character varying(64)", maxLength: 64, nullable: false), ExpiresAt = table.Column(type: "timestamp with time zone", nullable: false), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), CreatedBy = table.Column(type: "character varying(450)", maxLength: 450, nullable: false), UsedAt = table.Column(type: "timestamp with time zone", nullable: true), RevokedAt = table.Column(type: "timestamp with time zone", nullable: true) }, constraints: table => { table.PrimaryKey("PK_UserInvitations", x => x.Id); table.ForeignKey( name: "FK_UserInvitations_AspNetUsers_UserId", column: x => x.UserId, principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_UserInvitations_TokenHash", table: "UserInvitations", column: "TokenHash", unique: true); migrationBuilder.CreateIndex( name: "IX_UserInvitations_UserId", table: "UserInvitations", column: "UserId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "UserInvitations"); } } }