This document describes the PostgreSQL database structure hosted on Supabase.
- Backups and Schemas: You can find the complete SQL schemas and backup CSV files in the
docs/backupsfolder. - Configuration: For instructions on how to connect and configure the database, refer to the Backend README.
-
users: Stores registered user information.id(UUID, PK)name,email,rollevel,experience_points(Gamification)
-
devices: Registry of authorized hardware (Raspberry Pi).id(UUID, PK)serial_number(Unique)model,location
-
plants: Plants registered in the system.id(UUID, PK)user_id(FK -> users)device_id(FK -> devices)name,species,health_status
-
plant_stats: Historical sensor measurements.id(UUID, PK)plant_id(FK -> plants)temperature,light,soil_moisturerecorded_at(Timestamp)
-
plant_status: Calculated status and "mood" of the plant.plant_id(FK -> plants)status('healthy', 'bad', 'recovering')mood_face(Emoji/Icon)
alerts: Notifications generated by the system.id(UUID, PK)plant_id,user_idtitle,message,prioritystatus('active', 'resolved')
donations: Record of donations to foundations.foundations: Beneficiary foundations.accessories: Catalog of virtual accessories for plants.plants_accessories: Accessories acquired by a plant.
- A User can have multiple Plants.
- A Plant can be associated with a single Device (Raspberry Pi).
- A Plant has multiple records of Statistics (
plant_stats) and Alerts.
To see the exact SQL schema for each table, check the files in docs/backups/README.md.