use mode reference for rfid tags
This commit is contained in:
parent
dacd850493
commit
35a92a375d
3 changed files with 10 additions and 2 deletions
|
|
@ -1,3 +1,4 @@
|
||||||
class RfidTag < ApplicationRecord
|
class RfidTag < ApplicationRecord
|
||||||
belongs_to :user, required: false
|
belongs_to :user, required: false
|
||||||
|
belongs_to :mode, required: false
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
class UpdateRfidTagsModeFromStringToMode < ActiveRecord::Migration[8.0]
|
||||||
|
def change
|
||||||
|
remove_column :rfid_tags, :mode
|
||||||
|
add_reference :rfid_tags, :mode
|
||||||
|
end
|
||||||
|
end
|
||||||
5
db/schema.rb
generated
5
db/schema.rb
generated
|
|
@ -10,7 +10,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema[8.0].define(version: 2026_03_19_181607) do
|
ActiveRecord::Schema[8.0].define(version: 2026_07_29_144217) do
|
||||||
create_table "active_storage_attachments", force: :cascade do |t|
|
create_table "active_storage_attachments", force: :cascade do |t|
|
||||||
t.string "name", null: false
|
t.string "name", null: false
|
||||||
t.string "record_type", null: false
|
t.string "record_type", null: false
|
||||||
|
|
@ -70,12 +70,13 @@ ActiveRecord::Schema[8.0].define(version: 2026_03_19_181607) do
|
||||||
|
|
||||||
create_table "rfid_tags", force: :cascade do |t|
|
create_table "rfid_tags", force: :cascade do |t|
|
||||||
t.string "identifier"
|
t.string "identifier"
|
||||||
t.string "mode"
|
|
||||||
t.datetime "created_at", default: -> { "CURRENT_DATE" }, null: false
|
t.datetime "created_at", default: -> { "CURRENT_DATE" }, null: false
|
||||||
t.datetime "updated_at", default: -> { "CURRENT_DATE" }, null: false
|
t.datetime "updated_at", default: -> { "CURRENT_DATE" }, null: false
|
||||||
t.string "chip_id"
|
t.string "chip_id"
|
||||||
t.integer "user_id"
|
t.integer "user_id"
|
||||||
|
t.integer "mode_id"
|
||||||
t.index ["identifier"], name: "index_rfid_tags_on_identifier", unique: true
|
t.index ["identifier"], name: "index_rfid_tags_on_identifier", unique: true
|
||||||
|
t.index ["mode_id"], name: "index_rfid_tags_on_mode_id"
|
||||||
t.index ["user_id"], name: "index_rfid_tags_on_user_id"
|
t.index ["user_id"], name: "index_rfid_tags_on_user_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue