feat(db): add SQLx migrations and AppState with connection pool
- Add sqlx 0.8 (AnyPool, runtime-tokio, sqlite, postgres, migrate) - Create 6 migration files for both SQLite and PostgreSQL backends - Add server/db.rs: create_pool and run_migrations helpers - Add server/state.rs: AppState with LeptosOptions + AnyPool - Run migrations at server startup before accepting requests - Fix Port model: remove host_id (ports are now a global catalog) - Add HostPort join struct for the host_ports many-to-many table Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -21,6 +21,7 @@ ssr = [
|
||||
"dep:tracing-subscriber",
|
||||
"dep:dotenvy",
|
||||
"dep:ipnetwork",
|
||||
"dep:sqlx",
|
||||
"leptos/ssr",
|
||||
"leptos_meta/ssr",
|
||||
"leptos_router/ssr",
|
||||
@@ -68,6 +69,9 @@ tracing-subscriber = { version = "0.3", features = ["env-filter"], optional = tr
|
||||
dotenvy = { version = "0.15", optional = true }
|
||||
# Parsing et calcul de plages d'adresses IP (CIDR) — ex: 192.168.1.0/24
|
||||
ipnetwork = { version = "0.20", optional = true }
|
||||
# Database access: connection pools, queries, migrations — SQLite + PostgreSQL
|
||||
# "any" = runtime-dispatched driver (same code works with both backends)
|
||||
sqlx = { version = "0.8", features = ["runtime-tokio", "tls-rustls", "sqlite", "postgres", "migrate", "any"], optional = true }
|
||||
|
||||
# --- Dépendances client uniquement (activées par la feature "hydrate") ---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user