using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace ManagerService.Migrations
{
///
public partial class AddUserRole : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn(
name: "Role",
table: "Users",
type: "integer",
nullable: false,
defaultValue: 0);
migrationBuilder.CreateTable(
name: "ApiKeys",
columns: table => new
{
Id = table.Column(type: "text", nullable: false),
Key = table.Column(type: "text", nullable: true),
KeyHash = table.Column(type: "text", nullable: true),
Name = table.Column(type: "text", nullable: false),
InstanceId = table.Column(type: "text", nullable: false),
AppType = table.Column(type: "integer", nullable: false),
IsActive = table.Column(type: "boolean", nullable: false),
DateCreation = table.Column(type: "timestamp with time zone", nullable: false),
DateExpiration = table.Column(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_ApiKeys", x => x.Id);
table.ForeignKey(
name: "FK_ApiKeys_Instances_InstanceId",
column: x => x.InstanceId,
principalTable: "Instances",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_ApiKeys_InstanceId",
table: "ApiKeys",
column: "InstanceId");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ApiKeys");
migrationBuilder.DropColumn(
name: "Role",
table: "Users");
}
}
}