114 lines
3.4 KiB
C#
114 lines
3.4 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace Watcher.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class ContainerUpdate : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_Containers_Servers_HostServerId",
|
|
table: "Containers");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_Containers_HostServerId",
|
|
table: "Containers");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "CreatedAt",
|
|
table: "Containers");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "ExposedPort",
|
|
table: "Containers");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "Health",
|
|
table: "Containers");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "HostServerId",
|
|
table: "Containers");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "Status",
|
|
table: "Containers");
|
|
|
|
migrationBuilder.RenameColumn(
|
|
name: "InternalPort",
|
|
table: "Containers",
|
|
newName: "ServerId");
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "ContainerId",
|
|
table: "Containers",
|
|
type: "TEXT",
|
|
nullable: true);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropColumn(
|
|
name: "ContainerId",
|
|
table: "Containers");
|
|
|
|
migrationBuilder.RenameColumn(
|
|
name: "ServerId",
|
|
table: "Containers",
|
|
newName: "InternalPort");
|
|
|
|
migrationBuilder.AddColumn<DateTime>(
|
|
name: "CreatedAt",
|
|
table: "Containers",
|
|
type: "TEXT",
|
|
nullable: false,
|
|
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
|
|
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "ExposedPort",
|
|
table: "Containers",
|
|
type: "INTEGER",
|
|
nullable: false,
|
|
defaultValue: 0);
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "Health",
|
|
table: "Containers",
|
|
type: "TEXT",
|
|
nullable: false,
|
|
defaultValue: "");
|
|
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "HostServerId",
|
|
table: "Containers",
|
|
type: "INTEGER",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "Status",
|
|
table: "Containers",
|
|
type: "TEXT",
|
|
nullable: false,
|
|
defaultValue: "");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Containers_HostServerId",
|
|
table: "Containers",
|
|
column: "HostServerId");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_Containers_Servers_HostServerId",
|
|
table: "Containers",
|
|
column: "HostServerId",
|
|
principalTable: "Servers",
|
|
principalColumn: "Id");
|
|
}
|
|
}
|
|
}
|