72 lines
2.2 KiB
C#
72 lines
2.2 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace BudgetApp.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddRecurringTransactions : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "ParentTransactionId",
|
|
table: "Transactions",
|
|
type: "INTEGER",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<DateTime>(
|
|
name: "RecurrenceEndDate",
|
|
table: "Transactions",
|
|
type: "TEXT",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "RecurrenceType",
|
|
table: "Transactions",
|
|
type: "INTEGER",
|
|
nullable: false,
|
|
defaultValue: 0);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Transactions_ParentTransactionId",
|
|
table: "Transactions",
|
|
column: "ParentTransactionId");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_Transactions_Transactions_ParentTransactionId",
|
|
table: "Transactions",
|
|
column: "ParentTransactionId",
|
|
principalTable: "Transactions",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.SetNull);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_Transactions_Transactions_ParentTransactionId",
|
|
table: "Transactions");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_Transactions_ParentTransactionId",
|
|
table: "Transactions");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "ParentTransactionId",
|
|
table: "Transactions");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "RecurrenceEndDate",
|
|
table: "Transactions");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "RecurrenceType",
|
|
table: "Transactions");
|
|
}
|
|
}
|
|
}
|