It's kind of similar to what Django ORM does, I would definitely consider this approach for a next iteration :) My problem is how to handle the version parameter to LocalStorage.
Em sex, 23 de out de 2015 às 13:28, Gian Maxera <[email protected]> escreveu: > Hello Daniel, > I also develop website using Laravel (a PHP framework), and for migration > they use a special table called “migration” with two column: “migration” > and “batch”. > The “migration” is a unique name identifying the migration. > “batch” is a incremental number indicating where the migration has been > done. > Suppose in the table you see: > > “Migration 1”, 1 > “Migration 2”, 1 > “Migration 3”, 2 > “Migration 4”, 3 > “Migration 5”, 3 > > This it means that your database has been “migrated” three times. The > first time it apply “Migration 1” and “Migration 2”, the second time it > apply “Migration 3” and the third time it apply “Migration 4” and > “Migration 5”. > > I don’t know if it’s a suitable approach for your case. But it seems to me > simple and effective. > > Ciao, > Gianluca. > > > On 23 Oct 2015, at 12:21, Daniel França <[email protected]> wrote: > > Any idea? > > Em qui, 22 de out de 2015 às 13:30, Daniel França <[email protected]> > escreveu: > >> Hi guys, >> I'm developing a single file ORM library for QML. >> For now it's doing most of the main operations on tables. >> You can see it here, with a basic documentation as well: >> https://github.com/danielfranca/quickmodel >> >> But now I'm trying to implement a way to have migrations, and can't find >> a good solution for that. >> >> I don't want anything complex, my goal will be to have something that you >> simply change the table you want and increase the database version (then >> the tables gonna be recreated and populated with existent data). >> >> I know about the changeVersion method on LocalStorage: >> http://doc.qt.io/qt-5/qtquick-localstorage-qmlmodule.html >> >> But I'm not sure about how to use it. >> i.e: >> I call *openDatabaseSync *with version 1.0 and create my tables. >> Then I change it to version 1.1 and call *changeVersion("1.0", "1.1")* >> >> But the next time my app runs it's not gonna open the database, instead >> it'll give me an error "*Version mismatch*", because now the database >> ini says that the database version is *1.1*, not *1.0.* >> >> And if I just change the open parameters to send *"1.1"*, it's not gonna >> even open in the first run, giving the same error, because ini file will >> say that the version is *1.0*, not *1.1.* >> >> To workaround this issue I'm just playing around with my own version >> control, and ignoring the builtin QML solution. >> >> But it looks wrong =/ >> Probably I'm missing something and couldn't understand correctly. >> Does anyone can help me find out a good solution? >> >> Best, >> Daniel >> >> _______________________________________________ > Interest mailing list > [email protected] > http://lists.qt-project.org/mailman/listinfo/interest > > >
_______________________________________________ Interest mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/interest
