51 lines
1.9 KiB
C#
51 lines
1.9 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace GestorFacturas.API.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddRefreshTokens : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "RefreshTokens",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
Token = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
Expires = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
Created = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
Revoked = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
UsuarioId = table.Column<int>(type: "int", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_RefreshTokens", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_RefreshTokens_Usuarios_UsuarioId",
|
|
column: x => x.UsuarioId,
|
|
principalTable: "Usuarios",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_RefreshTokens_UsuarioId",
|
|
table: "RefreshTokens",
|
|
column: "UsuarioId");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "RefreshTokens");
|
|
}
|
|
}
|
|
}
|