Matthew Jordan 56fe3dceb8 res_pjsip: Add an 'auto' option for DTMF Mode | 9 år sedan | |
---|---|---|
.. | ||
cdr | be1ead44be ast-db-manage/cdr/env.py: Don't fail if a config file can't be loaded | 10 år sedan |
config | 56fe3dceb8 res_pjsip: Add an 'auto' option for DTMF Mode | 9 år sedan |
voicemail | fefff04c1d alembic: Adjust sippeers, queue_members, and voicemail_messages tables. | 10 år sedan |
README.md | a74a1f05de Actually *add* the database schema management utilities | 11 år sedan |
cdr.ini.sample | fefff04c1d alembic: Adjust sippeers, queue_members, and voicemail_messages tables. | 10 år sedan |
config.ini.sample | fefff04c1d alembic: Adjust sippeers, queue_members, and voicemail_messages tables. | 10 år sedan |
voicemail.ini.sample | fefff04c1d alembic: Adjust sippeers, queue_members, and voicemail_messages tables. | 10 år sedan |
Asterisk includes optional database integration for a variety of features. The purpose of this effort is to assist in managing the database schema for Asterisk database integration.
This is implemented as a set of repositories that contain database schema migrations, using Alembic. The existing repositories include:
config
- Tables used for Asterisk realtime configurationvoicemail
- Tables used for ODBC_STOARGE
of voicemail messagesAlembic uses SQLAlchemy, which has support for many databases.
IMPORTANT NOTE: This is brand new and the initial migrations are still subject to change. Only use this for testing purposes for now.
First, create an ini file that contains database connection details. For help with connection string details, see the SQLAlchemy docs.
$ cp config.ini.sample config.ini
... edit config.ini and change sqlalchemy.url ...
Next, bring the database up to date with the current schema.
$ alembic -c config.ini upgrade head
In the future, as additional database migrations are added, you can run alembic again to migrate the existing tables to the latest schema.
$ alembic -c config.ini upgrade head
The migrations support both upgrading and downgrading. You could go all the way back to where you started with no tables by downgrading back to the base revision.
$ alembic -c config.ini downgrade base
base
and head
are special revisions. You can refer to specific revisions
to upgrade or downgrade to, as well.
$ alembic -c config.ini upgrade 4da0c5f79a9c
If you would like to just generate the SQL statements that would have been executed, you can use alembic's offline mode.
$ alembic -c config.ini upgrade head --sql
The best way to learn about how to add additional database migrations is to refer to the Alembic documentation.