Files
zap-stream-api/NostrStreamer/Migrations/20230704123736_PaymentSetup.cs
2023-07-04 14:11:53 +01:00

104 lines
3.0 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace NostrStreamer.Migrations
{
/// <inheritdoc />
public partial class PaymentSetup : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropPrimaryKey(
name: "PK_Payments",
table: "Payments");
migrationBuilder.AddColumn<uint>(
name: "xmin",
table: "Users",
type: "xid",
rowVersion: true,
nullable: false,
defaultValue: 0u);
migrationBuilder.AddColumn<string>(
name: "PaymentHash",
table: "Payments",
type: "text",
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<decimal>(
name: "Amount",
table: "Payments",
type: "numeric(20,0)",
nullable: false,
defaultValue: 0m);
migrationBuilder.AddColumn<DateTime>(
name: "Created",
table: "Payments",
type: "timestamp with time zone",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddPrimaryKey(
name: "PK_Payments",
table: "Payments",
column: "PaymentHash");
migrationBuilder.CreateIndex(
name: "IX_Payments_PubKey",
table: "Payments",
column: "PubKey");
migrationBuilder.AddForeignKey(
name: "FK_Payments_Users_PubKey",
table: "Payments",
column: "PubKey",
principalTable: "Users",
principalColumn: "PubKey",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Payments_Users_PubKey",
table: "Payments");
migrationBuilder.DropPrimaryKey(
name: "PK_Payments",
table: "Payments");
migrationBuilder.DropIndex(
name: "IX_Payments_PubKey",
table: "Payments");
migrationBuilder.DropColumn(
name: "xmin",
table: "Users");
migrationBuilder.DropColumn(
name: "PaymentHash",
table: "Payments");
migrationBuilder.DropColumn(
name: "Amount",
table: "Payments");
migrationBuilder.DropColumn(
name: "Created",
table: "Payments");
migrationBuilder.AddPrimaryKey(
name: "PK_Payments",
table: "Payments",
column: "PubKey");
}
}
}