mowing modal
This commit is contained in:
24
database/migrations/V4__add_mowing_plans.sql
Normal file
24
database/migrations/V4__add_mowing_plans.sql
Normal file
@@ -0,0 +1,24 @@
|
||||
-- Mowing plans for plan/execute workflow
|
||||
CREATE TABLE IF NOT EXISTS mowing_plans (
|
||||
id SERIAL PRIMARY KEY,
|
||||
user_id INTEGER REFERENCES users(id) ON DELETE CASCADE,
|
||||
property_id INTEGER REFERENCES properties(id) ON DELETE CASCADE,
|
||||
equipment_id INTEGER REFERENCES user_equipment(id),
|
||||
planned_date DATE NOT NULL,
|
||||
cut_height_inches DECIMAL(4,2),
|
||||
direction VARCHAR(20) CHECK (direction IN ('N_S','E_W','NE_SW','NW_SE','CIRCULAR')),
|
||||
status VARCHAR(20) DEFAULT 'planned' CHECK (status IN ('planned','in_progress','completed','archived')),
|
||||
notes TEXT,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS mowing_plan_sections (
|
||||
id SERIAL PRIMARY KEY,
|
||||
plan_id INTEGER REFERENCES mowing_plans(id) ON DELETE CASCADE,
|
||||
lawn_section_id INTEGER REFERENCES lawn_sections(id) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_mowing_plans_user_id ON mowing_plans(user_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_mowing_plan_sections_plan_id ON mowing_plan_sections(plan_id);
|
||||
|
||||
Reference in New Issue
Block a user