Open endersonmaia opened 4 months ago
Considering some PostgreSQL cloud providers, with cheaper shared instances, where you only get credentials for a single database, we could provide a flag that would make the node isolate each application inside schemas instead of a database.
This is a common multi-tenant database pattern instead of relying on a database table column to identify the tenants.
📚 Context
Currently, rollups-node expects
CARTESI_POSTGRES_ENDPOINT
to provide the right credentials and a database name.It would be nice if rollups-node could check if the
/<database>
part of the endpoint could be created in case it doesn't exists and the credentials provided have the right to do it.✔️ Solution
So the logic would be something like this:
In a scenario where a single database is provided for many rollups-node instances, database should be created with unique names to avoid collision.
It could be something like
chain-$chainId-dapp-$dappCointractAddres
, for ex.chain-11155111-dapp-b3b3efb3ca185b63faf4ed125d7cad3daf4c5dbf