20 lines
508 B
Ruby
20 lines
508 B
Ruby
class CreateSuppliers < ActiveRecord::Migration
|
|
has_many :products
|
|
def self.up
|
|
db_name = ActiveRecord::Base::connection.current_database()
|
|
execute "ALTER DATABASE #{db_name} CHARACTER SET utf8 COLLATE utf8_general_ci"
|
|
|
|
create_table :suppliers do |t|
|
|
t.column :name, :string
|
|
t.column :description, :text
|
|
t.column :code, :string
|
|
t.column :created_at, :datetime
|
|
t.column :updated_at, :datetime
|
|
end
|
|
end
|
|
|
|
def self.down
|
|
drop_table :suppliers
|
|
end
|
|
end
|