From 0929719a845897cc8567cf972e07a69a71f0fa6f Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Thu, 30 Nov 2023 13:29:08 -0500 Subject: Migrate to a full rails app --- db/migrate/20231028205751_create_wittle_puzzles.rb | 11 -------- db/migrate/20231028210722_create_wittle_scores.rb | 12 -------- db/migrate/20231130173455_create_puzzles.rb | 11 ++++++++ db/migrate/20231130173513_create_scores.rb | 12 ++++++++ db/schema.rb | 32 ++++++++++++++++++++++ db/seeds.rb | 9 ++++++ 6 files changed, 64 insertions(+), 23 deletions(-) delete mode 100644 db/migrate/20231028205751_create_wittle_puzzles.rb delete mode 100644 db/migrate/20231028210722_create_wittle_scores.rb create mode 100644 db/migrate/20231130173455_create_puzzles.rb create mode 100644 db/migrate/20231130173513_create_scores.rb create mode 100644 db/schema.rb create mode 100644 db/seeds.rb (limited to 'db') diff --git a/db/migrate/20231028205751_create_wittle_puzzles.rb b/db/migrate/20231028205751_create_wittle_puzzles.rb deleted file mode 100644 index ebe0bf7..0000000 --- a/db/migrate/20231028205751_create_wittle_puzzles.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateWittlePuzzles < ActiveRecord::Migration[7.1] - def change - create_table :wittle_puzzles do |t| - t.text :data - t.text :solved_data - t.string :category - - t.timestamps - end - end -end diff --git a/db/migrate/20231028210722_create_wittle_scores.rb b/db/migrate/20231028210722_create_wittle_scores.rb deleted file mode 100644 index aa49a13..0000000 --- a/db/migrate/20231028210722_create_wittle_scores.rb +++ /dev/null @@ -1,12 +0,0 @@ -class CreateWittleScores < ActiveRecord::Migration[7.1] - def change - create_table :wittle_scores do |t| - t.references :puzzle, null: false - t.string :name - t.string :ip - t.integer :seconds_taken - - t.timestamps - end - end -end diff --git a/db/migrate/20231130173455_create_puzzles.rb b/db/migrate/20231130173455_create_puzzles.rb new file mode 100644 index 0000000..548473a --- /dev/null +++ b/db/migrate/20231130173455_create_puzzles.rb @@ -0,0 +1,11 @@ +class CreatePuzzles < ActiveRecord::Migration[7.1] + def change + create_table :puzzles do |t| + t.text :data + t.text :solved_data + t.string :category + + t.timestamps + end + end +end diff --git a/db/migrate/20231130173513_create_scores.rb b/db/migrate/20231130173513_create_scores.rb new file mode 100644 index 0000000..953ba8d --- /dev/null +++ b/db/migrate/20231130173513_create_scores.rb @@ -0,0 +1,12 @@ +class CreateScores < ActiveRecord::Migration[7.1] + def change + create_table :scores do |t| + t.references :puzzle, null: false + t.string :name + t.string :ip + t.integer :seconds_taken + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb new file mode 100644 index 0000000..73725c5 --- /dev/null +++ b/db/schema.rb @@ -0,0 +1,32 @@ +# 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[7.1].define(version: 2023_11_30_173513) do + create_table "puzzles", force: :cascade do |t| + t.text "data" + t.text "solved_data" + t.string "category" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "scores", force: :cascade do |t| + t.integer "puzzle_id", null: false + t.string "name" + t.string "ip" + t.integer "seconds_taken" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["puzzle_id"], name: "index_scores_on_puzzle_id" + end + +end diff --git a/db/seeds.rb b/db/seeds.rb new file mode 100644 index 0000000..4fbd6ed --- /dev/null +++ b/db/seeds.rb @@ -0,0 +1,9 @@ +# This file should ensure the existence of records required to run the application in every environment (production, +# development, test). The code here should be idempotent so that it can be executed at any point in every environment. +# The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup). +# +# Example: +# +# ["Action", "Comedy", "Drama", "Horror"].each do |genre_name| +# MovieGenre.find_or_create_by!(name: genre_name) +# end -- cgit 1.4.1