[asterisk-dev] Proposed alembic changes

George Joseph gjoseph at digium.com
Tue Oct 4 17:45:25 CDT 2016


Several folks have requested the ability to use the same schema for their
cdr, config and voicemail tables.  Alembic currently has an issue with this
because the default name of the table alembic uses to track which revision
the database is at is named 'alembic_version' with no qualifying
information in it.  The result is that if you attempt to use the same
schema for 2 trees, alembic will complain that the revisions are out of
sync.

To address this, I've put a patch[1] up on gerrit that renames the
'alembic_version' table to 'alembic_version_<tree>'  the next time you run
alembic for a tree.  For cdr for instance, the new table would be named
'alembic_version_cdr'.  It would only be renamed it it contained a revision
that matches the tree your're working with.

Let's say you have an existing config tree in the 'asterisk' schema and
wanted to add the cdr table to it.   Assuming your cdr.ini file points to
the 'asterisk' schema, when you run 'alembic -c cdr.ini upgrade head', the
existing 'asterisk_version' table would be checked to see if it belongs to
cdr.  Since it belongs to config not cdr, the existing table is left alone
and a new 'alembic_version_cdr' table is created and the upgrade is
performed to create the cdr table.

The next time you run alembic on the config tree, the 'alembic_version'
table is checked again and since it does belong to config, it's renamed to
'alembic_version_config'.

No existing data tables are renamed or altered and their data isn't touched
unless of course that was the point of the alembic script in the first
place.

So why this email?   We just wanted to make sure that nobody has an issue
with renaming that table.  Hopefully nobody is actually using that table
for anything but even if you're not, we don't want you to be surprised if
you notice the change.

Speak up now if you have an issue with this.

[1] https://gerrit.asterisk.org/4018

-- 
George Joseph
Digium, Inc. | Software Developer
445 Jan Davis Drive NW - Huntsville, AL 35806 - US
Check us out at: www.digium.com & www.asterisk.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20161004/67b94e18/attachment.html>


More information about the asterisk-dev mailing list