This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
SQLite data provider does not support many functions, which are necessary for Up and Down migrations. These are DropColumn and generally column altering (nullable/not nullable, etc). I know that SQLite DB engine does not support such functions directly (ref: http://www.sqlite.org/omitted.html), but there are specified workarounds (i.e. http://www.sqlite.org/faq.html#q11). Are you planning to implement them in the foreseeable future? Background: It is essential for migrations to support symmetrical operations for up and down migrations. Of course if I decide to support only "Up" migrations, I may delete all "DropColumn" statements from the migrations generated code and leave the unused columns in the database. But if I want to maintain both Up and Down migrations, it is not possible. |
|
|
This is not currently planned but I will add it to the wishlist. You could however implement it by hand by customising the migration code after it has been generated, using the ExecuteNativeCommand method to execute the SQL described in the workaround. |
|
|
If I customize the migration code to be compatible with SQLite, the code may become SQLite specific and may work incorrectly on another DBs (I plan to connect either to SQLite or MySQL, and MS SQLServer is also not ruled out in the future). DB independence is one of the LightSpeed features I like best :-) Is there any way to create overridden SQLite data provider (override the methods invoked by Migration.DropColumn and Migration.ChangeColumn)? If course if you did it for me, I would be very happy :-) |
|
|
I'd like to kindly ask if there's a chance to get answer on this post. I know that I'm still not your client, but the answer is important to recommend LightSpeed to my colleagues in order to buy it. |
|
|
Hello FV, It's not possible to override the default behaviour of the SQLite provider -- the provider model is all internal. The only thing we could do is make the Migration.DropColumn and Migration.ChangeColumn methods virtual. Then you could override them, check for SQLite and run your custom code (via ExecuteNativeCommand) or delegate to the base class implementation accordingly. However, this would require you to modify each generated migration to derive from your custom migration class instead of the base Migration class. And migration generation is not template-driven so you would need to remember to do this each time you generated a migration. Would this be an acceptable interim solution? |
|
|
Yes, such solution is ok for me. We'll remember to change inheritance. Thank you. |
|
|
Cool. It will be in the next nightly build |
|