- Introduced `docker-compose.prod.yml` for production deployment. - Configured service to connect to an external PostgreSQL instance. - Set environment variables for JWT and database connection strings. - Defined network and volume for data protection keys.
79 lines
2.9 KiB
C#
79 lines
2.9 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace OTSSignsOrchestrator.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class RemoveOperatorAuth : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "refresh_tokens");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "operators");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "operators",
|
|
columns: table => new
|
|
{
|
|
id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
created_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
|
email = table.Column<string>(type: "text", nullable: false),
|
|
password_hash = table.Column<string>(type: "text", nullable: false),
|
|
role = table.Column<string>(type: "text", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("pk_operators", x => x.id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "refresh_tokens",
|
|
columns: table => new
|
|
{
|
|
id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
operator_id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
expires_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
|
revoked_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
|
|
token = table.Column<string>(type: "text", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("pk_refresh_tokens", x => x.id);
|
|
table.ForeignKey(
|
|
name: "fk_refresh_tokens_operators_operator_id",
|
|
column: x => x.operator_id,
|
|
principalTable: "operators",
|
|
principalColumn: "id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_operators_email",
|
|
table: "operators",
|
|
column: "email",
|
|
unique: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "ix_refresh_tokens_operator_id",
|
|
table: "refresh_tokens",
|
|
column: "operator_id");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_refresh_tokens_token",
|
|
table: "refresh_tokens",
|
|
column: "token",
|
|
unique: true);
|
|
}
|
|
}
|
|
}
|