flutter_downloader icon indicating copy to clipboard operation
flutter_downloader copied to clipboard

Add text column db

Open mohammadne opened this issue 5 years ago • 17 comments

in my use case I have to add additional info to task table (very necessary for me). refer to issue #195 so I open my first pull request in open source. then I try to download but it will fail. if anyone can help me that's a good encouragement for me.

Thanks to the community.

mohammadne avatar Dec 26 '19 09:12 mohammadne

Awesome. I will look at it. Thanks for your contribution

hnvn avatar Dec 27 '19 06:12 hnvn

Have you tested on iOS yet? On the iOS side, to modify the database schema, you need to update the sql file too. And what about DB migration? If current projects upgrade to this new DB, does it still work?

hnvn avatar Dec 28 '19 08:12 hnvn

Btw, I've used sqlitebrowser to create that sql file

hnvn avatar Dec 28 '19 08:12 hnvn

Hi hnvn. No, I don't test it on ios. So what do we should do?

I think this is necessary in most projects which uses flutter downloader.

mohammadne avatar Dec 28 '19 19:12 mohammadne

Working with SQLite in iOS is painful. I concern that modifying DB schema might break the current features.

hnvn avatar Dec 29 '19 03:12 hnvn

Ok, Thanks a lot hnvn for attention. If you decide to modify DB, I will test it on both ios and Android to see does it break current features or not. But if you can't, I hope someone can modify the DB.

mohammadne avatar Dec 29 '19 15:12 mohammadne

Thanks for your contribution. My priority now is to migrate this plugin to embedding v2, then I will get back to this issue and try to find a solution for it.

hnvn avatar Dec 31 '19 01:12 hnvn

Thanks for your plugin migration. Is it possible to find a solution for this?

mohammadne avatar Jan 17 '20 13:01 mohammadne

@mohammadne Do you use this to store json data? I'm looking for something that could do that instead of writing it externally and keeping two separate date sources in sync.

befora avatar Jan 18 '20 02:01 befora

any Update on this ???

mohammadne avatar Feb 06 '20 16:02 mohammadne

If you need to store additional information related to a task (and that information is not related to downloading the task) then I think you should create an additional database or map that has taskId as its key and whatever fields you want to add. I don't think you should add functionality or features to the downloader task database that are not strictly required for or related to the download functionality

781flyingdutchman avatar Mar 27 '20 01:03 781flyingdutchman

Sorry to bump?

markturnip avatar Jul 22 '20 04:07 markturnip

Hi,

I think the better idea is to define a list of parameters like Map<String,String> and before storing in database use method like "json_encode" to convert that list to string, and when retrieving from database convert it back to list by "json_decode". Also, maybe we can also use an extra column like 'description' column in tasks database for this purpose. Adding description column to database is common in programming and can be used for different goals like this.

I'm looking forward to hearing from you guys. Thanks.

alr2413 avatar Jul 27 '20 11:07 alr2413

Hey @hnvn, what must be done so this PR gets merged? I also need it and it seems that most of the job is done here, isn't it?

I am willing to contribute if I can.

mr-mmmmore avatar Feb 15 '21 08:02 mr-mmmmore

Working with SQLite in iOS is painful. I concern that modifying DB schema might break the current features.

What are you afraid of @hnvn? Since this is a new column I don't see how it could break any feature as no pre-existing code rely on it.

I see that at the moment the plugin simply deletes the previous database in Android when a migration of the database is required (TaskDbHelper.onUpgrade), couldn't the same be done on iOS? (Although it's quite rude... it would be rather simple to only alter the table upon migration on Android, on iOS I don't know, it seems to be less automatic).

mr-mmmmore avatar Feb 15 '21 09:02 mr-mmmmore

Hi, is this a tested fork, does it work on both android and ios, if it does it should be merged with the main project, it a very crucial features, how are we supposes to track what our apps download if there is noting unique we can add in the tasks db, so pls @hnvn can you inform us if we should use this fork or if we should wait till it can be merged.

abeyshiferaw0 avatar Nov 05 '21 07:11 abeyshiferaw0

Alas it seems that nothing has happen on this matter. I have had to implement my own persistent db in parallel to keep track of the "loading task"/"app entity" mapping and it has been a real pain to keep it in sync with the plugin's one. If someone could finish this PR all this work could be avoided (I didn't because I am not myself an iOS developer).

I had created another issue where I describe the problems that such a feature would solve: #402.

mr-mmmmore avatar Nov 05 '21 08:11 mr-mmmmore