tgstation-server 6.12.0
The /tg/station 13 server suite
Loading...
Searching...
No Matches
20210112154243_SLAddRevInfoTimestamp.cs
Go to the documentation of this file.
1using System;
2
3using Microsoft.EntityFrameworkCore.Migrations;
4
6{
10 public partial class SLAddRevInfoTimestamp : Migration
11 {
13 protected override void Up(MigrationBuilder migrationBuilder)
14 {
15 ArgumentNullException.ThrowIfNull(migrationBuilder);
16
17 migrationBuilder.AddColumn<DateTimeOffset>(
18 name: "Timestamp",
19 table: "RevisionInformations",
20 nullable: false,
21 defaultValue: new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)));
22 }
23
25 protected override void Down(MigrationBuilder migrationBuilder)
26 {
27 ArgumentNullException.ThrowIfNull(migrationBuilder);
28
29 migrationBuilder.RenameTable(
30 name: "RevisionInformations",
31 newName: "RevisionInformations_down");
32
33 migrationBuilder.CreateTable(
34 name: "RevisionInformations",
35 columns: table => new
36 {
37 Id = table.Column<long>(nullable: false)
38 .Annotation("Sqlite:Autoincrement", true),
39 CommitSha = table.Column<string>(maxLength: 40, nullable: false),
40 OriginCommitSha = table.Column<string>(maxLength: 40, nullable: false),
41 InstanceId = table.Column<long>(nullable: false),
42 },
43 constraints: table =>
44 {
45 table.PrimaryKey("PK_RevisionInformations", x => x.Id);
46 table.ForeignKey(
47 name: "FK_RevisionInformations_Instances_InstanceId",
48 column: x => x.InstanceId,
49 principalTable: "Instances",
50 principalColumn: "Id",
51 onDelete: ReferentialAction.Cascade);
52 });
53
54 migrationBuilder.Sql("INSERT INTO RevisionInformations (Id, CommitSha, OriginCommitSha, InstanceId) SELECT Id, CommitSha, OriginCommitSha, InstanceId FROM RevisionInformations_down");
55
56 migrationBuilder.DropTable(
57 name: "RevisionInformations_down");
58
59 migrationBuilder.RenameTable(
60 name: "RevisionInformations",
61 newName: "RevisionInformations_down");
62
63 migrationBuilder.RenameTable(
64 name: "RevisionInformations_down",
65 newName: "RevisionInformations");
66 }
67 }
68}
Add the Timestamp column to RevisionInformations for SQLite.