use mode reference for rfid tags
Some checks failed
CI / scan_ruby (push) Has been cancelled
CI / scan_js (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / test (push) Has been cancelled

This commit is contained in:
Christophe Robillard 2026-07-29 16:54:04 +02:00
parent dacd850493
commit 35a92a375d
3 changed files with 10 additions and 2 deletions

View file

@ -1,3 +1,4 @@
class RfidTag < ApplicationRecord
belongs_to :user, required: false
belongs_to :mode, required: false
end

View file

@ -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
View file

@ -10,7 +10,7 @@
#
# 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|
t.string "name", 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|
t.string "identifier"
t.string "mode"
t.datetime "created_at", default: -> { "CURRENT_DATE" }, null: false
t.datetime "updated_at", default: -> { "CURRENT_DATE" }, null: false
t.string "chip_id"
t.integer "user_id"
t.integer "mode_id"
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"
end