63 lines
2.5 KiB
C#
63 lines
2.5 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|
|
|
#nullable disable
|
|
|
|
namespace W542.GandalfReborn.Data.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class addTokens : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "AuthCode",
|
|
schema: "gr",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<long>(type: "bigint", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
Expiration = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
|
IsRevoked = table.Column<bool>(type: "boolean", nullable: false),
|
|
Code = table.Column<string>(type: "text", nullable: false),
|
|
Challenge = table.Column<string>(type: "text", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_AuthCode", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "TokenMetadata",
|
|
schema: "gr",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<long>(type: "bigint", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
Expiration = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
|
IsRevoked = table.Column<bool>(type: "boolean", nullable: false),
|
|
TokenType = table.Column<string>(type: "text", nullable: false),
|
|
UsedBy = table.Column<long>(type: "bigint", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_TokenMetadata", x => x.Id);
|
|
});
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "AuthCode",
|
|
schema: "gr");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "TokenMetadata",
|
|
schema: "gr");
|
|
}
|
|
}
|
|
}
|