sqlite-net
sqlite-net copied to clipboard
Do CreateTable and CreateTableAsync update table structure ?
I've been writing some migration code recently, and I have something that tells the program to drop the table and recreate it if any mismatch between the retrieved structure (GetTableInfoAsync) and my updated class is being found, but I noticed that the retrieved structure is already updated to my latest class even before I drop and recreate it !!
How is that possible ? The only code I call before is a loop to create my tables with CreateTableAsync, but the doc specifies that it creates it only if it doesn't exist.
Would it be possible that, since the TableMapping is different (but not the name of the type), SQLite.net acknowledges it as a different table, and tries to alter it, or something else ?
Hi, It's a normal behavior, as you can read on this wiki page : https://github.com/praeclarum/sqlite-net/wiki/AutomaticMigrations
Amazing ! How did I miss that ??
However, this can still be problematic as property deletion and renaming in my case is a totally possible scenario, I still need to rely on my manual migration process. I won't lie, if this could be natively implemented in the library, that would be really good. If this can get automatic too, and not only adding columns, then I'll just comment my code !
Surpreendente ! Como eu senti falta disso ??
No entanto, isso ainda pode ser problemático, pois a exclusão e a renomeação de propriedades no meu caso são um cenário totalmente possível. Ainda preciso confiar no meu processo de migração manual. Não vou mentir, se isso pudesse ser implementado nativamente na biblioteca, seria muito bom. Se isso também pode ser automático, e não apenas adicionando colunas, apenas comentarei meu código!
+1
Amazing ! How did I miss that ??
However, this can still be problematic as property deletion and renaming in my case is a totally possible scenario, I still need to rely on my manual migration process. I won't lie, if this could be natively implemented in the library, that would be really good. If this can get automatic too, and not only adding columns, then I'll just comment my code !
+1
Hi, if anyone's interested current link for migration guidelines is https://github.com/praeclarum/sqlite-net/wiki/Automatic-Migrations. And I guess this issue can be closed?