diff options
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20220115164423_create_players.rb | 13 | ||||
-rw-r--r-- | db/migrate/20220115164820_create_machines.rb | 12 | ||||
-rw-r--r-- | db/schema.rb | 30 | ||||
-rw-r--r-- | db/seeds.rb | 8 |
4 files changed, 63 insertions, 0 deletions
diff --git a/db/migrate/20220115164423_create_players.rb b/db/migrate/20220115164423_create_players.rb new file mode 100644 index 0000000..b12249a --- /dev/null +++ b/db/migrate/20220115164423_create_players.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class CreatePlayers < ActiveRecord::Migration[7.0] + def change + create_table :players do |t| + t.string :name + t.boolean :paid + t.integer :strikes + + t.timestamps + end + end +end diff --git a/db/migrate/20220115164820_create_machines.rb b/db/migrate/20220115164820_create_machines.rb new file mode 100644 index 0000000..6e889fc --- /dev/null +++ b/db/migrate/20220115164820_create_machines.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +class CreateMachines < ActiveRecord::Migration[7.0] + def change + create_table :machines do |t| + t.string :name + t.string :edition + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb new file mode 100644 index 0000000..308429d --- /dev/null +++ b/db/schema.rb @@ -0,0 +1,30 @@ +# This file is auto-generated from the current state of the database. Instead +# of editing this file, please use the migrations feature of Active Record to +# incrementally modify your database, and then regenerate this schema definition. +# +# This file is the source Rails uses to define your schema when running `bin/rails +# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to +# be faster and is potentially less error prone than running all of your +# migrations from scratch. Old migrations may fail to apply correctly if those +# migrations use external dependencies or application code. +# +# It's strongly recommended that you check this file into your version control system. + +ActiveRecord::Schema.define(version: 2022_01_15_164820) do + + create_table "machines", force: :cascade do |t| + t.string "name" + t.string "edition" + t.datetime "created_at", precision: 6, null: false + t.datetime "updated_at", precision: 6, null: false + end + + create_table "players", force: :cascade do |t| + t.string "name" + t.boolean "paid" + t.integer "strikes" + t.datetime "created_at", precision: 6, null: false + t.datetime "updated_at", precision: 6, null: false + end + +end diff --git a/db/seeds.rb b/db/seeds.rb new file mode 100644 index 0000000..0664d1b --- /dev/null +++ b/db/seeds.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true +# This file should contain all the record creation needed to seed the database with its default values. +# The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup). +# +# Examples: +# +# movies = Movie.create([{ name: "Star Wars" }, { name: "Lord of the Rings" }]) +# Character.create(name: "Luke", movie: movies.first) |