SailsJS / Waterline不能在Postgres中创build模型

我试图将我的Sails JS应用程序部署到标准的Ubuntu 14.04.3 VM上。

现在,我无法连接我的SailsJS实例与PostgreSQL服务器实例。 SailsJS服务器和PostgreSQL服务器都运行在同一个VM中。

我从我的Sails JS日志得到以下输出:

MySailsServer-0 Sending 500 ("Server Error") response: Error (E_UNKNOWN) :: Encountered an unexpected error error: relation "recording" does not exist at Connection.parseE (/home/vmuser/MySailsServer/node_modules/sails-postgresql/node_modules/pg/lib/connection.js:539:11) at Connection.parseMessage (/home/vmuser/MySailsServer/node_modules/sails-postgresql/node_modules/pg/lib/connection.js:366:17) at Socket.<anonymous> (/home/vmuser/MySailsServer/node_modules/sails-postgresql/node_modules/pg/lib/connection.js:105:22) at emitOne (events.js:77:13) at Socket.emit (events.js:169:7) at readableAddChunk (_stream_readable.js:146:16) at Socket.Readable.push (_stream_readable.js:110:10) at TCP.onread (net.js:523:20) 

看起来好像我的Recording模型没有在数据库中创build。 我检查了Postgre日志以获取更多信息。 以下是cat /var/log/postgresql/postgresql-9.3-main.log的输出:

 2015-10-17 14:46:13 CDT ERROR: relation "recording" does not exist at character 491 2015-10-17 14:46:13 CDT STATEMENT: SELECT "recording"."startTime", "recording"."endTime", "recording"."filename", "recording"."id", "recording"."createdAt", "recording"."updatedAt", "recording"."section", "__section"."startTime" AS "section___startTime", "__section"."endTime" AS "section___endTime", "__section"."name" AS "section___name", "__section"."id" AS "section___id", "__section"."createdAt" AS "section___createdAt", "__section"."updatedAt" AS "section___updatedAt", "__section"."course" AS "section___course" FROM "recording" AS "recording" LEFT OUTER JOIN "section" AS "__section" ON "recording"."section" = "__section"."id" LIMIT 30 OFFSET 0 

任何关于为什么我没有在api/models/下声明的api/models/在PostgreSQL中被制作成表格的线索?

这是我在config/connections.js下的config/connections.js

  postgresqlServer: { adapter: 'sails-postgresql', host: 'localhost', user: <username>, password: <password>, database: <db_name>, schema: true } 

config/models.js我已经把:

 module.exports.models = { connection: 'postgresqlServer', migrate: 'alter' }; 

我不明白我在做什么不正确。 好像我的SailsJS模型没有被翻译成PostgreSQL表格,我不知道为什么。 任何帮助是极大的赞赏!

如果您在提升sails lift --prod生产模式下sails lift --prod ,则帆将水线强行转换为“安全”模式。 在安全模式下,不做任何数据库更改,包括表的初始设置。

要预先build立模型,您需要运行没有prod标志的sails lift 。 理想情况下,如果您使用部署脚本,则这是构build过程的一部分。