<div dir="ltr">Trevor,<div><br></div><div>Such check could be useful on <font face="arial, sans-serif">alembic side too. Good opportunity for contribution.</font><br><div><br></div><div>Andrew.</div></div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Fri, Jan 31, 2014 at 6:12 AM, Trevor McKay <span dir="ltr"><<a href="mailto:tmckay@redhat.com" target="_blank">tmckay@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Okay, I can accept that migrations shouldn't be supported on sqlite.<br>
<br>
However, if that's the case then we need to fix up savanna-db-manage so<br>
that it checks the db connection info and throws a polite error to the<br>
user for attempted migrations on unsupported platforms. For example:<br>
<br>
"Database migrations are not supported for sqlite"<br>
<br>
Because, as a developer, when I see a sql error trace as the result of<br>
an operation I assume it's broken :)<br>
<br>
Best,<br>
<br>
Trevor<br>
<br>
On Thu, 2014-01-30 at 15:04 -0500, Jay Pipes wrote:<br>
> On Thu, 2014-01-30 at 14:51 -0500, Trevor McKay wrote:<br>
> > I was playing with alembic migration and discovered that<br>
> > op.drop_column() doesn't work with sqlite. This is because sqlite<br>
> > doesn't support dropping a column (broken imho, but that's another<br>
> > discussion). Sqlite throws a syntax error.<br>
> ><br>
> > To make this work with sqlite, you have to copy the table to a temporary<br>
> > excluding the column(s) you don't want and delete the old one, followed<br>
> > by a rename of the new table.<br>
> ><br>
> > The existing 002 migration uses op.drop_column(), so I'm assuming it's<br>
> > broken, too (I need to check what the migration test is doing). I was<br>
> > working on an 003.<br>
> ><br>
> > How do we want to handle this? Three good options I can think of:<br>
> ><br>
> > 1) don't support migrations for sqlite (I think "no", but maybe)<br>
> ><br>
> > 2) Extend alembic so that op.drop_column() does the right thing (more<br>
> > open-source contributions for us, yay :) )<br>
> ><br>
> > 3) Add our own wrapper in savanna so that we have a drop_column() method<br>
> > that wraps copy/rename.<br>
> ><br>
> > Ideas, comments?<br>
><br>
> Migrations should really not be run against SQLite at all -- only on the<br>
> databases that would be used in production. I believe the general<br>
> direction of the contributor community is to be consistent around<br>
> testing of migrations and to not run migrations at all in unit tests<br>
> (which use SQLite).<br>
><br>
> Boris (cc'd) may have some more to say on this topic.<br>
><br>
> Best,<br>
> -jay<br>
><br>
><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>
<br>
<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>
</blockquote></div><br></div>