Initial commit MKD fixes
This commit is contained in:
16
backend/migrations/create_finance_accounts.sql
Executable file
16
backend/migrations/create_finance_accounts.sql
Executable file
@@ -0,0 +1,16 @@
|
||||
-- Счета: банки и наличка (кошельки) для отображения остатков в календаре
|
||||
CREATE TABLE IF NOT EXISTS finance_accounts (
|
||||
id BIGSERIAL PRIMARY KEY,
|
||||
type VARCHAR(20) NOT NULL CHECK (type IN ('bank', 'cash')),
|
||||
name TEXT NOT NULL,
|
||||
balance NUMERIC(15, 2) NOT NULL DEFAULT 0,
|
||||
currency VARCHAR(10) NOT NULL DEFAULT 'RUB',
|
||||
sort_order INTEGER DEFAULT 0,
|
||||
is_active BOOLEAN NOT NULL DEFAULT TRUE,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_finance_accounts_type ON finance_accounts(type);
|
||||
CREATE INDEX IF NOT EXISTS idx_finance_accounts_active ON finance_accounts(is_active);
|
||||
COMMENT ON TABLE finance_accounts IS 'Банковские счета и кошельки (наличка) для отображения остатков в календаре оплат';
|
||||
Reference in New Issue
Block a user