Database Overview
The RedeCasas database is a central SQLite schema compatible with Cloudflare D1. It replaces scattered file-based data (JSON caches, CSV trackers, HTML content caches) with a queryable relational schema.
Quick Start
# 1. Create SQLite database and run migrationscd dbsqlite3 redecasas.db < schema.sql
# 2. Build and run seedercd seedergo build -o seeder ../seeder --db-url="../redecasas.db" --site-dir="../site" --csv-file="../Table.csv"
# 3. Run post-seed resolutionsqlite3 redecasas.db < post_seed.sqlSchema Domains
| Domain | Tables |
|---|---|
| Geographic | brazil_regions, brazil_states, geo_region_types, geo_regions, brazil_cities |
| Content Config | scopes, topics, page_types |
| Pages | pages, page_content_cache, page_generation_log |
| Real Estate | property_types, listings, real_estate_agents, imobiliarias |
| Blog | blog_themes, blog_posts |
| Ads | city_ads |
| Analytics | notfound_urls, page_views, search_queries |
| Scheduler | daily_rotation_tracker |
D1 Migration
To migrate to Cloudflare D1:
cd chat-worker# Export schemasqlite3 redecasas.db .schema > d1_schema.sql# Apply to D1npx wrangler d1 execute redecasas-chat --file=../db/d1_schema.sql