[Home]

Summary:ASTERISK-24311: Populating database via Alembic fails when using same database for multiple schema sets
Reporter:Dafi Ni (dafi)Labels:
Date Opened:2014-09-09 06:07:05Date Closed:2016-10-09 18:41:56
Priority:MinorRegression?
Status:Closed/CompleteComponents:Contrib/General
Versions:12.5.0 Frequency of
Occurrence
Frequent
Related
Issues:
Environment:Ubuntu 14.04 LTSAttachments:( 0) ASTERISK-24311-set-version-table.diff
Description:When using same database for:
config.ini cdr.ini voicemail.ini

populate config is fine
next running cdr :
{quote}
root@KRA-WS-DAFI:/usr/src/asterisk-svn/contrib/ast-db-manage# alembic -c cdr.ini upgrade head
INFO  \[alembic.migration] Context impl MySQLImpl.
INFO  \[alembic.migration] Will assume non-transactional DDL.
ERROR \[alembic.util] No such revision '5139253c0423'
 FAILED: No such revision '5139253c0423'
{quote}
because in table "alembic_version" alembic store last migration from config.ini

same is with voicemail:
{quote}
root@KRA-WS-DAFI:/usr/src/asterisk-svn/contrib/ast-db-manage# alembic -c voicemail.ini upgrade head
INFO  \[alembic.migration] Context impl MySQLImpl.
INFO  \[alembic.migration] Will assume non-transactional DDL.
ERROR \[alembic.util] No such revision '5139253c0423'
 FAILED: No such revision '5139253c0423'
{quote}

As workaround it is necessary to rename alembic_version when using different configs.


Comments:By: Rusty Newton (rnewton) 2014-09-18 17:44:25.810-0500

[~jrose] looked at this with me. It is pretty clear that what you are doing will fail, however we are not sure on the best solution in the long run.

It appears that you really need a separate DB for each schema set. I think it would be nice if that wasn't the case. At a minimum, there is a documentation issue here where it isn't clear how a user should proceed in this case.

[~dafi] can you expand on your work-around? Are you renaming alembic_version and duplicating that table? I'm not sure I understand.

By: Dafi Ni (dafi) 2014-09-22 07:16:54.543-0500

Yes I rename table "alembic_version" to alembic_version_cdr alembic_version_config etc.

By: David M. Lee (dlee) 2014-12-05 14:11:57.243-0600

I've just run into the same issue.

Alembic allows you to specify the name of the versions table, but only in the {{env.py}} file. Does anyone who knows more about alembic than I do know if it's best to patch Asterisk so the version tables don't conflict?

By: David M. Lee (dlee) 2014-12-05 14:13:11.252-0600

Patch for setting the {{version_table}} in {{env.py}}.

By: Matt Jordan (mjordan) 2014-12-05 14:41:10.849-0600

That's probably the best solution, really. I can't think of much else to do, at any rate.