[Asterisk-code-review] alembic: Allow cdr, config and voicemail to exist in the sa... (asterisk[13])

George Joseph asteriskteam at digium.com
Fri Oct 7 07:49:12 CDT 2016


Hello Richard Mudgett, Anonymous Coward #1000019,

I'd like you to reexamine a change.  Please visit

    https://gerrit.asterisk.org/4018

to look at the new patch set (#2).

Change subject: alembic:  Allow cdr, config and voicemail to exist in the same schema
......................................................................

alembic:  Allow cdr, config and voicemail to exist in the same schema

cdr, config and voicemail are all separate alembic trees.  Because
alembic's default is to use a table named 'alembic_version' to store
the current tree revision, the 3 trees can't exist in the same schema
without stepping on each other.

Now each tree uses 'alembic_version_<tree_name>' as the version table.
Each tree's env.py script now first checks for 'alembic_version'.  If
it finds it AND its revision is in the tree's history, the script
renames it to 'alembic_version_<tree_name>'.  Regardless, the script
then continues with the migration using 'alembic_version_<tree_name>'
and creates that table if it's not found.  The result is that if an
existing 'alembic_version' table was found but it didn't belong to this
tree, it's left alone and 'alembic_version_<tree_name>' is used or
created.

WARNING:  If multiple trees are using the same schema, they MUST NOT
CRU or D any objects with names that might exist in the other trees.
An example would be 'yesno_values' type.  If two trees perform
operations on it, one tree could pull it out from under the other.
Thankfully we currently don't share any names among cdr, config and
voicemail.

NOTE:  Since the env.py scripts in each tree were identical, a common
env.py has been placed in the ast-db-manage directory and a symlink
to it has been placed in each tree directory.

ASTERISK-24311 #close
Reported-by: Dafi Ni

Change-Id: I4d593f000350deb5d21a14fa1e9bc3896844d898
---
D contrib/ast-db-manage/cdr/env.py
A contrib/ast-db-manage/cdr/env.py
D contrib/ast-db-manage/config/env.py
A contrib/ast-db-manage/config/env.py
A contrib/ast-db-manage/env.py
D contrib/ast-db-manage/voicemail/env.py
A contrib/ast-db-manage/voicemail/env.py
7 files changed, 143 insertions(+), 222 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/18/4018/2
-- 
To view, visit https://gerrit.asterisk.org/4018
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I4d593f000350deb5d21a14fa1e9bc3896844d898
Gerrit-PatchSet: 2
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>



More information about the asterisk-code-review mailing list