CREATE TABLE project_chickins (
    id BIGSERIAL PRIMARY KEY,
    project_floc_id BIGINT NOT NULL,
    chick_in_date DATE NOT NULL,
    quantity NUMERIC(15, 3) NOT NULL,
    note TEXT,
    created_by BIGINT NOT NULL,
    created_at TIMESTAMPTZ DEFAULT now(),
    updated_at TIMESTAMPTZ DEFAULT now(),
    deleted_at TIMESTAMPTZ
);

CREATE INDEX idx_project_chickins_project_floc_id ON project_chickins (project_floc_id);

CREATE INDEX idx_project_chickins_created_by ON project_chickins (created_by);

ALTER TABLE project_chickins
ADD CONSTRAINT fk_project_floc_id FOREIGN KEY (project_floc_id) REFERENCES project_flocks (id);

ALTER TABLE project_chickins
ADD CONSTRAINT fk_created_by FOREIGN KEY (created_by) REFERENCES users (id);