Note that there are some explanatory texts on larger screens.

plurals
  1. POSailsjs Models with different schemas
    primarykey
    data
    text
    <p>I am working on a sails app where I want a certain model to be from a different schema. However no matter what I do, all of my models come from the same schema so one or the other is instantiated into a blank table that contains no data.</p> <p>Here is my config/adapters.js:</p> <pre><code>module.exports.adapters = { // If you leave the adapter config unspecified // in a model definition, 'default' will be used. 'default': 'agency', disk: { module: 'sails-disk' }, agency:{ module: 'sails-postgresql', host: 'localhost', user: 'postgres', password: '*****', database: 'transit_analyst', port: 5432, pool: true }, routes:{ module: 'sails-postgresql', host: 'localhost', user: 'postgres', password: '******', database: 'testdb', port: 5432, pool: true } }; </code></pre> <p>Here is my fist model api/models/Agency.js</p> <pre><code>module.exports = { adapter: 'agency', schema:true, attributes: { date_last_updated: {type:'INTEGER'}, feed_baseurl: {type:'STRING'}, ... } }; </code></pre> <p>here is my second model api/models/Routes.js</p> <pre><code>module.exports = { adapter: 'routes', autoPK:false, attributes: { route_id: {type:"STRING"}, agency_id:{type:"STRING"}, ... ... } }; </code></pre> <p>I have tried using config:{} in the adapter as suggested in the documentation (<a href="http://sailsjs.org/#!documentation/models" rel="nofollow">http://sailsjs.org/#!documentation/models</a>). This can change which of the schemas is used (I think whichever gets processed first) but always its one or the other.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload