Given the scenario I want to insert a default value in a database column (date_introduced). I'm considering two alternatives:
What would be the specific benefits for each alternative? But of course there are other scenario's like checking on an input, etc... each with their own concerns.
Write a simple migration for your Sequelize DB.
'use strict';
module.exports = {
up: function (queryInterface, Sequelize) {
return queryInterface.changeColumn('tableName', 'columnName', {
type: Sequelize.STRING,
defaultValue: <defaultValue>
});
},
down: function (queryInterface, Sequelize) {
return queryInterface.changeColumn('tableName', 'columnName', {
type: Sequelize.STRING,
defaultValue: null
});
}
};
You can find more info in official documentation of feathers.