DB Migration¶
The migration object is accessed via Database.migration or CrudDB and is used to create and manage database migrations.
It requires the db extra to be installed:
fluid.db.Migration
dataclass
¶
A wrapper around Alembic commands to perform database migrations
init
¶
show
¶
history
¶
revision
¶
Source code in fluid/db/migration.py
upgrade
¶
downgrade
¶
current
¶
message
¶
db_exists
¶
db_create
¶
Creates a new database if it does not exist
db_drop
¶
create_all
¶
Create all tables from :attr:metadata in database.
A schema is created before the tables that live in it. SQLAlchemy's
MetaData.create_all only emits CREATE TABLE and does not create
the schema itself, so tables registered on a non-public schema
would otherwise fail with InvalidSchemaName.
Source code in fluid/db/migration.py
truncate
¶
Truncate a specific table in the database
Source code in fluid/db/migration.py
truncate_all
¶
schemas
¶
Return the non-system schemas in the database.
System schemas (pg_* and information_schema) are excluded.
Source code in fluid/db/migration.py
drop_all_schemas
¶
Drop the given schemas, or public when none are given.
When schemas is None only public is dropped, for backwards
compatibility. Pass an explicit sequence to drop additional schemas,
for example the application schemas created by multi-schema setups.
Source code in fluid/db/migration.py
create_ro_user
¶
Creates a read-only user
Source code in fluid/db/migration.py
drop_role
¶
Drop a role