1 Asterisk Database Manager
2 =========================
4 Asterisk includes optional database integration for a variety of features.
5 The purpose of this effort is to assist in managing the database schema
6 for Asterisk database integration.
8 This is implemented as a set of repositories that contain database schema
9 migrations, using [Alembic](http://alembic.readthedocs.org). The existing
12 * `config` - Tables used for Asterisk realtime configuration
13 * `voicemail` - Tables used for `ODBC_STOARGE` of voicemail messages
15 Alembic uses SQLAlchemy, which has support for
16 [many databases](http://docs.sqlalchemy.org/en/rel_0_8/dialects/index.html).
18 IMPORTANT NOTE: This is brand new and the initial migrations are still subject
19 to change. Only use this for testing purposes for now.
24 First, create an ini file that contains database connection details. For help
25 with connection string details, see the
26 [SQLAlchemy docs](http://docs.sqlalchemy.org/en/rel_0_8/core/engines.html#database-urls).
28 $ cp config.ini.sample config.ini
29 ... edit config.ini and change sqlalchemy.url ...
31 Next, bring the database up to date with the current schema.
33 $ alembic -c config.ini upgrade head
35 In the future, as additional database migrations are added, you can run
36 alembic again to migrate the existing tables to the latest schema.
38 $ alembic -c config.ini upgrade head
40 The migrations support both upgrading and downgrading. You could go all the
41 way back to where you started with no tables by downgrading back to the base
44 $ alembic -c config.ini downgrade base
46 `base` and `head` are special revisions. You can refer to specific revisions
47 to upgrade or downgrade to, as well.
49 $ alembic -c config.ini upgrade 4da0c5f79a9c
54 If you would like to just generate the SQL statements that would have been
55 executed, you can use alembic's offline mode.
57 $ alembic -c config.ini upgrade head --sql
59 Adding Database Migrations
60 --------------------------
62 The best way to learn about how to add additional database migrations is to
63 refer to the [Alembic documentation](http://alembic.readthedocs.org).