Skip to content

Commit f255db9

Browse files
committed
カラム削除に伴い NULL を許可する必要がなくなったから
1 parent b39381f commit f255db9

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class RemoveClassificationFromMedicalBills < ActiveRecord::Migration[6.0]
2+
def up
3+
remove_column :medical_bills, :classification, :string
4+
change_column_null :medical_bills, :classification_id, false
5+
end
6+
7+
def down
8+
add_column :medical_bills, :classification, :string
9+
change_column_null :medical_bills, :classification_id, true
10+
end
11+
end

db/schema.rb

+2-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#
1111
# It's strongly recommended that you check this file into your version control system.
1212

13-
ActiveRecord::Schema.define(version: 2021_03_07_150929) do
13+
ActiveRecord::Schema.define(version: 2021_03_14_083207) do
1414

1515
# These are extensions that must be enabled in order to support this database
1616
enable_extension "plpgsql"
@@ -29,14 +29,13 @@
2929

3030
create_table "medical_bills", force: :cascade do |t|
3131
t.date "day", null: false
32-
t.string "classification"
3332
t.integer "cost", null: false
3433
t.datetime "created_at", null: false
3534
t.datetime "updated_at", null: false
3635
t.bigint "user_id", null: false
3736
t.bigint "family_member_id", null: false
3837
t.bigint "payee_id", null: false
39-
t.bigint "classification_id"
38+
t.bigint "classification_id", null: false
4039
t.index ["classification_id"], name: "index_medical_bills_on_classification_id"
4140
t.index ["family_member_id"], name: "index_medical_bills_on_family_member_id"
4241
t.index ["payee_id"], name: "index_medical_bills_on_payee_id"

0 commit comments

Comments
 (0)