mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-05-11 01:05:01 -04:00
Set planting.finished as a boolean
This commit is contained in:
@@ -30,7 +30,7 @@ module Api
|
||||
filter :planted_from
|
||||
filter :garden
|
||||
filter :owner
|
||||
filter :finished, default: nil
|
||||
filter :finished
|
||||
|
||||
attribute :percentage_grown
|
||||
def percentage_grown
|
||||
|
||||
8
db/migrate/20190317023129_finished_boolean.rb
Normal file
8
db/migrate/20190317023129_finished_boolean.rb
Normal file
@@ -0,0 +1,8 @@
|
||||
class FinishedBoolean < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
Planting.where('finished_at < now()').update_all(finished: true)
|
||||
Planting.where(finished: nil).update_all(finished: false)
|
||||
change_column_null :plantings, :finished, false
|
||||
change_column_default :plantings, :finished, from: nil, to: false
|
||||
end
|
||||
end
|
||||
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 2019_01_30_090437) do
|
||||
ActiveRecord::Schema.define(version: 2019_03_17_023129) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
@@ -385,7 +385,7 @@ ActiveRecord::Schema.define(version: 2019_01_30_090437) do
|
||||
t.string "sunniness"
|
||||
t.string "planted_from"
|
||||
t.integer "owner_id"
|
||||
t.boolean "finished", default: false
|
||||
t.boolean "finished", default: false, null: false
|
||||
t.date "finished_at"
|
||||
t.integer "lifespan"
|
||||
t.integer "days_to_first_harvest"
|
||||
|
||||
Reference in New Issue
Block a user