tgstation-server 6.12.0
The /tg/station 13 server suite
Loading...
Searching...
No Matches
20201222175532_SLAddSwarmIdentifer.cs
Go to the documentation of this file.
1using System;
2
3using Microsoft.EntityFrameworkCore.Migrations;
4
6{
10 public partial class SLAddSwarmIdentifer : Migration
11 {
13 protected override void Up(MigrationBuilder migrationBuilder)
14 {
15 ArgumentNullException.ThrowIfNull(migrationBuilder);
16
17 migrationBuilder.DropIndex(
18 name: "IX_Instances_Path",
19 table: "Instances");
20
21 migrationBuilder.AddColumn<string>(
22 name: "SwarmIdentifer",
23 table: "Instances",
24 nullable: true);
25
26 migrationBuilder.CreateIndex(
27 name: "IX_Instances_Path_SwarmIdentifer",
28 table: "Instances",
29 columns: new[] { "Path", "SwarmIdentifer" },
30 unique: true);
31 }
32
34 protected override void Down(MigrationBuilder migrationBuilder)
35 {
36 ArgumentNullException.ThrowIfNull(migrationBuilder);
37
38 migrationBuilder.RenameTable(
39 name: "Instances",
40 newName: "Instances_down");
41
42 migrationBuilder.CreateTable(
43 name: "Instances",
44 columns: table => new
45 {
46 Id = table.Column<long>(nullable: false)
47 .Annotation("Sqlite:Autoincrement", true),
48 Name = table.Column<string>(maxLength: 10000, nullable: false),
49 Path = table.Column<string>(nullable: false),
50 Online = table.Column<bool>(nullable: false),
51 ConfigurationType = table.Column<int>(nullable: false),
52 AutoUpdateInterval = table.Column<uint>(nullable: false),
53 ChatBotLimit = table.Column<ushort>(nullable: false),
54 },
55 constraints: table =>
56 {
57 table.PrimaryKey("PK_Instances", x => x.Id);
58 });
59
60 migrationBuilder.Sql("INSERT INTO Instances (Id, Name, Path, Online, ConfigurationType, AutoUpdateInterval, ChatBotLimit) SELECT Id, Name, Path, Online, ConfigurationType, AutoUpdateInterval, ChatBotLimit FROM Instances_down");
61
62 migrationBuilder.DropTable(
63 name: "Instances_down");
64
65 migrationBuilder.RenameTable(
66 name: "Instances",
67 newName: "Instances_down");
68
69 migrationBuilder.RenameTable(
70 name: "Instances_down",
71 newName: "Instances");
72 }
73 }
74}