using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Diligent.WebAPI.Data.Migrations { public partial class AddedRefreshToken : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "RefreshTokens", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), Token = table.Column(type: "nvarchar(max)", nullable: false), JwtId = table.Column(type: "nvarchar(max)", nullable: false), CreationDate = table.Column(type: "datetime2", nullable: false), ExpiryDate = table.Column(type: "datetime2", nullable: false), Used = table.Column(type: "bit", nullable: false), Invalidated = table.Column(type: "bit", nullable: false), UserId = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK_RefreshTokens", x => x.Id); table.ForeignKey( name: "FK_RefreshTokens_AspNetUsers_UserId", column: x => x.UserId, principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_RefreshTokens_UserId", table: "RefreshTokens", column: "UserId"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "RefreshTokens"); } } }