-
Notifications
You must be signed in to change notification settings - Fork 59
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
Initialize Database Table #106
Conversation
@daffl @marshallswain @ekryski @eddyystop - This is ready if anyone wants to give it a look over. Same idea as this one on feathers-rethinkdb - makes it much easier to abstract the database models in the generator if we use this method so people can define their own schemas. |
update readme readme spacing Readme comments
Seems like an issue upstream from us with this part of the pre-gyp / sqlite3 build on node 8:
|
I am not sure this is something we can solve until upstream compiles a node 8 compatible version of the fsevents pre-built binaries or fixes the node-gyp build. |
Posted in node-sqlite3 to see anyone can point me in the right direction. |
Yay, build fixed in TryGhost/node-sqlite3#825! |
Sorry, totally missed this one somehow. Is this because of the same issue as feathersjs/feathers#581 (and the generator fix in feathersjs-ecosystem/generator-feathers#231)? |
@daffl it refactors that logic into init() just like we did in feathers-rethinkdb and I intend to do in every adapter for v3 generator. I wasn't aware of either of those issues but they seem related, if not overlapping. This addresses th by moving the logic to init, which can be conditional and I think is an ideal approach so we keep the adapter interfaces consistent. More in person on Thursday? |
@daffl are you cool with me merging and publishing this as 2.7.0? |
Two things:
|
@daffl it doesn't look like this is supported by knex:
|
It should work as long as you call |
This has been updated so that it returns a promise and doesn't drop the table if the table already exists. It still however requires us to pass a callback into Fundamentally this is the same thing we're doing in v2, but more user friendly because we moved the table management decision into the init method so user land doesn't have to fumble around with the best way to manage the table. This is particularly important within the generator. We should adopt this in v2 generator templates too. |
I think this is ready to be released now. |
overview
This PR adds
service({}).init()
which returns a promise and gracefully degrades if database is already initialized.tasks
init(opts={}, fn[table])