add rfid_tag model

This commit is contained in:
Christophe Robillard 2025-08-06 17:14:06 +02:00
parent ac5faa4475
commit 240c94d1dd
5 changed files with 38 additions and 1 deletions

2
app/models/rfid_tag.rb Normal file
View file

@ -0,0 +1,2 @@
class RfidTag < ApplicationRecord
end

View file

@ -0,0 +1,11 @@
class CreateRfidTags < ActiveRecord::Migration[8.0]
def change
create_table :rfid_tags do |t|
t.string :identifier
t.string :mode
t.index :identifier, unique: true
t.timestamps
end
end
end

10
db/schema.rb generated
View file

@ -10,11 +10,19 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[8.0].define(version: 2025_07_07_090344) do
ActiveRecord::Schema[8.0].define(version: 2025_08_06_151318) do
create_table "moods", force: :cascade do |t|
t.string "mode"
t.datetime "recorded_at"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "rfid_tags", force: :cascade do |t|
t.string "identifier"
t.string "mode"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["identifier"], name: "index_rfid_tags_on_identifier", unique: true
end
end

9
test/fixtures/rfid_tags.yml vendored Normal file
View file

@ -0,0 +1,9 @@
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
identifier: MyString
mode: MyString
two:
identifier: MyString
mode: MyString

View file

@ -0,0 +1,7 @@
require "test_helper"
class RfidTagTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end