YapDatabaseExtensions
                                
                                 YapDatabaseExtensions copied to clipboard
                                
                                    YapDatabaseExtensions copied to clipboard
                            
                            
                            
                        Change database directory from `.DocumentDirectory` to `.ApplicationSupportDirectory`
In a few places, you've recommended storing the SQLite database file in .DocumentDirectory:
What's the rationale behind this recommendation?
I've been placing my databases in .ApplicationSupportDirectory with the understanding that the Documents directory is reserved for files which are meaningful, not opaque, to the user.
Guidelines on this are not perfectly clear, but include these notes:
Put user data in Documents/. User data generally includes any files you might want to expose to the user—anything you might want the user to create, import, delete or edit. For a drawing app, user data includes any graphic files the user might create. For a text editor, it includes the text files.
Put app-created support files in the Library/Application support/ directory. In general, this directory includes files that the app uses to run but that should remain hidden from the user. This directory can also include data files…
Given that, and my recollection of app rejections for placing databases in the Documents directory, I have assumed that opaque datastores like SQLite DBs belong in Application Support, and only text/image and similar files belong in Documents.
Is there additional reasoning behind this recommendation which I may be missing?
No additional reasoning - all fair points, happy to change this to .ApplicationSupportDirectory.
If you want to do a pull request that would be great :) I'm in the middle of something else at the moment. But I can get to it in a few hours or so if not.
I think the change would warrant a new version though - so if you do a pull request to development that will be great, and then I'll do another release this evening.
No additional reasoning - all fair points, happy to change this to
.ApplicationSupportDirectory. … I think the change would warrant a new version though
Yeah…changing the databaseNamed implementation would be a breaking change for users, so I'll leave the appropriate amount of caution up to you. :warning:
If you want to do a pull request that would be great :) I'm in the middle of something else at the moment. But I can get to it in a few hours or so if not.
I'll try to send one later this afternoon—but if I don't, I'll get to it eventually. You don't have to rush to do it!
danthorpe added this to the 2.4 milestone an hour ago
If the implementation of databaseNamed changes to use a different directory by default, IMO we should probably hold off on this issue for a major/breaking 3.0 change, to follow http://semver.org .
Yeah, that's probably wise. Moving the database file would likely screw up all apps which use the framework.
I'll have a think about making a non-breaking change, and possibly support moving existing database files from the documents directory.