<div dir="ltr"><div>To ALL,</div><div><br></div><div>About Alembic and sqlite Alters, </div><div><br></div><div>There is easy way to provide Alter in Alembic from sqlite (there are functions they should be just implemented)</div>
<div>As I know author is agree if somebody help with this. </div><div><br></div><div>----</div><div><br></div><div>About switching to Alembic:<br></div><div><br></div><div>We are not able to use automatically merging migration tool that produce 1 huge migration form N small until all our migration will be written in alembic. </div>
<div><br></div><div>There is no "magic" and we have only 2 ways to end up with this problems and bugs that could be caused by "manually" migrations merging and tons of bugs in sqlalchemy-migrate.</div>
<div><br></div><div>1) step by step (openstack method)<br></div><div>  There are special tests "test_migrations" that runs migrations on real data against all backends. So we should:</div><div><br></div><div>  a) improve this tests to checks all behaviors // there is a lot of hidden bugs</div>
<div>  b) replace migration (only one small migration) to alembic</div><div>  c) check that in all backends we made the same changes in schema</div><div>  d) Merge all old migrations in one using alembic (automatically).</div>
<div>  So it could be done in safe way. </div><div><br></div><div>2.a) huge 2 steps </div><div>  1. Merge all migrations in one huge manually (drop all tests in test migrations)</div><div>      e.g. In Nova was patch <a href="https://review.openstack.org/#/c/35748/">https://review.openstack.org/#/c/35748/</a></div>
<div>      I don't believe that there are no mistakes in this migration, and nobody is able to check it. // because of tons of hidden bugs in old migrations and sqla-migrate.</div><div>  2. Replace this migration in Alembic</div>
<div>       I don't believe that there will be way to check that there is no bugs </div><div><br></div><div>2.b) suicide mode (1 big step)</div><div>  Merge and switch in one step=)</div><div><br></div><div><br></div>
<div>We (Mirantis guys and girls) are ready to implement first plan in all projects (step by step, with tons of tests and checks). I think that:<br></div><div>Sveta, Anya, Julya, Elena, Yuri, Sergey, Alexei, Roma, Viktor, Alex and me will be able to cover and finish all this work in all projects in Icehouse cycle. </div>
<div><br></div><div><br></div><div>----<br></div><div><br></div><div><br></div><div><div>If you don't understand why we have only 2 ways to switch to alembic, read at least this:</div><div><br></div><div>what we have:</div>
<div>1) migration schemas produce different schemas in different backneds</div><div>2) db models is not synced with any of these schemas. </div><div>what it means:</div><div>1) So we have to provide sqlite in migrations (until we finish work around unit test against specified backend (<a href="https://review.openstack.org/#/c/33236/">https://review.openstack.org/#/c/33236/</a>)</div>
<div>2) We are not able to add test that checks that migrations and models are synced (<a href="https://review.openstack.org/#/c/34212/">https://review.openstack.org/#/c/34212/</a>)</div><div>3) We are not able to use models created DB for unit tests. </div>
</div><div><br></div><div><br></div><div>Best regards,</div><div>Boris Pavlovic</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jul 16, 2013 at 9:02 PM, Dolph Mathews <span dir="ltr"><<a href="mailto:dolph.mathews@gmail.com" target="_blank">dolph.mathews@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><div class="gmail_quote"><div class="im">On Tue, Jul 16, 2013 at 11:53 AM, Doug Hellmann <span dir="ltr"><<a href="mailto:doug.hellmann@dreamhost.com" target="_blank">doug.hellmann@dreamhost.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote"><div>On Tue, Jul 16, 2013 at 11:51 AM, Roman Podolyaka <span dir="ltr"><<a href="mailto:rpodolyaka@mirantis.com" target="_blank">rpodolyaka@mirantis.com</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello, stackers!<div><br></div><div>Most of you who is interested in work around DB in OpenStack must have read this thread [1] started by Boris Pavlovic. Boris made an overview of the work our team is doing to make DB code better.</div>



<div><br></div><div>One of our main goals is to switch from sqlalchemy-migrate to Alembic for applying of DB schema migrations. sqlalchemy-migrate was abandoned for a long time, and even now when it's become adopted by OpenStack community, we'd better use a project which is supported by upstream (especially in the case when the author of this project is the same person who also authored SQLAlchemy).</div>



<div><br></div><div>The switch isn't going to be simple though. We have a few problems:</div><div><br></div><div>1) stable releases must be supported for some time, so we can't switch from migrate to alembic immediately</div>



<div><br></div><div>The switch should probably be made when previous migrations scripts are "compacted", so all new migrations scripts will use alembic. Switching of such big projects as Nova is hard, so we decided to gain some experience with porting of smaller ones first. Alexei Kornienko is currently working on adding support of Alembic migrations in Ceilometer [3]. </div>


</div></blockquote><div><br></div></div><div>I like the idea of switching when we do a major release. I don't think we need to port the old migrations to alembic, though, as I said to Alexei on the review. We should be able to continue to have sqlalchemy-migrate distributed as part of OpenStack for the legacy migrations until those migrations can be dropped entirely. Updating would mean running sqlalchemy-migrate, and then alembic, to apply the full set of migrations. From what I understand the policy to be, since we have sqlalchemy-migrate scripts in Havana we could stop creating new ones in Icehouse and drop the use of sqlalchemy-migrate entirely in the J release when the Havana migrations are removed.</div>

<span><font color="#888888">
<div><br></div></font></span></div></div></div></blockquote><div><br></div></div><div>This would be my preferred approach as well.</div><div class="im"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span><font color="#888888"><div></div><div>Doug</div></font></span><div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div dir="ltr">
<div><br></div><div>Our long term goal is to switch all projects from using of sqlalchemy-migrate to Alembic.</div><div><br></div><div>2) we rely on schema migrations to set up an SQLite database for running tests</div><div>



<br></div><div>Nova and possibly other projects use schema migrations to set up an SQLite database for running tests. Unfortunately, we can't use models definitions for generation of initial DB schema, because those definitions do not correspond migration scripts. Our team is working on fixing of this issue [2]. </div>


</div></blockquote></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div dir="ltr">
<div><br></div><div>As you may now SQLite has limited support of ALTER DDL statements [4]. Nova code contains a few auxiliary functions to make ALTER work in SQLite. Unfortunately, Alembic doesn't support ALTER in SQLite on purpose [5]. In order to run our tests on SQLite right now using Alembic as a schema migration tool, we should add ALTER support to it first.</div>



<div><br></div><div>We are going to implement ALTER support in Alembic for SQLite in the next few weeks.</div><div><br></div><div>As always, your comments in ML and reviews are always welcome.</div><div><div><br></div><div>



Thanks,</div><div>Roman</div></div><div><br></div><div><div>[1] <a href="http://lists.openstack.org/pipermail/openstack-dev/2013-July/011253.html" target="_blank">http://lists.openstack.org/pipermail/openstack-dev/2013-July/011253.html</a></div>



<div>[2] <a href="https://blueprints.launchpad.net/nova/+spec/db-sync-models-with-migrations" target="_blank">https://blueprints.launchpad.net/nova/+spec/db-sync-models-with-migrations</a></div><div>[3] <a href="https://review.openstack.org/#/q/status:open+project:openstack/ceilometer+branch:master+topic:bp/convert-to-alembic,n,z" target="_blank">https://review.openstack.org/#/q/status:open+project:openstack/ceilometer+branch:master+topic:bp/convert-to-alembic,n,z</a></div>



<div>[4] <a href="http://www.sqlite.org/lang_altertable.html" target="_blank">http://www.sqlite.org/lang_altertable.html</a></div><div>[5] <a href="https://bitbucket.org/zzzeek/alembic" target="_blank">https://bitbucket.org/zzzeek/alembic</a></div>


</div>
</div>
<br></div><div>_______________________________________________<br>
OpenStack-dev mailing list<br>
<a href="mailto:OpenStack-dev@lists.openstack.org" target="_blank">OpenStack-dev@lists.openstack.org</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
<br></div></blockquote></div><br></div></div>
<br>_______________________________________________<br>
OpenStack-dev mailing list<br>
<a href="mailto:OpenStack-dev@lists.openstack.org" target="_blank">OpenStack-dev@lists.openstack.org</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
<br></blockquote></div></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div><br></div>-Dolph
</font></span></div></div>
<br>_______________________________________________<br>
OpenStack-dev mailing list<br>
<a href="mailto:OpenStack-dev@lists.openstack.org">OpenStack-dev@lists.openstack.org</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
<br></blockquote></div><br></div>