Summary
Constrain the network column to known values to prevent typos that silently split data.
Background & current behaviour
network is free TEXT with a default across soroban_events, api_keys, webhook_subscriptions, etc. A typo (tesnet) would create a separate, invisible data partition and cause auth/query mismatches.
Why this matters for MVP
Network is a primary scoping dimension (data isolation, auth). Uncontrolled values are a silent correctness hazard.
Proposed implementation
- Define the allowed set (
pubnet, testnet, futurenet, local) — confirm the exact set used.
- Add a
CHECK constraint (or an enum type) on network across the relevant tables via a migration + schema.sql.
- Normalise/validate
network at write time in the indexer and API.
- Migration must handle any existing out-of-range values (map or reject with a documented step).
Acceptance criteria
Affected files / components
database/migrations/, database/schema.sql
crates/indexer/src/, services/api/
Testing & verification
Attempt to insert an invalid network and assert rejection; valid networks pass.
Related / dependencies
Touches auth (network in context) and event scoping.
Out of scope
Multi-network federation logic.
Target branch
All work for this issue MUST target the dev branch. Cut your feature branch from dev and open the pull request against dev, never against main. Any PR opened against main for this issue will be closed and asked to re-target dev.
Summary
Constrain the
networkcolumn to known values to prevent typos that silently split data.Background & current behaviour
networkis freeTEXTwith a default acrosssoroban_events,api_keys,webhook_subscriptions, etc. A typo (tesnet) would create a separate, invisible data partition and cause auth/query mismatches.Why this matters for MVP
Network is a primary scoping dimension (data isolation, auth). Uncontrolled values are a silent correctness hazard.
Proposed implementation
pubnet,testnet,futurenet,local) — confirm the exact set used.CHECKconstraint (or an enum type) onnetworkacross the relevant tables via a migration +schema.sql.networkat write time in the indexer and API.Acceptance criteria
CHECK/enum constraint onnetworkacross relevant tables.Affected files / components
database/migrations/,database/schema.sqlcrates/indexer/src/,services/api/Testing & verification
Attempt to insert an invalid network and assert rejection; valid networks pass.
Related / dependencies
Touches auth (network in context) and event scoping.
Out of scope
Multi-network federation logic.
Target branch
All work for this issue MUST target the
devbranch. Cut your feature branch fromdevand open the pull request againstdev, never againstmain. Any PR opened againstmainfor this issue will be closed and asked to re-targetdev.