Hi! In one-to-one association at the bottom there is a section about using existing tables. But it only covers how to specify a table name and table columns for simple attributes. But how can i specify a foreign key name for association?
I mean something like this:
var User = Waterline.Collection.extend({
identity: 'user',
connection: 'local-postgresql',
tableName: 'pb_user'
attributes: {
id: {
type: 'integer',
primaryKey: true
},
firstName: {
type: 'string',
columnName: 'pb_owner_first'
},
lastName: {
type: 'string',
columnName: 'pb_owner_last'
},
// Add a reference to Pet
pet: {
model: 'pet'
columnName: : 'pb_pet_id' // << foreign key existing column name
}
}
});
So, from db point, there is a pb_pet_id column, which is foreign key, but from js/waterline view — we'll get a pet object, that is associated with user.
Hi! In one-to-one association at the bottom there is a section about using existing tables. But it only covers how to specify a table name and table columns for simple attributes. But how can i specify a foreign key name for association? I mean something like this:
So, from db point, there is a pb_pet_id column, which is foreign key, but from js/waterline view — we'll get a pet object, that is associated with user.