Files
Distribution_GL/Migrations/20261006101045_InitialMySql.cs

1615 lines
99 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
namespace General_Ledger_Service.Migrations
{
/// <inheritdoc />
public partial class InitialMySql : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterDatabase()
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "account_type",
columns: table => new
{
id = table.Column<short>(type: "smallint", nullable: false),
name = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
normal_balance = table.Column<string>(type: "char(2)", maxLength: 2, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
created_at = table.Column<DateTime>(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)")
},
constraints: table =>
{
table.PrimaryKey("p_k_account_type", x => x.id);
table.CheckConstraint("CK_account_type_normal_balance", "normal_balance IN ('DR','CR')");
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "audit_log",
columns: table => new
{
audit_log_id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
category = table.Column<int>(type: "int", nullable: false),
entity_name = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
entity_id = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
action = table.Column<int>(type: "int", nullable: false),
description = table.Column<string>(type: "text", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
performed_by = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
occurred_at = table.Column<DateTime>(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)")
},
constraints: table =>
{
table.PrimaryKey("p_k_audit_log", x => x.audit_log_id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "cost_center",
columns: table => new
{
cost_center_id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
code = table.Column<string>(type: "varchar(20)", maxLength: 20, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
name = table.Column<string>(type: "varchar(150)", maxLength: 150, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
parent_cost_center_id = table.Column<long>(type: "bigint", nullable: true),
is_active = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: true),
created_at = table.Column<DateTime>(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)")
},
constraints: table =>
{
table.PrimaryKey("p_k_cost_center", x => x.cost_center_id);
table.ForeignKey(
name: "f_k_cost_center_cost_center_parent_cost_center_id",
column: x => x.parent_cost_center_id,
principalTable: "cost_center",
principalColumn: "cost_center_id",
onDelete: ReferentialAction.Restrict);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "currency",
columns: table => new
{
currency_code = table.Column<string>(type: "char(3)", maxLength: 3, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
currency_name = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
symbol = table.Column<string>(type: "varchar(5)", maxLength: 5, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
decimal_places = table.Column<short>(type: "smallint", nullable: false),
is_base_currency = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
is_active = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: true),
created_at = table.Column<DateTime>(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)")
},
constraints: table =>
{
table.PrimaryKey("p_k_currency", x => x.currency_code);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "fiscal_year",
columns: table => new
{
fiscal_year_id = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
year_name = table.Column<string>(type: "varchar(20)", maxLength: 20, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
start_date = table.Column<DateOnly>(type: "date", nullable: false),
end_date = table.Column<DateOnly>(type: "date", nullable: false),
is_closed = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
created_at = table.Column<DateTime>(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)")
},
constraints: table =>
{
table.PrimaryKey("p_k_fiscal_year", x => x.fiscal_year_id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "recurring_journal_template",
columns: table => new
{
template_id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
template_name = table.Column<string>(type: "varchar(150)", maxLength: 150, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
recurrence_pattern = table.Column<int>(type: "int", nullable: false),
next_run_date = table.Column<DateOnly>(type: "date", nullable: false),
end_date = table.Column<DateOnly>(type: "date", nullable: true),
is_active = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: true),
created_at = table.Column<DateTime>(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)")
},
constraints: table =>
{
table.PrimaryKey("p_k_recurring_journal_template", x => x.template_id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "system_config",
columns: table => new
{
config_key = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
config_value = table.Column<string>(type: "varchar(255)", maxLength: 255, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
description = table.Column<string>(type: "text", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
is_editable = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: true),
is_locked = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
created_at = table.Column<DateTime>(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)")
},
constraints: table =>
{
table.PrimaryKey("p_k_system_config", x => x.config_key);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "tax_type",
columns: table => new
{
tax_type_id = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
code = table.Column<string>(type: "varchar(20)", maxLength: 20, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
name = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
created_at = table.Column<DateTime>(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)")
},
constraints: table =>
{
table.PrimaryKey("p_k_tax_type", x => x.tax_type_id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "accounts",
columns: table => new
{
account_id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
account_code = table.Column<string>(type: "varchar(20)", maxLength: 20, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
account_name = table.Column<string>(type: "varchar(150)", maxLength: 150, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
parent_account_id = table.Column<long>(type: "bigint", nullable: true),
account_type_id = table.Column<short>(type: "smallint", nullable: false),
is_control_account = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
is_postable = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: true),
currency_code = table.Column<string>(type: "char(3)", maxLength: 3, nullable: false, defaultValue: "LKR")
.Annotation("MySql:CharSet", "utf8mb4"),
cash_flow_category = table.Column<string>(type: "varchar(15)", maxLength: 15, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
income_statement_section = table.Column<string>(type: "varchar(25)", maxLength: 25, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
balance_sheet_classification = table.Column<string>(type: "varchar(25)", maxLength: 25, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
is_tax_deductible = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: true),
is_active = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: true),
created_at = table.Column<DateTime>(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)")
},
constraints: table =>
{
table.PrimaryKey("p_k_accounts", x => x.account_id);
table.ForeignKey(
name: "f_k_accounts_account_type_account_type_id",
column: x => x.account_type_id,
principalTable: "account_type",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "f_k_accounts_accounts_parent_account_id",
column: x => x.parent_account_id,
principalTable: "accounts",
principalColumn: "account_id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "f_k_accounts_currency_currency_code",
column: x => x.currency_code,
principalTable: "currency",
principalColumn: "currency_code",
onDelete: ReferentialAction.Restrict);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "exchange_rate",
columns: table => new
{
rate_id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
currency_code = table.Column<string>(type: "char(3)", maxLength: 3, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
rate_date = table.Column<DateOnly>(type: "date", nullable: false),
rate_to_base = table.Column<decimal>(type: "decimal(38,10)", precision: 38, scale: 10, nullable: false),
rate_source = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, defaultValue: "MANUAL")
.Annotation("MySql:CharSet", "utf8mb4"),
created_at = table.Column<DateTime>(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)")
},
constraints: table =>
{
table.PrimaryKey("p_k_exchange_rate", x => x.rate_id);
table.ForeignKey(
name: "f_k_exchange_rate_currency_currency_code",
column: x => x.currency_code,
principalTable: "currency",
principalColumn: "currency_code",
onDelete: ReferentialAction.Restrict);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "accounting_period",
columns: table => new
{
period_id = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
fiscal_year_id = table.Column<int>(type: "int", nullable: false),
period_number = table.Column<short>(type: "smallint", nullable: false),
start_date = table.Column<DateOnly>(type: "date", nullable: false),
end_date = table.Column<DateOnly>(type: "date", nullable: false),
status = table.Column<int>(type: "int", nullable: false, defaultValue: 1),
lock_gl = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
lock_reason = table.Column<string>(type: "varchar(255)", maxLength: 255, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
created_at = table.Column<DateTime>(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)")
},
constraints: table =>
{
table.PrimaryKey("p_k_accounting_period", x => x.period_id);
table.ForeignKey(
name: "f_k_accounting_period_fiscal_year_fiscal_year_id",
column: x => x.fiscal_year_id,
principalTable: "fiscal_year",
principalColumn: "fiscal_year_id",
onDelete: ReferentialAction.Restrict);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "budget",
columns: table => new
{
budget_id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
fiscal_year_id = table.Column<int>(type: "int", nullable: false),
name = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
created_at = table.Column<DateTime>(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)")
},
constraints: table =>
{
table.PrimaryKey("p_k_budget", x => x.budget_id);
table.ForeignKey(
name: "f_k_budget_fiscal_year_fiscal_year_id",
column: x => x.fiscal_year_id,
principalTable: "fiscal_year",
principalColumn: "fiscal_year_id",
onDelete: ReferentialAction.Restrict);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "bank_account",
columns: table => new
{
bank_account_id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
account_name = table.Column<string>(type: "varchar(150)", maxLength: 150, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
bank_name = table.Column<string>(type: "varchar(150)", maxLength: 150, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
account_number = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
gl_account_id = table.Column<long>(type: "bigint", nullable: false),
currency_code = table.Column<string>(type: "char(3)", maxLength: 3, nullable: false, defaultValue: "LKR")
.Annotation("MySql:CharSet", "utf8mb4"),
created_at = table.Column<DateTime>(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)")
},
constraints: table =>
{
table.PrimaryKey("p_k_bank_account", x => x.bank_account_id);
table.ForeignKey(
name: "f_k_bank_account_accounts_gl_account_id",
column: x => x.gl_account_id,
principalTable: "accounts",
principalColumn: "account_id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "f_k_bank_account_currency_currency_code",
column: x => x.currency_code,
principalTable: "currency",
principalColumn: "currency_code",
onDelete: ReferentialAction.Restrict);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "cash_account_type",
columns: table => new
{
cash_account_type_id = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
name = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
gl_account_id = table.Column<long>(type: "bigint", nullable: true),
created_at = table.Column<DateTime>(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)")
},
constraints: table =>
{
table.PrimaryKey("p_k_cash_account_type", x => x.cash_account_type_id);
table.ForeignKey(
name: "f_k_cash_account_type_accounts_gl_account_id",
column: x => x.gl_account_id,
principalTable: "accounts",
principalColumn: "account_id",
onDelete: ReferentialAction.Restrict);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "currency_rounding_rule",
columns: table => new
{
currency_code = table.Column<string>(type: "char(3)", maxLength: 3, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
rounding_method = table.Column<string>(type: "varchar(15)", maxLength: 15, nullable: false, defaultValue: "NEAREST")
.Annotation("MySql:CharSet", "utf8mb4"),
rounding_account_id = table.Column<long>(type: "bigint", nullable: true),
created_at = table.Column<DateTime>(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)")
},
constraints: table =>
{
table.PrimaryKey("p_k_currency_rounding_rule", x => x.currency_code);
table.ForeignKey(
name: "f_k_currency_rounding_rule_accounts_rounding_account_id",
column: x => x.rounding_account_id,
principalTable: "accounts",
principalColumn: "account_id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "f_k_currency_rounding_rule_currency_currency_code",
column: x => x.currency_code,
principalTable: "currency",
principalColumn: "currency_code",
onDelete: ReferentialAction.Restrict);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "fixed_asset",
columns: table => new
{
asset_id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
asset_code = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
asset_name = table.Column<string>(type: "varchar(150)", maxLength: 150, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
asset_account_id = table.Column<long>(type: "bigint", nullable: false),
accum_depr_account_id = table.Column<long>(type: "bigint", nullable: false),
depr_expense_account_id = table.Column<long>(type: "bigint", nullable: false),
gain_loss_account_id = table.Column<long>(type: "bigint", nullable: false),
acquisition_date = table.Column<DateOnly>(type: "date", nullable: false),
acquisition_cost = table.Column<decimal>(type: "decimal(38,10)", precision: 38, scale: 10, nullable: false),
residual_value = table.Column<decimal>(type: "decimal(38,10)", precision: 38, scale: 10, nullable: false, defaultValue: 0m),
useful_life_months = table.Column<int>(type: "int", nullable: false),
depreciation_method = table.Column<int>(type: "int", nullable: false, defaultValue: 1),
depreciation_rate_percent = table.Column<decimal>(type: "decimal(38,10)", precision: 38, scale: 10, nullable: true),
status = table.Column<int>(type: "int", nullable: false, defaultValue: 1),
created_at = table.Column<DateTime>(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)")
},
constraints: table =>
{
table.PrimaryKey("p_k_fixed_asset", x => x.asset_id);
table.ForeignKey(
name: "f_k_fixed_asset_accounts_accum_depr_account_id",
column: x => x.accum_depr_account_id,
principalTable: "accounts",
principalColumn: "account_id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "f_k_fixed_asset_accounts_asset_account_id",
column: x => x.asset_account_id,
principalTable: "accounts",
principalColumn: "account_id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "f_k_fixed_asset_accounts_depr_expense_account_id",
column: x => x.depr_expense_account_id,
principalTable: "accounts",
principalColumn: "account_id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "f_k_fixed_asset_accounts_gain_loss_account_id",
column: x => x.gain_loss_account_id,
principalTable: "accounts",
principalColumn: "account_id",
onDelete: ReferentialAction.Restrict);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "recurring_journal_template_line",
columns: table => new
{
line_id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
template_id = table.Column<long>(type: "bigint", nullable: false),
account_id = table.Column<long>(type: "bigint", nullable: false),
debit_amount = table.Column<decimal>(type: "decimal(38,10)", precision: 38, scale: 10, nullable: false, defaultValue: 0m),
credit_amount = table.Column<decimal>(type: "decimal(38,10)", precision: 38, scale: 10, nullable: false, defaultValue: 0m),
created_at = table.Column<DateTime>(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)")
},
constraints: table =>
{
table.PrimaryKey("p_k_recurring_journal_template_line", x => x.line_id);
table.ForeignKey(
name: "f_k_recurring_journal_template_line_accounts_account_id",
column: x => x.account_id,
principalTable: "accounts",
principalColumn: "account_id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "f_k_recurring_journal_template_line_recurring_journal_template_t~",
column: x => x.template_id,
principalTable: "recurring_journal_template",
principalColumn: "template_id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "tax_code",
columns: table => new
{
tax_code_id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
tax_type_id = table.Column<int>(type: "int", nullable: false),
code = table.Column<string>(type: "varchar(20)", maxLength: 20, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
name = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
rate_percent = table.Column<decimal>(type: "decimal(38,10)", precision: 38, scale: 10, nullable: false),
calculation_basis = table.Column<int>(type: "int", nullable: false, defaultValue: 1),
applies_to = table.Column<int>(type: "int", nullable: false),
output_tax_account_id = table.Column<long>(type: "bigint", nullable: true),
input_tax_account_id = table.Column<long>(type: "bigint", nullable: true),
effective_from = table.Column<DateOnly>(type: "date", nullable: false),
effective_to = table.Column<DateOnly>(type: "date", nullable: true),
is_active = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: true),
created_at = table.Column<DateTime>(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)")
},
constraints: table =>
{
table.PrimaryKey("p_k_tax_code", x => x.tax_code_id);
table.ForeignKey(
name: "f_k_tax_code_accounts_input_tax_account_id",
column: x => x.input_tax_account_id,
principalTable: "accounts",
principalColumn: "account_id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "f_k_tax_code_accounts_output_tax_account_id",
column: x => x.output_tax_account_id,
principalTable: "accounts",
principalColumn: "account_id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "f_k_tax_code_tax_type_tax_type_id",
column: x => x.tax_type_id,
principalTable: "tax_type",
principalColumn: "tax_type_id",
onDelete: ReferentialAction.Restrict);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "journal_entry",
columns: table => new
{
journal_id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
journal_no = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
period_id = table.Column<int>(type: "int", nullable: false),
entry_date = table.Column<DateOnly>(type: "date", nullable: false),
journal_type = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
source_module = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
reference = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
narration = table.Column<string>(type: "text", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
is_posted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
is_reversed = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
reversal_of_id = table.Column<long>(type: "bigint", nullable: true),
entry_status = table.Column<int>(type: "int", nullable: false),
prepared_by = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
created_at = table.Column<DateTime>(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)")
},
constraints: table =>
{
table.PrimaryKey("p_k_journal_entry", x => x.journal_id);
table.ForeignKey(
name: "f_k_journal_entry_accounting_period_period_id",
column: x => x.period_id,
principalTable: "accounting_period",
principalColumn: "period_id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "f_k_journal_entry_journal_entry_reversal_of_id",
column: x => x.reversal_of_id,
principalTable: "journal_entry",
principalColumn: "journal_id",
onDelete: ReferentialAction.Restrict);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "period_lock_log",
columns: table => new
{
log_id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
period_id = table.Column<int>(type: "int", nullable: false),
action = table.Column<int>(type: "int", nullable: false),
module_locked = table.Column<string>(type: "varchar(15)", maxLength: 15, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
reason = table.Column<string>(type: "varchar(255)", maxLength: 255, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
created_at = table.Column<DateTime>(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)")
},
constraints: table =>
{
table.PrimaryKey("p_k_period_lock_log", x => x.log_id);
table.ForeignKey(
name: "f_k_period_lock_log_accounting_period_period_id",
column: x => x.period_id,
principalTable: "accounting_period",
principalColumn: "period_id",
onDelete: ReferentialAction.Restrict);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "budget_line",
columns: table => new
{
budget_line_id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
budget_id = table.Column<long>(type: "bigint", nullable: false),
account_id = table.Column<long>(type: "bigint", nullable: false),
period_id = table.Column<int>(type: "int", nullable: false),
cost_center_id = table.Column<long>(type: "bigint", nullable: true),
budgeted_amount = table.Column<decimal>(type: "decimal(38,10)", precision: 38, scale: 10, nullable: false),
created_at = table.Column<DateTime>(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)")
},
constraints: table =>
{
table.PrimaryKey("p_k_budget_line", x => x.budget_line_id);
table.ForeignKey(
name: "f_k_budget_line_accounting_period_period_id",
column: x => x.period_id,
principalTable: "accounting_period",
principalColumn: "period_id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "f_k_budget_line_accounts_account_id",
column: x => x.account_id,
principalTable: "accounts",
principalColumn: "account_id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "f_k_budget_line_budget_budget_id",
column: x => x.budget_id,
principalTable: "budget",
principalColumn: "budget_id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "f_k_budget_line_cost_center_cost_center_id",
column: x => x.cost_center_id,
principalTable: "cost_center",
principalColumn: "cost_center_id",
onDelete: ReferentialAction.Restrict);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "cheque_book",
columns: table => new
{
cheque_book_id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
branch_id = table.Column<long>(type: "bigint", nullable: false),
bank_account_id = table.Column<long>(type: "bigint", nullable: false),
cheque_book_no = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
start_cheque_no = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
end_cheque_no = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
total_leaves = table.Column<int>(type: "int", nullable: false),
received_date = table.Column<DateOnly>(type: "date", nullable: false),
status = table.Column<int>(type: "int", nullable: false, defaultValue: 1),
description = table.Column<string>(type: "text", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
is_active = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: true),
created_by = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
created_at = table.Column<DateTime>(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)"),
modified_by = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
modified_at = table.Column<DateTime>(type: "datetime(6)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("p_k_cheque_book", x => x.cheque_book_id);
table.ForeignKey(
name: "f_k_cheque_book_bank_account_bank_account_id",
column: x => x.bank_account_id,
principalTable: "bank_account",
principalColumn: "bank_account_id",
onDelete: ReferentialAction.Restrict);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "received_cheque",
columns: table => new
{
received_cheque_id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
company_id = table.Column<long>(type: "bigint", nullable: false),
branch_id = table.Column<long>(type: "bigint", nullable: true),
received_from_type = table.Column<int>(type: "int", nullable: false),
received_from_id = table.Column<long>(type: "bigint", nullable: true),
received_from_name = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
drawer_bank_name = table.Column<string>(type: "varchar(150)", maxLength: 150, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
drawer_bank_branch = table.Column<string>(type: "varchar(150)", maxLength: 150, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
account_holder_name = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
cheque_no = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
cheque_date = table.Column<DateOnly>(type: "date", nullable: false),
amount = table.Column<decimal>(type: "decimal(38,10)", precision: 38, scale: 10, nullable: false),
received_date = table.Column<DateOnly>(type: "date", nullable: false),
deposit_bank_account_id = table.Column<long>(type: "bigint", nullable: true),
deposit_date = table.Column<DateOnly>(type: "date", nullable: true),
status = table.Column<int>(type: "int", nullable: false, defaultValue: 1),
reference_type = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
reference_id = table.Column<long>(type: "bigint", nullable: true),
notes = table.Column<string>(type: "text", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
created_by = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
created_at = table.Column<DateTime>(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)")
},
constraints: table =>
{
table.PrimaryKey("p_k_received_cheque", x => x.received_cheque_id);
table.ForeignKey(
name: "f_k_received_cheque_bank_account_deposit_bank_account_id",
column: x => x.deposit_bank_account_id,
principalTable: "bank_account",
principalColumn: "bank_account_id",
onDelete: ReferentialAction.Restrict);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "cash_account",
columns: table => new
{
cash_account_id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
account_name = table.Column<string>(type: "varchar(150)", maxLength: 150, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
cash_account_type_id = table.Column<int>(type: "int", nullable: false),
account_number = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
gl_account_id = table.Column<long>(type: "bigint", nullable: false),
currency_code = table.Column<string>(type: "char(3)", maxLength: 3, nullable: false, defaultValue: "LKR")
.Annotation("MySql:CharSet", "utf8mb4"),
created_at = table.Column<DateTime>(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)")
},
constraints: table =>
{
table.PrimaryKey("p_k_cash_account", x => x.cash_account_id);
table.ForeignKey(
name: "f_k_cash_account_accounts_gl_account_id",
column: x => x.gl_account_id,
principalTable: "accounts",
principalColumn: "account_id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "f_k_cash_account_cash_account_type_cash_account_type_id",
column: x => x.cash_account_type_id,
principalTable: "cash_account_type",
principalColumn: "cash_account_type_id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "f_k_cash_account_currency_currency_code",
column: x => x.currency_code,
principalTable: "currency",
principalColumn: "currency_code",
onDelete: ReferentialAction.Restrict);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "asset_disposal",
columns: table => new
{
disposal_id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
asset_id = table.Column<long>(type: "bigint", nullable: false),
disposal_date = table.Column<DateOnly>(type: "date", nullable: false),
proceeds = table.Column<decimal>(type: "decimal(38,10)", precision: 38, scale: 10, nullable: true),
net_book_value_at_disposal = table.Column<decimal>(type: "decimal(38,10)", precision: 38, scale: 10, nullable: true),
gain_loss = table.Column<decimal>(type: "decimal(38,10)", precision: 38, scale: 10, nullable: true),
journal_id = table.Column<long>(type: "bigint", nullable: true),
created_at = table.Column<DateTime>(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)")
},
constraints: table =>
{
table.PrimaryKey("p_k_asset_disposal", x => x.disposal_id);
table.ForeignKey(
name: "f_k_asset_disposal_fixed_asset_asset_id",
column: x => x.asset_id,
principalTable: "fixed_asset",
principalColumn: "asset_id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "f_k_asset_disposal_journal_entry_journal_id",
column: x => x.journal_id,
principalTable: "journal_entry",
principalColumn: "journal_id",
onDelete: ReferentialAction.Restrict);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "bank_statement_line",
columns: table => new
{
stmt_line_id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
bank_account_id = table.Column<long>(type: "bigint", nullable: false),
txn_date = table.Column<DateOnly>(type: "date", nullable: false),
description = table.Column<string>(type: "varchar(255)", maxLength: 255, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
amount = table.Column<decimal>(type: "decimal(38,10)", precision: 38, scale: 10, nullable: false),
is_reconciled = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
matched_journal_id = table.Column<long>(type: "bigint", nullable: true),
created_at = table.Column<DateTime>(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)")
},
constraints: table =>
{
table.PrimaryKey("p_k_bank_statement_line", x => x.stmt_line_id);
table.ForeignKey(
name: "f_k_bank_statement_line_bank_account_bank_account_id",
column: x => x.bank_account_id,
principalTable: "bank_account",
principalColumn: "bank_account_id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "f_k_bank_statement_line_journal_entry_matched_journal_id",
column: x => x.matched_journal_id,
principalTable: "journal_entry",
principalColumn: "journal_id",
onDelete: ReferentialAction.Restrict);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "depreciation_schedule",
columns: table => new
{
schedule_id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
asset_id = table.Column<long>(type: "bigint", nullable: false),
period_id = table.Column<int>(type: "int", nullable: false),
depreciation_amount = table.Column<decimal>(type: "decimal(38,10)", precision: 38, scale: 10, nullable: false),
accumulated_depreciation = table.Column<decimal>(type: "decimal(38,10)", precision: 38, scale: 10, nullable: false),
net_book_value = table.Column<decimal>(type: "decimal(38,10)", precision: 38, scale: 10, nullable: false),
journal_id = table.Column<long>(type: "bigint", nullable: true),
created_at = table.Column<DateTime>(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)")
},
constraints: table =>
{
table.PrimaryKey("p_k_depreciation_schedule", x => x.schedule_id);
table.ForeignKey(
name: "f_k_depreciation_schedule_accounting_period_period_id",
column: x => x.period_id,
principalTable: "accounting_period",
principalColumn: "period_id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "f_k_depreciation_schedule_fixed_asset_asset_id",
column: x => x.asset_id,
principalTable: "fixed_asset",
principalColumn: "asset_id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "f_k_depreciation_schedule_journal_entry_journal_id",
column: x => x.journal_id,
principalTable: "journal_entry",
principalColumn: "journal_id",
onDelete: ReferentialAction.Restrict);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "journal_correction",
columns: table => new
{
correction_id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
original_journal_id = table.Column<long>(type: "bigint", nullable: false),
correction_journal_id = table.Column<long>(type: "bigint", nullable: false),
correction_type = table.Column<int>(type: "int", nullable: false),
reason = table.Column<string>(type: "text", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
corrected_by = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
created_at = table.Column<DateTime>(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)")
},
constraints: table =>
{
table.PrimaryKey("p_k_journal_correction", x => x.correction_id);
table.ForeignKey(
name: "f_k_journal_correction_journal_entry_correction_journal_id",
column: x => x.correction_journal_id,
principalTable: "journal_entry",
principalColumn: "journal_id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "f_k_journal_correction_journal_entry_original_journal_id",
column: x => x.original_journal_id,
principalTable: "journal_entry",
principalColumn: "journal_id",
onDelete: ReferentialAction.Restrict);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "journal_entry_line",
columns: table => new
{
line_id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
journal_id = table.Column<long>(type: "bigint", nullable: false),
account_id = table.Column<long>(type: "bigint", nullable: false),
debit_amount = table.Column<decimal>(type: "decimal(38,10)", precision: 38, scale: 10, nullable: false, defaultValue: 0m),
credit_amount = table.Column<decimal>(type: "decimal(38,10)", precision: 38, scale: 10, nullable: false, defaultValue: 0m),
currency_code = table.Column<string>(type: "char(3)", maxLength: 3, nullable: false, defaultValue: "LKR")
.Annotation("MySql:CharSet", "utf8mb4"),
exchange_rate = table.Column<decimal>(type: "decimal(38,10)", precision: 38, scale: 10, nullable: false, defaultValue: 1m),
base_debit = table.Column<decimal>(type: "decimal(38,10)", precision: 38, scale: 10, nullable: false, defaultValue: 0m),
base_credit = table.Column<decimal>(type: "decimal(38,10)", precision: 38, scale: 10, nullable: false, defaultValue: 0m),
cost_center_id = table.Column<long>(type: "bigint", nullable: true),
memo = table.Column<string>(type: "text", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
created_at = table.Column<DateTime>(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)")
},
constraints: table =>
{
table.PrimaryKey("p_k_journal_entry_line", x => x.line_id);
table.CheckConstraint("CK_journal_entry_line_amounts_non_negative", "debit_amount >= 0 AND credit_amount >= 0");
table.CheckConstraint("CK_journal_entry_line_one_sided", "(debit_amount = 0 AND credit_amount > 0) OR (credit_amount = 0 AND debit_amount > 0)");
table.ForeignKey(
name: "f_k_journal_entry_line_accounts_account_id",
column: x => x.account_id,
principalTable: "accounts",
principalColumn: "account_id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "f_k_journal_entry_line_cost_center_cost_center_id",
column: x => x.cost_center_id,
principalTable: "cost_center",
principalColumn: "cost_center_id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "f_k_journal_entry_line_currency_currency_code",
column: x => x.currency_code,
principalTable: "currency",
principalColumn: "currency_code",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "f_k_journal_entry_line_journal_entry_journal_id",
column: x => x.journal_id,
principalTable: "journal_entry",
principalColumn: "journal_id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "cheque_page",
columns: table => new
{
cheque_page_id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
cheque_book_id = table.Column<long>(type: "bigint", nullable: false),
cheque_no = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
issue_status = table.Column<int>(type: "int", nullable: false, defaultValue: 1),
payee_type = table.Column<int>(type: "int", nullable: true),
payee_id = table.Column<long>(type: "bigint", nullable: true),
payee_name = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
issue_date = table.Column<DateOnly>(type: "date", nullable: true),
amount = table.Column<decimal>(type: "decimal(38,10)", precision: 38, scale: 10, nullable: true),
currency_code = table.Column<string>(type: "char(3)", maxLength: 3, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
voucher_id = table.Column<long>(type: "bigint", nullable: true),
reference_no = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
purpose = table.Column<string>(type: "varchar(500)", maxLength: 500, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
is_cross_cheque = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
is_account_payee = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
is_post_dated = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
cleared_date = table.Column<DateOnly>(type: "date", nullable: true),
cleared_by_bank = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
cancel_reason = table.Column<string>(type: "varchar(500)", maxLength: 500, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
notes = table.Column<string>(type: "text", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
printed_by = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
printed_at = table.Column<DateTime>(type: "datetime(6)", nullable: true),
created_by = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
created_at = table.Column<DateTime>(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)")
},
constraints: table =>
{
table.PrimaryKey("p_k_cheque_page", x => x.cheque_page_id);
table.ForeignKey(
name: "f_k_cheque_page_cheque_book_cheque_book_id",
column: x => x.cheque_book_id,
principalTable: "cheque_book",
principalColumn: "cheque_book_id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "f_k_cheque_page_currency_currency_code",
column: x => x.currency_code,
principalTable: "currency",
principalColumn: "currency_code",
onDelete: ReferentialAction.Restrict);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.InsertData(
table: "account_type",
columns: new[] { "id", "created_at", "name", "normal_balance" },
values: new object[,]
{
{ (short)1, new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Asset", "DR" },
{ (short)2, new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Liability", "CR" },
{ (short)3, new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Equity", "CR" },
{ (short)4, new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Income", "CR" },
{ (short)5, new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Expense", "DR" }
});
migrationBuilder.InsertData(
table: "cash_account_type",
columns: new[] { "cash_account_type_id", "created_at", "gl_account_id", "name" },
values: new object[,]
{
{ 1, new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), null, "Petty Cash" },
{ 2, new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), null, "Till Cash" },
{ 3, new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), null, "Safe Cash" },
{ 4, new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), null, "Cash in Transit" }
});
migrationBuilder.InsertData(
table: "currency",
columns: new[] { "currency_code", "created_at", "currency_name", "decimal_places", "is_active", "symbol" },
values: new object[,]
{
{ "AED", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "UAE Dirham", (short)2, true, "د.إ" },
{ "AFN", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Afghan Afghani", (short)2, true, "؋" },
{ "ALL", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Albanian Lek", (short)2, true, "L" },
{ "AMD", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Armenian Dram", (short)2, true, "֏" },
{ "AOA", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Angolan Kwanza", (short)2, true, "Kz" },
{ "ARS", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Argentine Peso", (short)2, true, "$" },
{ "AUD", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Australian Dollar", (short)2, true, "$" },
{ "AZN", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Azerbaijani Manat", (short)2, true, "₼" },
{ "BAM", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Bosnia-Herzegovina Convertible Mark", (short)2, true, "KM" },
{ "BBD", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Barbadian Dollar", (short)2, true, "$" },
{ "BDT", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Bangladeshi Taka", (short)2, true, "৳" },
{ "BGN", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Bulgarian Lev", (short)2, true, "лв" },
{ "BHD", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Bahraini Dinar", (short)3, true, ".د.ب" },
{ "BIF", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Burundian Franc", (short)0, true, "FBu" },
{ "BND", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Brunei Dollar", (short)2, true, "$" },
{ "BOB", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Bolivian Boliviano", (short)2, true, "Bs." },
{ "BRL", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Brazilian Real", (short)2, true, "R$" },
{ "BSD", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Bahamian Dollar", (short)2, true, "$" },
{ "BTN", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Bhutanese Ngultrum", (short)2, true, "Nu." },
{ "BWP", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Botswana Pula", (short)2, true, "P" },
{ "BYN", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Belarusian Ruble", (short)2, true, "Br" },
{ "BZD", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Belize Dollar", (short)2, true, "$" },
{ "CAD", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Canadian Dollar", (short)2, true, "$" },
{ "CDF", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Congolese Franc", (short)2, true, "FC" },
{ "CHF", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Swiss Franc", (short)2, true, "CHF" },
{ "CLP", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Chilean Peso", (short)0, true, "$" },
{ "CNY", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Chinese Yuan", (short)2, true, "¥" },
{ "COP", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Colombian Peso", (short)2, true, "$" },
{ "CRC", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Costa Rican Colon", (short)2, true, "₡" },
{ "CUP", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Cuban Peso", (short)2, true, "$" },
{ "CVE", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Cape Verdean Escudo", (short)2, true, "$" },
{ "CZK", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Czech Koruna", (short)2, true, "Kč" },
{ "DJF", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Djiboutian Franc", (short)0, true, "Fdj" },
{ "DKK", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Danish Krone", (short)2, true, "kr" },
{ "DOP", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Dominican Peso", (short)2, true, "RD$" },
{ "DZD", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Algerian Dinar", (short)2, true, "د.ج" },
{ "EGP", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Egyptian Pound", (short)2, true, "£" },
{ "ETB", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Ethiopian Birr", (short)2, true, "Br" },
{ "EUR", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Euro", (short)2, true, "€" },
{ "FJD", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Fijian Dollar", (short)2, true, "$" },
{ "GBP", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "British Pound", (short)2, true, "£" },
{ "GEL", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Georgian Lari", (short)2, true, "₾" },
{ "GHS", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Ghanaian Cedi", (short)2, true, "₵" },
{ "GMD", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Gambian Dalasi", (short)2, true, "D" },
{ "GNF", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Guinean Franc", (short)0, true, "FG" },
{ "GTQ", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Guatemalan Quetzal", (short)2, true, "Q" },
{ "GYD", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Guyanese Dollar", (short)2, true, "$" },
{ "HKD", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Hong Kong Dollar", (short)2, true, "$" },
{ "HNL", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Honduran Lempira", (short)2, true, "L" },
{ "HTG", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Haitian Gourde", (short)2, true, "G" },
{ "HUF", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Hungarian Forint", (short)2, true, "Ft" },
{ "IDR", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Indonesian Rupiah", (short)2, true, "Rp" },
{ "ILS", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Israeli New Shekel", (short)2, true, "₪" },
{ "INR", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Indian Rupee", (short)2, true, "₹" },
{ "IQD", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Iraqi Dinar", (short)3, true, "ع.د" },
{ "IRR", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Iranian Rial", (short)2, true, "﷼" },
{ "ISK", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Icelandic Krona", (short)0, true, "kr" },
{ "JMD", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Jamaican Dollar", (short)2, true, "$" },
{ "JOD", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Jordanian Dinar", (short)3, true, "د.ا" },
{ "JPY", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Japanese Yen", (short)0, true, "¥" },
{ "KES", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Kenyan Shilling", (short)2, true, "KSh" },
{ "KGS", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Kyrgystani Som", (short)2, true, null },
{ "KHR", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Cambodian Riel", (short)2, true, "៛" },
{ "KMF", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Comorian Franc", (short)0, true, "CF" },
{ "KRW", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "South Korean Won", (short)0, true, "₩" },
{ "KWD", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Kuwaiti Dinar", (short)3, true, "د.ك" },
{ "KZT", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Kazakhstani Tenge", (short)2, true, "₸" },
{ "LAK", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Lao Kip", (short)2, true, "₭" },
{ "LBP", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Lebanese Pound", (short)2, true, "ل.ل" }
});
migrationBuilder.InsertData(
table: "currency",
columns: new[] { "currency_code", "created_at", "currency_name", "decimal_places", "is_active", "is_base_currency", "symbol" },
values: new object[] { "LKR", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Sri Lankan Rupee", (short)2, true, true, "Rs" });
migrationBuilder.InsertData(
table: "currency",
columns: new[] { "currency_code", "created_at", "currency_name", "decimal_places", "is_active", "symbol" },
values: new object[,]
{
{ "LRD", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Liberian Dollar", (short)2, true, "$" },
{ "LSL", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Lesotho Loti", (short)2, true, "L" },
{ "LYD", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Libyan Dinar", (short)3, true, "ل.د" },
{ "MAD", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Moroccan Dirham", (short)2, true, "د.م." },
{ "MDL", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Moldovan Leu", (short)2, true, "L" },
{ "MGA", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Malagasy Ariary", (short)2, true, "Ar" },
{ "MKD", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Macedonian Denar", (short)2, true, "ден" },
{ "MMK", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Myanmar Kyat", (short)2, true, "K" },
{ "MNT", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Mongolian Tugrik", (short)2, true, "₮" },
{ "MOP", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Macanese Pataca", (short)2, true, "MOP$" },
{ "MRU", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Mauritanian Ouguiya", (short)2, true, "UM" },
{ "MUR", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Mauritian Rupee", (short)2, true, "₨" },
{ "MVR", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Maldivian Rufiyaa", (short)2, true, "Rf" },
{ "MWK", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Malawian Kwacha", (short)2, true, "MK" },
{ "MXN", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Mexican Peso", (short)2, true, "$" },
{ "MYR", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Malaysian Ringgit", (short)2, true, "RM" },
{ "MZN", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Mozambican Metical", (short)2, true, "MT" },
{ "NAD", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Namibian Dollar", (short)2, true, "$" },
{ "NGN", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Nigerian Naira", (short)2, true, "₦" },
{ "NIO", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Nicaraguan Cordoba", (short)2, true, "C$" },
{ "NOK", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Norwegian Krone", (short)2, true, "kr" },
{ "NPR", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Nepalese Rupee", (short)2, true, "Rs" },
{ "NZD", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "New Zealand Dollar", (short)2, true, "$" },
{ "OMR", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Omani Rial", (short)3, true, "﷼" },
{ "PAB", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Panamanian Balboa", (short)2, true, "B/." },
{ "PEN", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Peruvian Sol", (short)2, true, "S/" },
{ "PGK", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Papua New Guinean Kina", (short)2, true, "K" },
{ "PHP", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Philippine Peso", (short)2, true, "₱" },
{ "PKR", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Pakistani Rupee", (short)2, true, "Rs" },
{ "PLN", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Polish Zloty", (short)2, true, "zł" },
{ "PYG", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Paraguayan Guarani", (short)0, true, "₲" },
{ "QAR", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Qatari Riyal", (short)2, true, "﷼" },
{ "RON", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Romanian Leu", (short)2, true, "lei" },
{ "RSD", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Serbian Dinar", (short)2, true, "дин." },
{ "RUB", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Russian Ruble", (short)2, true, "₽" },
{ "RWF", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Rwandan Franc", (short)0, true, "FRw" },
{ "SAR", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Saudi Riyal", (short)2, true, "﷼" },
{ "SBD", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Solomon Islands Dollar", (short)2, true, "$" },
{ "SCR", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Seychellois Rupee", (short)2, true, "₨" },
{ "SDG", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Sudanese Pound", (short)2, true, "ج.س." },
{ "SEK", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Swedish Krona", (short)2, true, "kr" },
{ "SGD", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Singapore Dollar", (short)2, true, "$" },
{ "SLL", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Sierra Leonean Leone", (short)2, true, "Le" },
{ "SOS", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Somali Shilling", (short)2, true, "S" },
{ "SRD", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Surinamese Dollar", (short)2, true, "$" },
{ "SYP", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Syrian Pound", (short)2, true, "£" },
{ "SZL", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Eswatini Lilangeni", (short)2, true, "L" },
{ "THB", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Thai Baht", (short)2, true, "฿" },
{ "TJS", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Tajikistani Somoni", (short)2, true, "ЅМ" },
{ "TMT", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Turkmenistani Manat", (short)2, true, "m" },
{ "TND", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Tunisian Dinar", (short)3, true, "د.ت" },
{ "TOP", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Tongan Pa'anga", (short)2, true, "T$" },
{ "TRY", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Turkish Lira", (short)2, true, "₺" },
{ "TTD", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Trinidad and Tobago Dollar", (short)2, true, "$" },
{ "TWD", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "New Taiwan Dollar", (short)2, true, "NT$" },
{ "TZS", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Tanzanian Shilling", (short)2, true, "TSh" },
{ "UAH", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Ukrainian Hryvnia", (short)2, true, "₴" },
{ "UGX", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Ugandan Shilling", (short)0, true, "USh" },
{ "USD", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "US Dollar", (short)2, true, "$" },
{ "UYU", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Uruguayan Peso", (short)2, true, "$U" },
{ "UZS", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Uzbekistani Som", (short)2, true, null },
{ "VES", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Venezuelan Bolivar", (short)2, true, "Bs." },
{ "VND", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Vietnamese Dong", (short)0, true, "₫" },
{ "VUV", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Vanuatu Vatu", (short)0, true, "VT" },
{ "WST", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Samoan Tala", (short)2, true, "T" },
{ "XAF", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Central African CFA Franc", (short)0, true, "FCFA" },
{ "XCD", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "East Caribbean Dollar", (short)2, true, "$" },
{ "XOF", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "West African CFA Franc", (short)0, true, "CFA" },
{ "XPF", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "CFP Franc", (short)0, true, "₣" },
{ "YER", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Yemeni Rial", (short)2, true, "﷼" },
{ "ZAR", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "South African Rand", (short)2, true, "R" },
{ "ZMW", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Zambian Kwacha", (short)2, true, "ZK" }
});
migrationBuilder.InsertData(
table: "system_config",
columns: new[] { "config_key", "config_value", "created_at", "description", "is_editable" },
values: new object[,]
{
{ "APIT_CREDIT_ACCOUNT_ID", "", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "GL account (accounts.account_id) where APIT (Advance Personal Income Tax) credits are recorded, read by the Income Tax Computation report", true },
{ "CASH_ACCOUNT_ROOT_ID", "", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Root account (accounts.account_id) whose recursive descendants are treated as cash/bank for the Cash Flow Statement's opening/closing balance and for excluding cash accounts from working-capital changes", true },
{ "COA_ENFORCE_MAX_DEPTH", "TRUE", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "If FALSE, depth is unlimited (config value ignored)", true },
{ "COA_MAX_DEPTH", "6", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Maximum allowed levels in the recursive Chart of Accounts tree", true },
{ "CORPORATE_INCOME_TAX_RATE", "30", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Default corporate income tax rate, percent, for the Income Tax Computation report - overridable per report request via taxRateOverride", true },
{ "COST_CENTER_MAX_DEPTH", "4", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Maximum allowed levels in the recursive Cost Center tree", true },
{ "QUARTERLY_TAX_PAYMENT_ACCOUNT_ID", "", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "GL account (accounts.account_id) where quarterly self-assessment tax installment payments are recorded, read by the Income Tax Computation report", true },
{ "STATUTORY_RELIEF_AMOUNT", "0", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Default Qualifying Payments/Reliefs figure for the Income Tax Computation report - overridable per report request via qualifyingPaymentsReliefs", true },
{ "WHT_CREDIT_ACCOUNT_ID", "", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "GL account (accounts.account_id) where WHT credit receivable is recorded, read by the Income Tax Computation report", true }
});
migrationBuilder.InsertData(
table: "tax_type",
columns: new[] { "tax_type_id", "code", "created_at", "name" },
values: new object[,]
{
{ 1, "VAT", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Value Added Tax" },
{ 2, "WHT", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Withholding Tax" },
{ 3, "NBT", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Nation Building Tax" },
{ 4, "SSCL", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Social Security Contribution Levy" },
{ 5, "INCOME_TAX", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Income Tax" }
});
migrationBuilder.CreateIndex(
name: "i_x_accounting_period_fiscal_year_id",
table: "accounting_period",
column: "fiscal_year_id");
migrationBuilder.CreateIndex(
name: "i_x_accounts_account_code",
table: "accounts",
column: "account_code",
unique: true);
migrationBuilder.CreateIndex(
name: "i_x_accounts_account_type_id",
table: "accounts",
column: "account_type_id");
migrationBuilder.CreateIndex(
name: "i_x_accounts_currency_code",
table: "accounts",
column: "currency_code");
migrationBuilder.CreateIndex(
name: "i_x_accounts_parent_account_id",
table: "accounts",
column: "parent_account_id");
migrationBuilder.CreateIndex(
name: "i_x_asset_disposal_asset_id",
table: "asset_disposal",
column: "asset_id");
migrationBuilder.CreateIndex(
name: "i_x_asset_disposal_journal_id",
table: "asset_disposal",
column: "journal_id");
migrationBuilder.CreateIndex(
name: "i_x_bank_account_currency_code",
table: "bank_account",
column: "currency_code");
migrationBuilder.CreateIndex(
name: "i_x_bank_account_gl_account_id",
table: "bank_account",
column: "gl_account_id");
migrationBuilder.CreateIndex(
name: "i_x_bank_statement_line_bank_account_id",
table: "bank_statement_line",
column: "bank_account_id");
migrationBuilder.CreateIndex(
name: "i_x_bank_statement_line_matched_journal_id",
table: "bank_statement_line",
column: "matched_journal_id");
migrationBuilder.CreateIndex(
name: "i_x_budget_fiscal_year_id",
table: "budget",
column: "fiscal_year_id");
migrationBuilder.CreateIndex(
name: "i_x_budget_line_account_id",
table: "budget_line",
column: "account_id");
migrationBuilder.CreateIndex(
name: "i_x_budget_line_budget_id",
table: "budget_line",
column: "budget_id");
migrationBuilder.CreateIndex(
name: "i_x_budget_line_cost_center_id",
table: "budget_line",
column: "cost_center_id");
migrationBuilder.CreateIndex(
name: "i_x_budget_line_period_id",
table: "budget_line",
column: "period_id");
migrationBuilder.CreateIndex(
name: "i_x_cash_account_account_number",
table: "cash_account",
column: "account_number",
unique: true);
migrationBuilder.CreateIndex(
name: "i_x_cash_account_cash_account_type_id",
table: "cash_account",
column: "cash_account_type_id");
migrationBuilder.CreateIndex(
name: "i_x_cash_account_currency_code",
table: "cash_account",
column: "currency_code");
migrationBuilder.CreateIndex(
name: "i_x_cash_account_gl_account_id",
table: "cash_account",
column: "gl_account_id");
migrationBuilder.CreateIndex(
name: "i_x_cash_account_type_gl_account_id",
table: "cash_account_type",
column: "gl_account_id");
migrationBuilder.CreateIndex(
name: "i_x_cash_account_type_name",
table: "cash_account_type",
column: "name",
unique: true);
migrationBuilder.CreateIndex(
name: "i_x_cheque_book_bank_account_id",
table: "cheque_book",
column: "bank_account_id");
migrationBuilder.CreateIndex(
name: "i_x_cheque_book_cheque_book_no",
table: "cheque_book",
column: "cheque_book_no",
unique: true);
migrationBuilder.CreateIndex(
name: "i_x_cheque_page_cheque_book_id",
table: "cheque_page",
column: "cheque_book_id");
migrationBuilder.CreateIndex(
name: "i_x_cheque_page_cheque_no",
table: "cheque_page",
column: "cheque_no",
unique: true);
migrationBuilder.CreateIndex(
name: "i_x_cheque_page_currency_code",
table: "cheque_page",
column: "currency_code");
migrationBuilder.CreateIndex(
name: "i_x_cost_center_code",
table: "cost_center",
column: "code",
unique: true);
migrationBuilder.CreateIndex(
name: "i_x_cost_center_parent_cost_center_id",
table: "cost_center",
column: "parent_cost_center_id");
migrationBuilder.CreateIndex(
name: "i_x_currency_rounding_rule_rounding_account_id",
table: "currency_rounding_rule",
column: "rounding_account_id");
migrationBuilder.CreateIndex(
name: "i_x_depreciation_schedule_asset_id",
table: "depreciation_schedule",
column: "asset_id");
migrationBuilder.CreateIndex(
name: "i_x_depreciation_schedule_journal_id",
table: "depreciation_schedule",
column: "journal_id");
migrationBuilder.CreateIndex(
name: "i_x_depreciation_schedule_period_id",
table: "depreciation_schedule",
column: "period_id");
migrationBuilder.CreateIndex(
name: "i_x_exchange_rate_currency_code_rate_date",
table: "exchange_rate",
columns: new[] { "currency_code", "rate_date" },
unique: true);
migrationBuilder.CreateIndex(
name: "i_x_fixed_asset_accum_depr_account_id",
table: "fixed_asset",
column: "accum_depr_account_id");
migrationBuilder.CreateIndex(
name: "i_x_fixed_asset_asset_account_id",
table: "fixed_asset",
column: "asset_account_id");
migrationBuilder.CreateIndex(
name: "i_x_fixed_asset_asset_code",
table: "fixed_asset",
column: "asset_code",
unique: true);
migrationBuilder.CreateIndex(
name: "i_x_fixed_asset_depr_expense_account_id",
table: "fixed_asset",
column: "depr_expense_account_id");
migrationBuilder.CreateIndex(
name: "i_x_fixed_asset_gain_loss_account_id",
table: "fixed_asset",
column: "gain_loss_account_id");
migrationBuilder.CreateIndex(
name: "i_x_journal_correction_correction_journal_id",
table: "journal_correction",
column: "correction_journal_id");
migrationBuilder.CreateIndex(
name: "i_x_journal_correction_original_journal_id",
table: "journal_correction",
column: "original_journal_id");
migrationBuilder.CreateIndex(
name: "i_x_journal_entry_journal_no",
table: "journal_entry",
column: "journal_no",
unique: true);
migrationBuilder.CreateIndex(
name: "i_x_journal_entry_period_id",
table: "journal_entry",
column: "period_id");
migrationBuilder.CreateIndex(
name: "i_x_journal_entry_reversal_of_id",
table: "journal_entry",
column: "reversal_of_id");
migrationBuilder.CreateIndex(
name: "i_x_journal_entry_line_account_id",
table: "journal_entry_line",
column: "account_id");
migrationBuilder.CreateIndex(
name: "i_x_journal_entry_line_cost_center_id",
table: "journal_entry_line",
column: "cost_center_id");
migrationBuilder.CreateIndex(
name: "i_x_journal_entry_line_currency_code",
table: "journal_entry_line",
column: "currency_code");
migrationBuilder.CreateIndex(
name: "i_x_journal_entry_line_journal_id",
table: "journal_entry_line",
column: "journal_id");
migrationBuilder.CreateIndex(
name: "i_x_period_lock_log_period_id",
table: "period_lock_log",
column: "period_id");
migrationBuilder.CreateIndex(
name: "i_x_received_cheque_deposit_bank_account_id",
table: "received_cheque",
column: "deposit_bank_account_id");
migrationBuilder.CreateIndex(
name: "i_x_recurring_journal_template_line_account_id",
table: "recurring_journal_template_line",
column: "account_id");
migrationBuilder.CreateIndex(
name: "i_x_recurring_journal_template_line_template_id",
table: "recurring_journal_template_line",
column: "template_id");
migrationBuilder.CreateIndex(
name: "i_x_tax_code_code",
table: "tax_code",
column: "code",
unique: true);
migrationBuilder.CreateIndex(
name: "i_x_tax_code_input_tax_account_id",
table: "tax_code",
column: "input_tax_account_id");
migrationBuilder.CreateIndex(
name: "i_x_tax_code_output_tax_account_id",
table: "tax_code",
column: "output_tax_account_id");
migrationBuilder.CreateIndex(
name: "i_x_tax_code_tax_type_id",
table: "tax_code",
column: "tax_type_id");
migrationBuilder.CreateIndex(
name: "i_x_tax_type_code",
table: "tax_type",
column: "code",
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "asset_disposal");
migrationBuilder.DropTable(
name: "audit_log");
migrationBuilder.DropTable(
name: "bank_statement_line");
migrationBuilder.DropTable(
name: "budget_line");
migrationBuilder.DropTable(
name: "cash_account");
migrationBuilder.DropTable(
name: "cheque_page");
migrationBuilder.DropTable(
name: "currency_rounding_rule");
migrationBuilder.DropTable(
name: "depreciation_schedule");
migrationBuilder.DropTable(
name: "exchange_rate");
migrationBuilder.DropTable(
name: "journal_correction");
migrationBuilder.DropTable(
name: "journal_entry_line");
migrationBuilder.DropTable(
name: "period_lock_log");
migrationBuilder.DropTable(
name: "received_cheque");
migrationBuilder.DropTable(
name: "recurring_journal_template_line");
migrationBuilder.DropTable(
name: "system_config");
migrationBuilder.DropTable(
name: "tax_code");
migrationBuilder.DropTable(
name: "budget");
migrationBuilder.DropTable(
name: "cash_account_type");
migrationBuilder.DropTable(
name: "cheque_book");
migrationBuilder.DropTable(
name: "fixed_asset");
migrationBuilder.DropTable(
name: "cost_center");
migrationBuilder.DropTable(
name: "journal_entry");
migrationBuilder.DropTable(
name: "recurring_journal_template");
migrationBuilder.DropTable(
name: "tax_type");
migrationBuilder.DropTable(
name: "bank_account");
migrationBuilder.DropTable(
name: "accounting_period");
migrationBuilder.DropTable(
name: "accounts");
migrationBuilder.DropTable(
name: "fiscal_year");
migrationBuilder.DropTable(
name: "account_type");
migrationBuilder.DropTable(
name: "currency");
}
}
}