[prev in list] [next in list] [prev in thread] [next in thread] 

List:       asterisk-dev
Subject:    Re: [asterisk-dev] Proposed alembic changes
From:       George Joseph <gjoseph () digium ! com>
Date:       2016-10-06 0:00:35
Message-ID: CAP=uFEuLERPnOs0=hqzghsDkgX6wgAWY993orKF55HcpwtByeQ () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


On Oct 5, 2016 4:19 PM, "Rodrigo Ram=C3=ADrez Norambuena" <decipher.hk@gmai=
l.com>
wrote:
>
> 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.

Yep.  You're going to want to copy the new env.py script from one of the
other directories.

>
> Regards!
>
> 1: https://gerrit.asterisk.org/#/c/4012/
>
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> asterisk-dev mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-dev

[Attachment #5 (text/html)]

<p dir="ltr"></p>
<p dir="ltr">On Oct 5, 2016 4:19 PM, &quot;Rodrigo Ramírez Norambuena&quot; &lt;<a \
href="mailto:decipher.hk@gmail.com">decipher.hk@gmail.com</a>&gt; wrote:<br> &gt;<br>
&gt; On Tue, 2016-10-04 at 16:45 -0600, George Joseph wrote:<br>
&gt; &gt; Several folks have requested the ability to use the same schema for<br>
&gt; &gt; their cdr, config and voicemail tables.   Alembic currently has an<br>
&gt; &gt; issue with this because the default name of the table alembic uses to<br>
&gt; &gt; track which revision the database is at is named \
&#39;alembic_version&#39;<br> &gt; &gt; with no qualifying information in it.   The \
result is that if you<br> &gt; &gt; attempt to use the same schema for 2 trees, \
alembic will complain<br> &gt; &gt; that the revisions are out of sync.  <br>
&gt; &gt;<br>
&gt; &gt; To address this, I&#39;ve put a patch[1] up on gerrit that renames the<br>
&gt; &gt; &#39;alembic_version&#39; table to &#39;alembic_version_&lt;tree&gt;&#39;   \
the next time<br> &gt; &gt; you run alembic for a tree.   For cdr for instance, the \
new table<br> &gt; &gt; would be named &#39;alembic_version_cdr&#39;.   It would only \
be renamed it it<br> &gt; &gt; contained a revision that matches the tree your&#39;re \
working with.<br> &gt; &gt;<br>
&gt; &gt; Let&#39;s say you have an existing config tree in the &#39;asterisk&#39; \
schema<br> &gt; &gt; and wanted to add the cdr table to it.    Assuming your cdr.ini \
file<br> &gt; &gt; points to the &#39;asterisk&#39; schema, when you run &#39;alembic \
-c cdr.ini<br> &gt; &gt; upgrade head&#39;, the existing &#39;asterisk_version&#39; \
table would be checked<br> &gt; &gt; to see if it belongs to cdr.   Since it belongs \
to config not cdr, the<br> &gt; &gt; existing table is left alone and a new \
&#39;alembic_version_cdr&#39; table is<br> &gt; &gt; created and the upgrade is \
performed to create the cdr table.<br> &gt; &gt;<br>
&gt; &gt; The next time you run alembic on the config tree, the<br>
&gt; &gt; &#39;alembic_version&#39; table is checked again and since it does belong \
to<br> &gt; &gt; config, it&#39;s renamed to &#39;alembic_version_config&#39;.<br>
&gt; &gt;<br>
&gt; &gt; No existing data tables are renamed or altered and their data isn&#39;t<br>
&gt; &gt; touched unless of course that was the point of the alembic script in<br>
&gt; &gt; the first place.<br>
&gt; &gt;<br>
&gt; &gt; So why this email?    We just wanted to make sure that nobody has an<br>
&gt; &gt; issue with renaming that table.   Hopefully nobody is actually using<br>
&gt; &gt; that table for anything but even if you&#39;re not, we don&#39;t want you \
to<br> &gt; &gt; be surprised if you notice the change.<br>
&gt; &gt;<br>
&gt; &gt; Speak up now if you have an issue with this.<br>
&gt; &gt;<br>
&gt; &gt; [1]  <a href="https://gerrit.asterisk.org/4018">https://gerrit.asterisk.org/4018</a><br>
 &gt; &gt;<br>
&gt; &gt;  <br>
&gt;<br>
&gt; Cool!,<br>
&gt;<br>
&gt; I had the issue when I created the patch [1].<br>
&gt;<br>
&gt; Well, when that it&#39;s merge into the master I&#39;ll modify the patch.</p>
<p dir="ltr">Yep.   You&#39;re going to want to copy the new env.py script from one \
of the other directories.   </p> <p dir="ltr">&gt;<br>
&gt; Regards!<br>
&gt;<br>
&gt; 1:  <a href="https://gerrit.asterisk.org/#/c/4012/">https://gerrit.asterisk.org/#/c/4012/</a><br>
 &gt;<br>
&gt;<br>
&gt; --<br>
&gt; _____________________________________________________________________<br>
&gt; -- Bandwidth and Colocation Provided by <a \
href="http://www.api-digital.com">http://www.api-digital.com</a> --<br> &gt;<br>
&gt; asterisk-dev mailing list<br>
&gt; To UNSUBSCRIBE or update options visit:<br>
&gt;      <a href="http://lists.digium.com/mailman/listinfo/asterisk-dev">http://lists.digium.com/mailman/listinfo/asterisk-dev</a><br></p>




-- 
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-dev

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic