-
Notifications
You must be signed in to change notification settings - Fork 58
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
How to setup relations between tables ? #60
Comments
I think the issue might be this line: I'm no promise expert, but it looks to me that this lambda is returning a boolean and not a promise because of the
|
Hi @jayalfredprufrock , Unfortunately, this hasn't changed anything. The configure is still not waiting for the I tried this way, but i'm still getting the relation errors sometimes :
|
Fair enough, I've never used configure() to set up my database before. I take advantage of knex's migration and seeding features which tie in nicely with npm scripts. Perhaps somebody with more experience with feathers can help you figure out what's going on. Good luck! |
@jayalfredprufrock I'd be interested in knowing how you're doing it then, if you have time for a short explanation ? Or do you have some open source project where i could see how you're doing it ? Thanks. |
Unfortunately I'm only using this approach on closed-source projects at the moment, but I'm really not doing anything special. I'm just utilizing the knex CLI to build and seed my database before testing and deploying. See http://knexjs.org/#Migrations-CLI My knexfile looks something like this and is in a top level directory "db":
Then I connect everything with some scripts:
Hope that helps! |
Ok, thanks for you help, i'll try this approach ;) |
Looks like we can close this. Side note: feathers-bootstrap which will be used in the new generator will also allow asynchronous application configuration so it might make this a little easier. |
Hello evrybody, sorry for the noob question but I absolutely don't manage to set this up. I have two models users and relations and I want to connect them. The use of Knex is mandatory (I use an already existing db so I need low level feature, not sequelize). relations/user_roles.relation.js
app.js // Configure other middleware (see `middleware/index.js`)
app.configure(middleware);
app.configure(authentication);
// Set up our services (see `services/index.js`)
app.configure(services);
// Set up event channels (see channels.js)
app.configure(channels);
// Set up relations between services and models
// FAIL because I can't wait for the services configuration to be done
app.configure(relations); So basically I'd like to be able to wait for the services configuration to be done before setting up the relationships between all of them, but I can't find a working solution. |
@eric-burel @daffl Did you ever happen to find a solution to this issue? I'm having having issues with async configuration of knex models with relations. |
Hi guys,
I'm testing an app with Knex right now, and having a bit of a problem when preparing my schemas. Since app.configure doesn't wait to be finished to go on the next one, i'm getting "relation does not exist" errors half of the time when loading with my empty database.
I'm using the app structure from the generator for postgres (which is loaded with sequelize by default). So far, i got this :
Is it possible to make
app.configure
wait or i am doing it the wrong way ?Thanks.
The text was updated successfully, but these errors were encountered: