New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple issues with Migration #114
Comments
A created database won't be removed even if you uninstall the app. You can try to rename the databaseName to apply the changes. I'm testing your model to see the other issues |
I tested your model. I found the cause of the issue that 2, it's because the column related itself by RelationType.ONE_TO_ONE. |
when it comes to the first issue, I didn't come across any issues like yours. The result like below:
now released v 1.3.5+1 |
Secondly the save method on TransactionMeta is hidden (_save). So how do I associate Transaction with TransactionMeta (create TransactionMeta object)? |
TransactionMeta is a child table which is related one-to-one, so it has been saved automatically when you save the Transaction I mean that transaction.save() saves all children sub items (only one-to-one) |
I just wanted to suggest. The persistence flow needs more clear documentation, I mean what's automated. Same thing was seen by me in one of previous threads where someone mentioned about _save method. What's automated and Actual examples with outputs will be really helpful as documentation to avoid such confusion and/or misunderstanding. Although thanks for auto versioning the table updates. Ome of many innovative things only found here. |
You’re right! I’m developing it, fixing, and trying to prepare Wiki at the same time. |
Do we have subquery conditions? Like for above models Transaction().select().transaction_meta.happened_at.equals(somedate).toList() returning Transactions list. Secondly for some reason TransactionMeta has declarations for sourceAccount effective Account,etc (all account relations in Transaction table) as transactionsSource, etc. |
you should try to get Transactions which are contains their ID's by filtering TransactionMeta table in 2 steps instead subquery, like this:
did you mean that? |
Yeah somewhat just like this but this creates 2 calls to DB. Can we use joins or subqueries to reduce calls to db? I have seen this functionality in Laravel Framework (PHP based) just to let know if helps. It might be a good inspiration to add up awesome things as ORM for sqflite. Actually many languages use Reflection API to avoid Code generation which isn't a stable thing as is in dart but following package reflectable might be somewhat useful to avoid any rewrites (code generation) and align with dynamic calls like in several ORMs (Laravel Eloquent) as I tried the same in Java Project link and worked like charm. Its not a complete thing, as I was passing over time getting trained in Java with this, but might provide a push somewhat. |
Tried this using |
it no longer 2 calls to DB as shown below.
just upgrade to this version:
it's worth a try :) |
Well if I can't get Transactions with list of Primary Keys of TransactionMeta right, I will need to check TransactionMeta column to find values in? |
What do you need to check for? I’m not sure I get |
I want to get Transactions where their TransactionMeta.happenedAt is in given month and Year only. Considering that Transaction and TransactionMeta have One to one relation. |
got it... How about creating a view model like tables? |
I have declared custom models and I've set up converters to convert data from Database types to those models for easy access. Coding those converters wasn't an issue but getting data and passing it through generically is becoming a tedious task. I do know reflection features are not provided fully by Dart (yet), although I suggest you to refer Laravel Framework's Eloquent models in case you need some help with easy features. |
Is there a way, that we can remove the existing db? |
It’s off-sqfentity, you can look at here: https://stackoverflow.com/questions/59124856/how-to-check-and-delete-all-existing-db-of-sqflite-in-flutter
|
Thanks |
Issue 1 - SourceAccount column for Transactions table alter request is called multiple times (2-3 (random but > 1) times as of logs and debug controls)
Issue 2 - DATABASE INITIALIZE ERROR The primary key name '_id' for table named [accounts] must be in [id]
Note - For issue 2, I wen't through #52. I investigated and completely uninstalled the app and re-ran the debug, still received this message.
The text was updated successfully, but these errors were encountered: