diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2023-11-30 13:29:08 -0500 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2023-11-30 13:29:08 -0500 |
commit | 0929719a845897cc8567cf972e07a69a71f0fa6f (patch) | |
tree | 2b6f69c1d906abb6e0abf8a0f1d51725bc78087d /db | |
parent | 01c1947537e4e23ded0c16812a7cd9d49ad88356 (diff) | |
download | wittle-0929719a845897cc8567cf972e07a69a71f0fa6f.tar.gz wittle-0929719a845897cc8567cf972e07a69a71f0fa6f.tar.bz2 wittle-0929719a845897cc8567cf972e07a69a71f0fa6f.zip |
Migrate to a full rails app
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20231130173455_create_puzzles.rb (renamed from db/migrate/20231028205751_create_wittle_puzzles.rb) | 4 | ||||
-rw-r--r-- | db/migrate/20231130173513_create_scores.rb (renamed from db/migrate/20231028210722_create_wittle_scores.rb) | 4 | ||||
-rw-r--r-- | db/schema.rb | 32 | ||||
-rw-r--r-- | db/seeds.rb | 9 |
4 files changed, 45 insertions, 4 deletions
diff --git a/db/migrate/20231028205751_create_wittle_puzzles.rb b/db/migrate/20231130173455_create_puzzles.rb index ebe0bf7..548473a 100644 --- a/db/migrate/20231028205751_create_wittle_puzzles.rb +++ b/db/migrate/20231130173455_create_puzzles.rb | |||
@@ -1,6 +1,6 @@ | |||
1 | class CreateWittlePuzzles < ActiveRecord::Migration[7.1] | 1 | class CreatePuzzles < ActiveRecord::Migration[7.1] |
2 | def change | 2 | def change |
3 | create_table :wittle_puzzles do |t| | 3 | create_table :puzzles do |t| |
4 | t.text :data | 4 | t.text :data |
5 | t.text :solved_data | 5 | t.text :solved_data |
6 | t.string :category | 6 | t.string :category |
diff --git a/db/migrate/20231028210722_create_wittle_scores.rb b/db/migrate/20231130173513_create_scores.rb index aa49a13..953ba8d 100644 --- a/db/migrate/20231028210722_create_wittle_scores.rb +++ b/db/migrate/20231130173513_create_scores.rb | |||
@@ -1,6 +1,6 @@ | |||
1 | class CreateWittleScores < ActiveRecord::Migration[7.1] | 1 | class CreateScores < ActiveRecord::Migration[7.1] |
2 | def change | 2 | def change |
3 | create_table :wittle_scores do |t| | 3 | create_table :scores do |t| |
4 | t.references :puzzle, null: false | 4 | t.references :puzzle, null: false |
5 | t.string :name | 5 | t.string :name |
6 | t.string :ip | 6 | t.string :ip |
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 @@ | |||
1 | # This file is auto-generated from the current state of the database. Instead | ||
2 | # of editing this file, please use the migrations feature of Active Record to | ||
3 | # incrementally modify your database, and then regenerate this schema definition. | ||
4 | # | ||
5 | # This file is the source Rails uses to define your schema when running `bin/rails | ||
6 | # db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to | ||
7 | # be faster and is potentially less error prone than running all of your | ||
8 | # migrations from scratch. Old migrations may fail to apply correctly if those | ||
9 | # migrations use external dependencies or application code. | ||
10 | # | ||
11 | # It's strongly recommended that you check this file into your version control system. | ||
12 | |||
13 | ActiveRecord::Schema[7.1].define(version: 2023_11_30_173513) do | ||
14 | create_table "puzzles", force: :cascade do |t| | ||
15 | t.text "data" | ||
16 | t.text "solved_data" | ||
17 | t.string "category" | ||
18 | t.datetime "created_at", null: false | ||
19 | t.datetime "updated_at", null: false | ||
20 | end | ||
21 | |||
22 | create_table "scores", force: :cascade do |t| | ||
23 | t.integer "puzzle_id", null: false | ||
24 | t.string "name" | ||
25 | t.string "ip" | ||
26 | t.integer "seconds_taken" | ||
27 | t.datetime "created_at", null: false | ||
28 | t.datetime "updated_at", null: false | ||
29 | t.index ["puzzle_id"], name: "index_scores_on_puzzle_id" | ||
30 | end | ||
31 | |||
32 | 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 @@ | |||
1 | # This file should ensure the existence of records required to run the application in every environment (production, | ||
2 | # development, test). The code here should be idempotent so that it can be executed at any point in every environment. | ||
3 | # The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup). | ||
4 | # | ||
5 | # Example: | ||
6 | # | ||
7 | # ["Action", "Comedy", "Drama", "Horror"].each do |genre_name| | ||
8 | # MovieGenre.find_or_create_by!(name: genre_name) | ||
9 | # end | ||