pub fn establish_connection()
Expand description
Establish a connection to the database, and check the schema is up-to-date.
§Parameters
url
set to the postgres connection string needed to connect to the database. IF it is None, then the env var “DATABASE_URL
” will be used for this connection string. eg: “postgres://catalyst-dev:CHANGE_ME@localhost/CatalystDev
”do_schema_check
boolean flag to decide whether to verify the schema version or not. If it istrue
, a query is made to verify the DB schema version.
§Errors
This function will return an error if:
url
is None and the environment variable “DATABASE_URL
” isn’t set.- There is any error communicating the the database to check its schema.
- The database schema in the DB does not 100% match the schema supported by this library.
§Notes
The env var “DATABASE_URL
” can be set directly as an anv var, or in a
.env
file.