Skip to content

Instantly share code, notes, and snippets.

@othonet
Created January 5, 2023 15:24
Show Gist options
  • Save othonet/eaca13c04968e8c425c8f28f74db4d9c to your computer and use it in GitHub Desktop.
Save othonet/eaca13c04968e8c425c8f28f74db4d9c to your computer and use it in GitHub Desktop.
Sequelize - Array on model with MySQL
nomeDoCampo: {
type: STRING,
allowNull: true,
set(valor) {
if (typeof valor === 'object') {
this.setDataValue('nomeDoCampo', valor.join(' e '))
} else {
this.setDataValue('nomeDoCampo', valor)
}
}
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment