[asterisk-dev] Proposed alembic changes
Rodrigo Ramírez Norambuena
decipher.hk at gmail.com
Wed Oct 5 17:19:29 CDT 2016
On Tue, 2016-10-04 at 16:45 -0600, George Joseph wrote:
> 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
>
>
Cool!,
I had the issue when I created the patch [1].
Well, when that it's merge into the master I'll modify the patch.
Regards!
1: https://gerrit.asterisk.org/#/c/4012/
More information about the asterisk-dev
mailing list