Catalogger.NET/Catalogger.Backend/Database/Migrations/20241017130936_AddDashboardTokens.cs
2024-10-18 22:13:23 +02:00

47 lines
1.7 KiB
C#

using Microsoft.EntityFrameworkCore.Migrations;
using NodaTime;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace Catalogger.Backend.Database.Migrations
{
/// <inheritdoc />
public partial class AddDashboardTokens : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "api_tokens",
columns: table => new
{
id = table
.Column<int>(type: "integer", nullable: false)
.Annotation(
"Npgsql:ValueGenerationStrategy",
NpgsqlValueGenerationStrategy.IdentityByDefaultColumn
),
dashboard_token = table.Column<string>(type: "text", nullable: false),
user_id = table.Column<string>(type: "text", nullable: false),
access_token = table.Column<string>(type: "text", nullable: false),
refresh_token = table.Column<string>(type: "text", nullable: true),
expires_at = table.Column<Instant>(
type: "timestamp with time zone",
nullable: false
),
},
constraints: table =>
{
table.PrimaryKey("pk_api_tokens", x => x.id);
}
);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(name: "api_tokens");
}
}
}