rails migration default value code example

Example 1: rails migration add default value

change_column :users, :admin, :boolean, :default => false

Example 2: default value rails migration

t.integer :col_name, :default => 0

Example 3: sequelize migration default value

queryInterface.addColumn('OrderBackups', 'my_column', {
  type: Sequelize.INTEGER,
  defaultValue: 0
})

Example 4: rails migration update column default value

class MigrationName < ActiveRecord::Migration
	def change
    	change_column :my_table, :my_column, :data_type, deafult: "value"
	end
end