|
| 1 | +using System; |
| 2 | +using Microsoft.EntityFrameworkCore.Migrations; |
| 3 | + |
| 4 | +#nullable disable |
| 5 | + |
| 6 | +namespace Deeplex.Saverwalter.Model.Migrations.Npgsql |
| 7 | +{ |
| 8 | + /// <inheritdoc /> |
| 9 | + public partial class Transaktionen : Migration |
| 10 | + { |
| 11 | + /// <inheritdoc /> |
| 12 | + protected override void Up(MigrationBuilder migrationBuilder) |
| 13 | + { |
| 14 | + migrationBuilder.DropColumn( |
| 15 | + name: "ist_beglichen", |
| 16 | + table: "abrechnungsresultate"); |
| 17 | + |
| 18 | + migrationBuilder.AddColumn<double>( |
| 19 | + name: "saldo", |
| 20 | + table: "abrechnungsresultate", |
| 21 | + type: "double precision", |
| 22 | + nullable: false, |
| 23 | + defaultValue: 0.0); |
| 24 | + |
| 25 | + migrationBuilder.CreateTable( |
| 26 | + name: "transaktionen", |
| 27 | + columns: table => new |
| 28 | + { |
| 29 | + transaktion_id = table.Column<Guid>(type: "uuid", nullable: false), |
| 30 | + zahler_kontakt_id = table.Column<int>(type: "integer", nullable: false), |
| 31 | + zahlungsempfaenger_kontakt_id = table.Column<int>(type: "integer", nullable: false), |
| 32 | + zahlungsdatum = table.Column<DateTime>(type: "timestamp with time zone", nullable: false), |
| 33 | + betrag = table.Column<double>(type: "double precision", nullable: false), |
| 34 | + verwendungszweck = table.Column<string>(type: "text", nullable: false), |
| 35 | + notiz = table.Column<string>(type: "text", nullable: true), |
| 36 | + created_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false), |
| 37 | + last_modified = table.Column<DateTime>(type: "timestamp with time zone", nullable: false) |
| 38 | + }, |
| 39 | + constraints: table => |
| 40 | + { |
| 41 | + table.PrimaryKey("pk_transaktionen", x => x.transaktion_id); |
| 42 | + table.ForeignKey( |
| 43 | + name: "fk_transaktionen_kontakte_zahler_kontakt_id", |
| 44 | + column: x => x.zahler_kontakt_id, |
| 45 | + principalTable: "kontakte", |
| 46 | + principalColumn: "kontakt_id", |
| 47 | + onDelete: ReferentialAction.Cascade); |
| 48 | + table.ForeignKey( |
| 49 | + name: "fk_transaktionen_kontakte_zahlungsempfaenger_kontakt_id", |
| 50 | + column: x => x.zahlungsempfaenger_kontakt_id, |
| 51 | + principalTable: "kontakte", |
| 52 | + principalColumn: "kontakt_id", |
| 53 | + onDelete: ReferentialAction.Cascade); |
| 54 | + }); |
| 55 | + |
| 56 | + migrationBuilder.CreateIndex( |
| 57 | + name: "ix_transaktionen_zahler_kontakt_id", |
| 58 | + table: "transaktionen", |
| 59 | + column: "zahler_kontakt_id"); |
| 60 | + |
| 61 | + migrationBuilder.CreateIndex( |
| 62 | + name: "ix_transaktionen_zahlungsempfaenger_kontakt_id", |
| 63 | + table: "transaktionen", |
| 64 | + column: "zahlungsempfaenger_kontakt_id"); |
| 65 | + } |
| 66 | + |
| 67 | + /// <inheritdoc /> |
| 68 | + protected override void Down(MigrationBuilder migrationBuilder) |
| 69 | + { |
| 70 | + migrationBuilder.DropTable( |
| 71 | + name: "transaktionen"); |
| 72 | + |
| 73 | + migrationBuilder.DropColumn( |
| 74 | + name: "saldo", |
| 75 | + table: "abrechnungsresultate"); |
| 76 | + |
| 77 | + migrationBuilder.AddColumn<bool>( |
| 78 | + name: "ist_beglichen", |
| 79 | + table: "abrechnungsresultate", |
| 80 | + type: "boolean", |
| 81 | + nullable: false, |
| 82 | + defaultValue: false); |
| 83 | + } |
| 84 | + } |
| 85 | +} |
0 commit comments