Complete early roadmap foundation and calendar helpers

This commit is contained in:
2026-05-15 21:41:37 -07:00
parent 6cd6729b7b
commit 8ee1f83b16
80 changed files with 3354 additions and 157 deletions
+24
View File
@@ -40,6 +40,30 @@ ON terrain_tiles (grid_scheme, projection, utm_zone, easting_min_m, northing_min
CREATE INDEX IF NOT EXISTS idx_terrain_tiles_status
ON terrain_tiles (status);
CREATE TABLE IF NOT EXISTS terrain_tile_solar_metadata (
tile_id TEXT PRIMARY KEY,
time_zone_id TEXT NOT NULL,
standard_utc_offset_hours REAL NOT NULL CHECK (standard_utc_offset_hours >= -12 AND standard_utc_offset_hours <= 14),
daylight_utc_offset_hours REAL NOT NULL CHECK (daylight_utc_offset_hours >= -12 AND daylight_utc_offset_hours <= 14),
solar_model TEXT NOT NULL DEFAULT 'NOAA approximate sunrise/sunset',
generated_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (tile_id) REFERENCES terrain_tiles(tile_id)
);
CREATE TABLE IF NOT EXISTS terrain_tile_growing_season_metadata (
tile_id TEXT PRIMARY KEY,
growing_zone_label TEXT NOT NULL,
climate_profile TEXT NOT NULL DEFAULT 'unknown',
growing_season_start_day INTEGER NOT NULL CHECK (growing_season_start_day >= 1 AND growing_season_start_day <= 366),
growing_season_end_day INTEGER NOT NULL CHECK (growing_season_end_day >= 1 AND growing_season_end_day <= 366),
frost_free_days INTEGER NOT NULL CHECK (frost_free_days >= 0 AND frost_free_days <= 366),
min_average_growing_temp_c REAL NOT NULL DEFAULT 7.0,
crop_safety_buffer_days INTEGER NOT NULL DEFAULT 14 CHECK (crop_safety_buffer_days >= 0 AND crop_safety_buffer_days <= 90),
data_basis TEXT NOT NULL DEFAULT '',
generated_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (tile_id) REFERENCES terrain_tiles(tile_id)
);
CREATE TABLE IF NOT EXISTS terrain_tile_neighbors (
tile_id TEXT NOT NULL,
direction TEXT NOT NULL CHECK (direction IN ('n', 'ne', 'e', 'se', 's', 'sw', 'w', 'nw')),