Files
rust-ipam/migrations/sqlite/0006_create_application_ports.sql
mathieu f13097591c 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>
2026-05-15 21:46:16 +02:00

9 lines
423 B
SQL

-- application_ports: which ports an application typically uses (many-to-many).
-- port_number is not a strict FK to ports to allow registering an application
-- before its port entry exists in the catalog.
CREATE TABLE IF NOT EXISTS application_ports (
application_id INTEGER NOT NULL REFERENCES applications(id) ON DELETE CASCADE,
port_number INTEGER NOT NULL,
PRIMARY KEY (application_id, port_number)
);