sails-mysql模式数据types

任何人使用节点的sails框架使用MySQL作为数据库( https://github.com/balderdashy/sails-mysql )?

我困在模型中,我无法创build数据库结构。我需要用来创build模式的数据types不起作用。 我到处search一些文档,但我找不到任何可以帮助我的东西。

我猜,Sail的文档还不完整。 http://sailsjs.org/#documentation/models

任何人都可以请帮我创build模型。 如果你能帮助我使用sails-mysql创build下面的简单模式,我将非常感激。 提前致谢!

module.exports = { attributes: { id: 'FLOAT', social_network: { type: 'ENUM', defaultsTo : {'Facebook', 'twitter', 'vk','weibo'} }, country: 'STRING', message: 'TEXT', link: 'STRING', comments: 'TEXT', userid: 'INT', username: 'STRING', image_link: 'STRING', longitude: 'FLOAT', latitude: 'FLOAT', location_name: 'STRING', updated_at: 'TIMESTAMP', created_at: 'TIMESTAMP' } }; 

我是Waterline的作者,很抱歉,在文档中找不到您需要的内容,我们一直在努力添加并保持更新。

你的模式非常接近。 水线目前不支持数据库级ENUMtypes,但我们有validation,可以让你最终得到相同的最终结果。

 module.exports = { // Disables Automatic ID generation // (allows you to use a FLOAT type for your ID) autoPK: false, // Disables Automatic Timestamps // You will need to manually update your timestamps, usually best to leave this // on and remove the updated_at and created_at attributes below to let Waterline // keep these up to date for you autoCreatedAt: false, autoUpdatedAt: false, attributes: { id: { type: 'FLOAT', primaryKey: true } // Proper ENUM types at the Database level are not yet supported // but you can use validations to achieve the same end result. // You can also add a default social_network with defaultsTo social_network: { type: 'STRING', in: ['facebook', 'twitter', 'vk', 'weibo'] }, country: 'STRING', message: 'TEXT', link: 'STRING', comments: 'TEXT', userid: 'INTEGER', username: 'STRING', image_link: 'STRING', longitude: 'FLOAT', latitude: 'FLOAT', location_name: 'STRING', // Timestamp is not supported but Time, Date, and DateTime are updated_at: 'DATETIME', created_at: 'DATETIME' } };