|
| 1 | +using System; |
| 2 | +using Microsoft.EntityFrameworkCore.Migrations; |
| 3 | + |
| 4 | +#nullable disable |
| 5 | + |
| 6 | +namespace LaneSenseGuard.Infrastructure.EntityFrameworkCore.Migrations |
| 7 | +{ |
| 8 | + /// <inheritdoc /> |
| 9 | + public partial class Initial : Migration |
| 10 | + { |
| 11 | + /// <inheritdoc /> |
| 12 | + protected override void Up(MigrationBuilder migrationBuilder) |
| 13 | + { |
| 14 | + migrationBuilder.CreateTable( |
| 15 | + name: "Raspberries", |
| 16 | + columns: table => new |
| 17 | + { |
| 18 | + Id = table.Column<Guid>(type: "uuid", nullable: false), |
| 19 | + DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true), |
| 20 | + DeletedBy = table.Column<string>(type: "text", nullable: true), |
| 21 | + CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false), |
| 22 | + CreatedBy = table.Column<string>(type: "text", nullable: false), |
| 23 | + UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true), |
| 24 | + UpdatedBy = table.Column<string>(type: "text", nullable: true) |
| 25 | + }, |
| 26 | + constraints: table => |
| 27 | + { |
| 28 | + table.PrimaryKey("PK_Raspberries", x => x.Id); |
| 29 | + }); |
| 30 | + |
| 31 | + migrationBuilder.CreateTable( |
| 32 | + name: "Connection", |
| 33 | + columns: table => new |
| 34 | + { |
| 35 | + Id = table.Column<Guid>(type: "uuid", nullable: false), |
| 36 | + RaspberryId = table.Column<Guid>(type: "uuid", nullable: false), |
| 37 | + DeletedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true), |
| 38 | + DeletedBy = table.Column<string>(type: "text", nullable: true), |
| 39 | + CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false), |
| 40 | + CreatedBy = table.Column<string>(type: "text", nullable: false), |
| 41 | + UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true), |
| 42 | + UpdatedBy = table.Column<string>(type: "text", nullable: true) |
| 43 | + }, |
| 44 | + constraints: table => |
| 45 | + { |
| 46 | + table.PrimaryKey("PK_Connection", x => x.Id); |
| 47 | + table.ForeignKey( |
| 48 | + name: "FK_Connection_Raspberries_RaspberryId", |
| 49 | + column: x => x.RaspberryId, |
| 50 | + principalTable: "Raspberries", |
| 51 | + principalColumn: "Id", |
| 52 | + onDelete: ReferentialAction.Cascade); |
| 53 | + }); |
| 54 | + |
| 55 | + migrationBuilder.CreateIndex( |
| 56 | + name: "IX_Connection_RaspberryId", |
| 57 | + table: "Connection", |
| 58 | + column: "RaspberryId"); |
| 59 | + } |
| 60 | + |
| 61 | + /// <inheritdoc /> |
| 62 | + protected override void Down(MigrationBuilder migrationBuilder) |
| 63 | + { |
| 64 | + migrationBuilder.DropTable( |
| 65 | + name: "Connection"); |
| 66 | + |
| 67 | + migrationBuilder.DropTable( |
| 68 | + name: "Raspberries"); |
| 69 | + } |
| 70 | + } |
| 71 | +} |
0 commit comments