1
0
This repository has been archived on 2023-12-07. You can view files and clone it, but cannot push or open issues or pull requests.
body_tracking/db/migrate/001_create_units.rb
cryptogopher fea736bd36 Changed Unit.type -> .group
Added Unit validations. Added default Units.
2019-08-16 19:29:23 +02:00

24 lines
635 B
Ruby

class CreateUnits < ActiveRecord::Migration
def change
create_table :units do |t|
t.references :project
t.string :name
t.string :shortname
t.integer :group
end
reversible do |dir|
dir.up do
Unit.create project: nil, shortname: "", name: "count", group: :number
Unit.create project: nil, shortname: "%", name: "percent", group: :share
Unit.create project: nil, shortname: "g", name: "gram", group: :mass
Unit.create project: nil, shortname: "kg", name: "kilogram", group: :mass
end
dir.down do
Unit.delete_all
end
end
end
end