✨ Wallet, payment, developer apps, feature flags of publishers
♻️ Simplified the permission check of chat room, realm, publishers
This commit is contained in:
@ -0,0 +1,168 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using NodaTime;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace DysonNetwork.Sphere.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class WalletAndPayment : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "wallets",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
account_id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
|
||||
updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
|
||||
deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_wallets", x => x.id);
|
||||
table.ForeignKey(
|
||||
name: "fk_wallets_accounts_account_id",
|
||||
column: x => x.account_id,
|
||||
principalTable: "accounts",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "payment_transactions",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
currency = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
|
||||
amount = table.Column<decimal>(type: "numeric", nullable: false),
|
||||
remarks = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: true),
|
||||
type = table.Column<int>(type: "integer", nullable: false),
|
||||
payer_wallet_id = table.Column<Guid>(type: "uuid", nullable: true),
|
||||
payee_wallet_id = table.Column<Guid>(type: "uuid", nullable: true),
|
||||
created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
|
||||
updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
|
||||
deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_payment_transactions", x => x.id);
|
||||
table.ForeignKey(
|
||||
name: "fk_payment_transactions_wallets_payee_wallet_id",
|
||||
column: x => x.payee_wallet_id,
|
||||
principalTable: "wallets",
|
||||
principalColumn: "id");
|
||||
table.ForeignKey(
|
||||
name: "fk_payment_transactions_wallets_payer_wallet_id",
|
||||
column: x => x.payer_wallet_id,
|
||||
principalTable: "wallets",
|
||||
principalColumn: "id");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "wallet_pockets",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
currency = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
|
||||
amount = table.Column<decimal>(type: "numeric", nullable: false),
|
||||
wallet_id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
|
||||
updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
|
||||
deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_wallet_pockets", x => x.id);
|
||||
table.ForeignKey(
|
||||
name: "fk_wallet_pockets_wallets_wallet_id",
|
||||
column: x => x.wallet_id,
|
||||
principalTable: "wallets",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "payment_orders",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
status = table.Column<int>(type: "integer", nullable: false),
|
||||
currency = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
|
||||
remarks = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: true),
|
||||
amount = table.Column<decimal>(type: "numeric", nullable: false),
|
||||
expired_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
|
||||
payee_wallet_id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
transaction_id = table.Column<Guid>(type: "uuid", nullable: true),
|
||||
created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
|
||||
updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
|
||||
deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_payment_orders", x => x.id);
|
||||
table.ForeignKey(
|
||||
name: "fk_payment_orders_payment_transactions_transaction_id",
|
||||
column: x => x.transaction_id,
|
||||
principalTable: "payment_transactions",
|
||||
principalColumn: "id");
|
||||
table.ForeignKey(
|
||||
name: "fk_payment_orders_wallets_payee_wallet_id",
|
||||
column: x => x.payee_wallet_id,
|
||||
principalTable: "wallets",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_payment_orders_payee_wallet_id",
|
||||
table: "payment_orders",
|
||||
column: "payee_wallet_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_payment_orders_transaction_id",
|
||||
table: "payment_orders",
|
||||
column: "transaction_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_payment_transactions_payee_wallet_id",
|
||||
table: "payment_transactions",
|
||||
column: "payee_wallet_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_payment_transactions_payer_wallet_id",
|
||||
table: "payment_transactions",
|
||||
column: "payer_wallet_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_wallet_pockets_wallet_id",
|
||||
table: "wallet_pockets",
|
||||
column: "wallet_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_wallets_account_id",
|
||||
table: "wallets",
|
||||
column: "account_id");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "payment_orders");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "wallet_pockets");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "payment_transactions");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "wallets");
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user