diff options
| author | Jake Mannens <jake@asger.xyz> | 2024-11-06 12:24:08 +1100 |
|---|---|---|
| committer | Jake Mannens <jake@asger.xyz> | 2024-11-06 12:25:07 +1100 |
| commit | b1550b56be07536c9ed07c4a29fb3bb71f345c9e (patch) | |
| tree | 29ad567099d9251135509aa660d447084f75fa5d /Migrations/20241106012338_Bart.cs | |
| parent | e002a1f1def01a9974441668c7b6058c6a30724a (diff) | |
MigrationBART
Diffstat (limited to 'Migrations/20241106012338_Bart.cs')
| -rw-r--r-- | Migrations/20241106012338_Bart.cs | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/Migrations/20241106012338_Bart.cs b/Migrations/20241106012338_Bart.cs new file mode 100644 index 0000000..8174579 --- /dev/null +++ b/Migrations/20241106012338_Bart.cs @@ -0,0 +1,95 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace PagerParser.Migrations +{ + /// <inheritdoc /> + public partial class Bart : Migration + { + /// <inheritdoc /> + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "BartMembers", + columns: table => new + { + BartMemberId = table.Column<int>(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + MemberName = table.Column<string>(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_BartMembers", x => x.BartMemberId); + }); + + migrationBuilder.CreateTable( + name: "BartAvailabilityRecords", + columns: table => new + { + BartAvailabilityRecordId = table.Column<int>(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Timestamp = table.Column<DateTime>(type: "timestamp with time zone", nullable: false), + MemberBartMemberId = table.Column<int>(type: "integer", nullable: false), + Status = table.Column<int>(type: "integer", nullable: false), + IsDefault = table.Column<bool>(type: "boolean", nullable: false), + ModifiedOn = table.Column<DateTime>(type: "timestamp with time zone", nullable: true), + ModifiedByBartMemberId = table.Column<int>(type: "integer", nullable: true), + CreatedOn = table.Column<DateTime>(type: "timestamp with time zone", nullable: true), + CreatedByBartMemberId = table.Column<int>(type: "integer", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_BartAvailabilityRecords", x => x.BartAvailabilityRecordId); + table.ForeignKey( + name: "FK_BartAvailabilityRecords_BartMembers_CreatedByBartMemberId", + column: x => x.CreatedByBartMemberId, + principalTable: "BartMembers", + principalColumn: "BartMemberId"); + table.ForeignKey( + name: "FK_BartAvailabilityRecords_BartMembers_MemberBartMemberId", + column: x => x.MemberBartMemberId, + principalTable: "BartMembers", + principalColumn: "BartMemberId", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_BartAvailabilityRecords_BartMembers_ModifiedByBartMemberId", + column: x => x.ModifiedByBartMemberId, + principalTable: "BartMembers", + principalColumn: "BartMemberId"); + }); + + migrationBuilder.CreateIndex( + name: "IX_BartAvailabilityRecords_CreatedByBartMemberId", + table: "BartAvailabilityRecords", + column: "CreatedByBartMemberId"); + + migrationBuilder.CreateIndex( + name: "IX_BartAvailabilityRecords_MemberBartMemberId", + table: "BartAvailabilityRecords", + column: "MemberBartMemberId"); + + migrationBuilder.CreateIndex( + name: "IX_BartAvailabilityRecords_ModifiedByBartMemberId", + table: "BartAvailabilityRecords", + column: "ModifiedByBartMemberId"); + + migrationBuilder.CreateIndex( + name: "IX_BartMembers_MemberName", + table: "BartMembers", + column: "MemberName"); + } + + /// <inheritdoc /> + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "BartAvailabilityRecords"); + + migrationBuilder.DropTable( + name: "BartMembers"); + } + } +} |
