Post by jontara on Sept 11, 2017 20:22:52 GMT
What would I need to do to include a pre-populated database in a Rhodes app?
I do not need/use RhoConnect.
Currently, I have some JSON files that I load the first time the app is run. (Actually, if a table is empty.) It's wasteful, as the JSON files aren't needed once the DB is loaded. (But it also makes it easy to do a database reset...)
Since most JSON is highly compressible, it hasn't been that much wasted space (as app bundles are compressed). Even though I have about 1,000 image files loaded into the DB (they are SVG, so just text). The DB is about 10MB after it is populated, and in fact the entire app as distributed is only 10MB! (And I know that the minimum size of a trivial Rhodes app is around 5MB...)
But now I need to add some video MP4 files to some DB attributes. So, I would rather not base64 them in order to include in the JSON, and then decode them to load into the DB.
I actually have a rake task that populates a "prototype" SQLite DB from the images, and some text is just populated directly in the prototype DB using DB Browser for SQLite. And in fact, I copy the empty prototype DB from an iOS simulator instance in the first place. And then I export JSON from the prototype DB (a rake task). (Part of the rake task removes the object values, so that they aren't included in the JSON.)
With the addition of video files, I think I've taken this hack as far as reasonable. I'd like to just be able to drop a pre-populated DB into the app. (I realize then I lose the reset capability, though.)
I suppose it would make sense to populate object with some values that will not conflict with Rhode's object value generation scheme.
Is there any example showing how to do this?
I do not need/use RhoConnect.
Currently, I have some JSON files that I load the first time the app is run. (Actually, if a table is empty.) It's wasteful, as the JSON files aren't needed once the DB is loaded. (But it also makes it easy to do a database reset...)
Since most JSON is highly compressible, it hasn't been that much wasted space (as app bundles are compressed). Even though I have about 1,000 image files loaded into the DB (they are SVG, so just text). The DB is about 10MB after it is populated, and in fact the entire app as distributed is only 10MB! (And I know that the minimum size of a trivial Rhodes app is around 5MB...)
But now I need to add some video MP4 files to some DB attributes. So, I would rather not base64 them in order to include in the JSON, and then decode them to load into the DB.
I actually have a rake task that populates a "prototype" SQLite DB from the images, and some text is just populated directly in the prototype DB using DB Browser for SQLite. And in fact, I copy the empty prototype DB from an iOS simulator instance in the first place. And then I export JSON from the prototype DB (a rake task). (Part of the rake task removes the object values, so that they aren't included in the JSON.)
With the addition of video files, I think I've taken this hack as far as reasonable. I'd like to just be able to drop a pre-populated DB into the app. (I realize then I lose the reset capability, though.)
I suppose it would make sense to populate object with some values that will not conflict with Rhode's object value generation scheme.
Is there any example showing how to do this?