问题:无法解除风帆项目(最初为mysql编写,将适配器和设置更改为postgres)
错误:
info: ·• Auto-migrating... (drop)
error: A hook (`orm`) failed to load!
error:
error: error: syntax error at or near "ON"
at Connection.parseE (*/node_modules/pg/lib/connection.js:569:11)
at Connection.parseMessage (*/node_modules/pg/lib/connection.js:396:17)
at Socket.<anonymous> (*/node_modules/pg/lib/connection.js:132:22)
at Socket.emit (events.js:189:13)
at Socket.EventEmitter.emit (domain.js:441:20)
at addChunk (_stream_readable.js:284:12)
at readableAddChunk (_stream_readable.js:265:11)
at Socket.Readable.push (_stream_readable.js:220:10)
at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
error: Could not load Sails app.
适配器响应:
错误详情:
{ error: syntax error at or near "ON"
at Connection.parseE (*/node_modules/pg/lib/connection.js:569:11)
at Connection.parseMessage (*/node_modules/pg/lib/connection.js:396:17)
at Socket.<anonymous> (*/node_modules/pg/lib/connection.js:132:22)
at Socket.emit (events.js:189:13)
at Socket.EventEmitter.emit (domain.js:441:20)
at addChunk (_stream_readable.js:284:12)
at readableAddChunk (_stream_readable.js:265:11)
at Socket.Readable.push (_stream_readable.js:220:10)
at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
name: 'error',
length: 92,
severity: 'ERROR',
code: '42601',
detail: undefined,
hint: undefined,
position: '191',
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'scan.l',
line: '1134',
routine: 'scanner_yyerror' }
我尝试更改数据存储设置,尝试localhost和远程部署,用户名和密码,更改角色,数据库权限。但似乎没有解决这个问题。
我错过了什么吗?
adapter: 'sails-postgresql',
url: 'postgresql://postgres:postgres@localhost:5432/postgres',
型号类型:
module.exports = {
tableName: 'roles',
attributes: {
name: {
type: "string",
required: true,
columnType: "varchar(255) COLLATE utf8_unicode_ci NOT NULL"
},
company_id: {
type: "number",
required: true,
columnType: "int(11) NOT NULL"
},
mobile_user: {
type: "number",
required: false,
defaultsTo: 0,
columnType: "tinyint(1) NOT NULL DEFAULT '0'"
},
enforcement: {
type: "number",
required: false,
defaultsTo: 0,
columnType: "tinyint(1) NOT NULL DEFAULT '0'"
},
}
};
我正在将我的数据库从mysql迁移到postgre。有人遇到同样的问题吗
在尝试更多设置和更改之后。我发现问题是由模型引起的,即通过将模型的columnType中提到的所有数据类型和条件从MySQL更改为PostgresSQL,它就像一个魅力。
示例:tinyint(1) - > smallint,删除COLLATE条件等