我遇到了帆和帆 - postgresql的巨大问题 .

我正在使用风帆v 0.10.0-rc8和sails-postgresql v 0.10.0-rc4

我有postgres数据库,为不同的应用程序提供了很少的不同模式 .

这些模式包含一些具有完全相同名称的表,例如:

模式测试有表uzytkownicy(用户)和模式webApp也有表uzytkownicy但有一些不同的属性 .

以某种方式使用sails-postgresql进行风帆将所有模式中所有具有相同名称的表连接到一个巨大的表中(在数据库中不存在),并在尝试从我的模型中定义的表中获取某些数据时抛出错误 .

例:

我的模型定义:

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
    }

  }
};

我的sails-postgresql配置:

postgresql_app: {
    adapter: 'sails-postgresql',
    host: '<IP_ADRESS>',
    user: '<USERNAME>',
    port: '<PORT>',
    database: '<DATABASE>',
    password: '<PASSWORD>'
}

现在来自sails控制台模型定义(仅来自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 with 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属性是正确的,但schema属性包含来自不同模式的所有表uzytkownicy的字段 .

当我想获得一些数据时:

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

我得到例外:

sails> Uzytkownicy.find({}).exec(console.log)
Error (E_UNKNOWN) :: Encountered an unexpected error
error: column uzytkownicy.login does not exists
    at Connection.parseE (/home/aplikacje/www/nodejs/webApp/trunk/node_modules/sails-postgresql/node_modules/pg/lib/connection.js:526:11)
    at Connection.parseMessage (/home/aplikacje/www/nodejs/webApp/trunk/node_modules/sails-postgresql/node_modules/pg/lib/connection.js:356:17)
    at Socket.<anonymous> (/home/aplikacje/www/nodejs/webApp/trunk/node_modules/sails-postgresql/node_modules/pg/lib/connection.js:105:22)
    at Socket.EventEmitter.emit (events.js:95:17)
    at Socket.<anonymous> (_stream_readable.js:746:14)
    at Socket.EventEmitter.emit (events.js:92:17)
    at emitReadable_ (_stream_readable.js:408:10)
    at emitReadable (_stream_readable.js:404:5)
    at readableAddChunk (_stream_readable.js:165:9)
    at Socket.Readable.push (_stream_readable.js:127:10)

Details:  error: column uzytkownicy.login does not exists

这是真的,因为我的webApp.uzytkownicy没有列登录,它存在于不同的模式中!

但是,创建(Uzytkownicy.create())数据非常有效,数据只会插入到我的webApp.uzytkownicy表中 .

我在配置上做错了吗?我想只使用架构webApp而不与其他架构交互 .