sql >> Base de Datos >  >> RDS >> Mysql

tipos de datos de esquema de sails-mysql

Soy el autor de Waterline, lamento que no haya podido encontrar lo que necesitaba en los documentos, estamos trabajando constantemente para agregarlos y mantenerlos actualizados.

Estás muy cerca de tu esquema. Waterline actualmente no admite un nivel de base de datos ENUM escriba pero tenemos validaciones que le permitirán terminar con el mismo resultado final.

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'
  }
};