[asterisk-dev] [Code Review] 2731: Add database schema management using Alembic

Russell Bryant reviewboard at asterisk.org
Thu Aug 1 10:04:02 CDT 2013



On Aug. 1, 2013, 8:51 a.m., Russell Bryant wrote:
> > But I too favor the old SQL files over an extra Alembic dependency and less readable files.
> > 
> > If however using Alembic makes it easier to update the in-tree SQL files, I could see some use for it there.
> 
> Russell Bryant wrote:
>     The primary benefit is in schema migration.  When Asterisk N+1 gets released, and you need to update your existing installation with some additional columns.  You re-run alembic and it gets everything up to date for you.
>     
>     The secondary benefit is maintaining the schema in one place, as opposed to duplicated for each database (and completely out of sync or non-existent for some of them).
>     
>     It can generate the SQL files, as well.  See the bottom of the README.
> 
> Tilghman Lesher wrote:
>     How about if, as a release task, we generate the SQL files and package them?  Since it can upgrade existing installations, there's a use for having it in the tarball, but those who are unfamiliar (as newbies tend to be), can have the simple SQL files to reference.

What value does having the SQL files provide?  Just so you don't have to install the dependencies to get your db created?  Having both seems weird.  If folks are uncomfortable with the dependency, I think I'd rather just drop it.


- Russell


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/2731/#review9270
-----------------------------------------------------------


On Aug. 1, 2013, 4:12 a.m., Russell Bryant wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/2731/
> -----------------------------------------------------------
> 
> (Updated Aug. 1, 2013, 4:12 a.m.)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Repository: Asterisk
> 
> 
> Description
> -------
> 
> This patch replaces contrib/realtime/ with a new setup for managing the database schema required for database integration with Asterisk.  In addition to initializing a database with the proper schema, alembic can do a database migration to assist with upgrading Asterisk in the future.  Hopefully this helps make setting up and operating Asterisk with a database easier.
> 
> With this the schema only needs to be maintained in one place instead of once per database.  The schemas I have added here have a bit of improvement over the examples that were there before (some added consistency and added some missing indexes).  Managing the schema in one place here also applies to all databases supported by SQLAlchemy.
> 
> See contrib/ast-db-manage/README.md for more details.
> 
> 
> Diffs
> -----
> 
>   /trunk/CHANGES 395934 
>   /trunk/contrib/ast-db-manage/README.md PRE-CREATION 
>   /trunk/contrib/ast-db-manage/config.ini.sample PRE-CREATION 
>   /trunk/contrib/ast-db-manage/config/env.py PRE-CREATION 
>   /trunk/contrib/ast-db-manage/config/script.py.mako PRE-CREATION 
>   /trunk/contrib/ast-db-manage/config/versions/4da0c5f79a9c_create_tables.py PRE-CREATION 
>   /trunk/contrib/ast-db-manage/voicemail.ini.sample PRE-CREATION 
>   /trunk/contrib/ast-db-manage/voicemail/env.py PRE-CREATION 
>   /trunk/contrib/ast-db-manage/voicemail/script.py.mako PRE-CREATION 
>   /trunk/contrib/ast-db-manage/voicemail/versions/a2e9769475e_create_tables.py PRE-CREATION 
>   /trunk/contrib/realtime/mysql/iaxfriends.sql 395934 
>   /trunk/contrib/realtime/mysql/meetme.sql 395934 
>   /trunk/contrib/realtime/mysql/musiconhold.sql 395934 
>   /trunk/contrib/realtime/mysql/queue_log.sql 395934 
>   /trunk/contrib/realtime/mysql/sippeers.sql 395934 
>   /trunk/contrib/realtime/mysql/voicemail.sql 395934 
>   /trunk/contrib/realtime/mysql/voicemail_data.sql 395934 
>   /trunk/contrib/realtime/mysql/voicemail_messages.sql 395934 
>   /trunk/contrib/realtime/postgresql/realtime.sql 395934 
> 
> Diff: https://reviewboard.asterisk.org/r/2731/diff/
> 
> 
> Testing
> -------
> 
> I ran schema upgrade/downgrade against MariaDB (MySQL compatible).  The schema came out as expected.  I haven't hooked it up to Asterisk, though...
> 
> 
> Thanks,
> 
> Russell Bryant
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20130801/6f0dbadb/attachment-0001.htm>


More information about the asterisk-dev mailing list