Add GameSystem model

This commit is contained in:
Trevor Vallender 2024-05-26 09:51:31 +01:00
parent f70a676456
commit ed01262d88
5 changed files with 28 additions and 1 deletions

View File

@ -0,0 +1,3 @@
class GameSystem < ApplicationRecord
validates :name, presence: true
end

View File

@ -0,0 +1,9 @@
class CreateGameSystems < ActiveRecord::Migration[7.1]
def change
create_table :game_systems do |t|
t.string :name, null: false
t.timestamps
end
end
end

8
db/schema.rb generated
View File

@ -10,10 +10,16 @@
# #
# 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[7.1].define(version: 2024_04_14_122652) do ActiveRecord::Schema[7.1].define(version: 2024_05_26_084840) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
create_table "game_systems", force: :cascade do |t|
t.string "name", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "users", force: :cascade do |t| create_table "users", force: :cascade do |t|
t.string "username", limit: 20, null: false t.string "username", limit: 20, null: false
t.string "password_digest", limit: 200, null: false t.string "password_digest", limit: 200, null: false

2
test/fixtures/game_systems.yml vendored Normal file
View File

@ -0,0 +1,2 @@
troika:
name: Troika

View File

@ -0,0 +1,7 @@
require "test_helper"
class GameSystemTest < ActiveSupport::TestCase
test "name must exist" do
assert_must_exist(game_systems(:troika), :name)
end
end