node.js - sails js and postgres database with few diffrent schemas and same table names in diffrent schemas -


i've encountered huge problem sails , sails-postgresql.

im using sails v 0.10.0-rc8 , sails-postgresql v 0.10.0-rc4

i have postgres database few diffrent schemas diffrent applications.

these schemas contains tables same name example:

schema test has table uzytkownicy (users) , schema webapp has table uzytkownicy diffrent attributes.

somehow sails sails-postgresql join tables same name schemas 1 huge table (which dont exists in database) , throw errors when im trying data table defined in model.

example:

my model definition:

module.exports = {    adapter: 'postgresql_app',   tablename: 'uzytkownicy',   migrate: 'safe',   autopk: false,   autocreatedat: false,   autoupdatedat: false,    meta: {     schemaname: 'webapp'   },    attributes: {      id_uzytkownicy: {         type: 'integer',         index: true,         primarykey: true     },      id_role: {         model: 'role'     },      imie: {         type: 'string',         required: true     },      nazwisko: {         type: 'string',         required: true     },      username: {         type: 'string',         required: true     }    } }; 

my sails-postgresql configuration:

postgresql_app: {     adapter: 'sails-postgresql',     host: '<ip_adress>',     user: '<username>',     port: '<port>',     database: '<database>',     password: '<password>' } 

now sails console model definition (only partial output sails> uzytkownicy):

 usernamecontains: [function: bound],   usernameendswith: [function: bound],   definition:    { id_uzytkownicy:       { type: 'integer',         index: true,         primarykey: true,         unique: true },      id_role:       { type: 'integer',         model: 'role',         foreignkey: true },      imie: { type: 'string' },      nazwisko: { type: 'string' },      username: { type: 'string' } },   meta:    { schemaname: 'webapp',      junctiontable: false },   schema:    { id_uzytkownicy:       { type: 'integer',         primarykey: true,         autoincrement: true },      id_role: { type: 'integer' },      imie: { type: 'text' },      nazwisko: { type: 'text' },      username: { type: 'character varying(128)' },      login: { type: 'character varying(64)' },      test: { type: 'timestamp time zone' },      id_stanowisko: { type: 'integer' },      id_wydzial: { type: 'integer' },      id_firma: { type: 'integer' },      id_rodzaj_umowy: { type: 'integer' },      id_osoby_z_ifs: { type: 'integer', unique: true },      id_przelozonego: { type: 'integer' },      sha_password: { type: 'text' },      pozostale_dni_urlopu: { type: 'integer' },      edytowany: { type: 'boolean' },      id_uzytkownika: { type: 'numeric', primarykey: true },      id_roli: { type: 'numeric' },      zalogowany: { type: 'boolean' } },   alter: [function: bound],   builddynamicfinders: [function: bound], 

definition attribute correct schema attribute contains fields combined tables uzytkownicy diffrent schemas.

when want data:

sails> uzytkownicy.find({}).exec(console.log) 

im getting exception:

sails> uzytkownicy.find({}).exec(console.log) error (e_unknown) :: encountered unexpected error error: column uzytkownicy.login not exists     @ connection.parsee (/home/aplikacje/www/nodejs/webapp/trunk/node_modules/sails-postgresql/node_modules/pg/lib/connection.js:526:11)     @ connection.parsemessage (/home/aplikacje/www/nodejs/webapp/trunk/node_modules/sails-postgresql/node_modules/pg/lib/connection.js:356:17)     @ socket.<anonymous> (/home/aplikacje/www/nodejs/webapp/trunk/node_modules/sails-postgresql/node_modules/pg/lib/connection.js:105:22)     @ socket.eventemitter.emit (events.js:95:17)     @ socket.<anonymous> (_stream_readable.js:746:14)     @ socket.eventemitter.emit (events.js:92:17)     @ emitreadable_ (_stream_readable.js:408:10)     @ emitreadable (_stream_readable.js:404:5)     @ readableaddchunk (_stream_readable.js:165:9)     @ socket.readable.push (_stream_readable.js:127:10)  details:  error: column uzytkownicy.login not exists 

what true because webapp.uzytkownicy not has column login, exists in diffrent schema!

however creating (uzytkownicy.create()) data works , data inserted webapp.uzytkownicy table.

am doing wrong in configuration? want use schema webapp without interactions other schemas.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -