Initial commit MKD fixes
This commit is contained in:
18
backend/migrations/create_debtor_report_data.sql
Executable file
18
backend/migrations/create_debtor_report_data.sql
Executable file
@@ -0,0 +1,18 @@
|
||||
-- Таблица строк отчёта по задолженности (один отчёт — много строк по лицевым счетам)
|
||||
CREATE TABLE IF NOT EXISTS debtor_report_data (
|
||||
id BIGSERIAL PRIMARY KEY,
|
||||
report_id BIGINT NOT NULL REFERENCES financial_reports(id) ON DELETE CASCADE,
|
||||
row_index INTEGER NOT NULL,
|
||||
account TEXT NOT NULL,
|
||||
responsible_name TEXT,
|
||||
object_address TEXT,
|
||||
months_debt INTEGER,
|
||||
total_debt NUMERIC(14, 2) NOT NULL DEFAULT 0,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_debtor_report_data_report_id ON debtor_report_data(report_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_debtor_report_data_account ON debtor_report_data(account);
|
||||
CREATE INDEX IF NOT EXISTS idx_debtor_report_data_total_debt ON debtor_report_data(total_debt);
|
||||
|
||||
COMMENT ON TABLE debtor_report_data IS 'Строки отчёта по задолженности: лицевой счёт, ФИО, адрес, месяцы долга, сумма';
|
||||
Reference in New Issue
Block a user