CREATE TABLE IF NOT EXISTS farm_depreciation_manual_inputs (
    id BIGSERIAL PRIMARY KEY,
    project_flock_id BIGINT NOT NULL
        REFERENCES project_flocks(id)
        ON UPDATE CASCADE
        ON DELETE CASCADE,
    total_cost NUMERIC(18, 3) NOT NULL DEFAULT 0
        CHECK (total_cost >= 0),
    note TEXT NULL,
    created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
    updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
    CONSTRAINT farm_depreciation_manual_inputs_unique UNIQUE (project_flock_id)
);

CREATE INDEX IF NOT EXISTS idx_farm_depreciation_manual_inputs_project_flock_id
    ON farm_depreciation_manual_inputs (project_flock_id);
