Class: WineDb::CreateDb
- Inherits:
-
ActiveRecord::Migration
- Object
- ActiveRecord::Migration
- WineDb::CreateDb
- Defined in:
- lib/winedb/schema.rb
Instance Method Summary collapse
-
#down ⇒ Object
method up.
- #up ⇒ Object
Instance Method Details
#down ⇒ Object
method up
68 69 70 |
# File 'lib/winedb/schema.rb', line 68 def down raise ActiveRecord::IrreversibleMigration end |
#up ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/winedb/schema.rb', line 8 def up create_table :wines do |t| t.string :key, null: false # import/export key t.string :title, null: false t.string :synonyms # comma separated list of synonyms t.string :web # optional url link (e.g. ) t.integer :since # optional year (e.g. 1896) ## check: why decimal and not float? t.decimal :abv # Alcohol by volume (abbreviated as ABV, abv, or alc/vol) e.g. 4.9 % t.references :winery # optional (for now) t.string :txt # source ref t.boolean :txt_auto, null: false, default: false # inline? got auto-added? t.references :country, null: false t.references :region # optional t.references :city # optional t. end create_table :wineries do |t| t.string :key, null: false # import/export key t.string :title, null: false t.string :synonyms # comma separated list of synonyms t.string :address t.integer :since ## renamed to founded to since ## t.integer :founded # year founded/established - todo/fix: rename to since? t.integer :closed # optional; year winery closed t.integer :area # in ha e.g. 8 ha # Weingarten/rebflaeche # use stars in .txt e.g. # ***/**/*/- => 1/2/3/4 t.integer :grade, null: false, default: 4 t.string :txt # source ref t.boolean :txt_auto, null: false, default: false # inline? got auto-added? t.string :web # optional web page (e.g. www.ottakringer.at) t.string :wikipedia # optional wiki(pedia page) t.references :country, null: false t.references :region # optional t.references :city # optional t. end end |