How should I handle the initialization of a prepopulated database ? #1583
Replies: 1 comment
-
Hi @leonardkrief |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi all
~2 years experienced dev, new to Swift and GRDB
I am trying to setup a GRDB stack onto my app
My app is a dictionnary that will rely on a static database (basically all the words and translations) that will weigh ~200MB
I tried to follow the best practices as shown in the Demo Apps, and I ended up with an AppDatabase class that I call at the launch of my app and that handles the initialization of my database (run migrations + populates it). But it seems to me that it always run the migrations + the populateDb function at the launch of the app. This is not what I expect as it will take a lot of time for my app to open everytime...
I guess I could also preload an already existing database, but I am not sure...
Would I still be able to rely on the GRDB associationRelationships like hasMany, belongsTo like in my examples below ?
Could you give me the best practice to handle such matter ?
Here are my files that I simplified for this example, my database schema is way bigger and complex than that:
Beta Was this translation helpful? Give feedback.
All reactions