From 7789e2138fc0479846c20bc68d68973636a4a760 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Tue, 12 Mar 2019 21:50:00 -0400 Subject: Started game tracker --- db/migrate/20190312193025_install_audited.rb | 30 ++++++++++++++++++++++++ db/migrate/20190312193154_create_games.rb | 13 +++++++++++ db/schema.rb | 34 +++++++++++++++++++++++++++- 3 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20190312193025_install_audited.rb create mode 100644 db/migrate/20190312193154_create_games.rb (limited to 'db') diff --git a/db/migrate/20190312193025_install_audited.rb b/db/migrate/20190312193025_install_audited.rb new file mode 100644 index 0000000..ef5487e --- /dev/null +++ b/db/migrate/20190312193025_install_audited.rb @@ -0,0 +1,30 @@ +class InstallAudited < ActiveRecord::Migration[5.2] + def self.up + create_table :audits, :force => true do |t| + t.column :auditable_id, :integer + t.column :auditable_type, :string + t.column :associated_id, :integer + t.column :associated_type, :string + t.column :user_id, :integer + t.column :user_type, :string + t.column :username, :string + t.column :action, :string + t.column :audited_changes, :text + t.column :version, :integer, :default => 0 + t.column :comment, :string + t.column :remote_address, :string + t.column :request_uuid, :string + t.column :created_at, :datetime + end + + add_index :audits, [:auditable_type, :auditable_id, :version], :name => 'auditable_index' + add_index :audits, [:associated_type, :associated_id], :name => 'associated_index' + add_index :audits, [:user_id, :user_type], :name => 'user_index' + add_index :audits, :request_uuid + add_index :audits, :created_at + end + + def self.down + drop_table :audits + end +end diff --git a/db/migrate/20190312193154_create_games.rb b/db/migrate/20190312193154_create_games.rb new file mode 100644 index 0000000..de30492 --- /dev/null +++ b/db/migrate/20190312193154_create_games.rb @@ -0,0 +1,13 @@ +class CreateGames < ActiveRecord::Migration[5.2] + def change + create_table :games do |t| + t.string :title + t.string :status + t.text :progress + t.text :description + t.integer :score + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 93085f3..c5c794f 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,29 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2018_08_11_215146) do +ActiveRecord::Schema.define(version: 2019_03_12_193154) do + + create_table "audits", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci", force: :cascade do |t| + t.integer "auditable_id" + t.string "auditable_type" + t.integer "associated_id" + t.string "associated_type" + t.integer "user_id" + t.string "user_type" + t.string "username" + t.string "action" + t.text "audited_changes" + t.integer "version", default: 0 + t.string "comment" + t.string "remote_address" + t.string "request_uuid" + t.datetime "created_at" + t.index ["associated_type", "associated_id"], name: "associated_index" + t.index ["auditable_type", "auditable_id", "version"], name: "auditable_index" + t.index ["created_at"], name: "index_audits_on_created_at" + t.index ["request_uuid"], name: "index_audits_on_request_uuid" + t.index ["user_id", "user_type"], name: "user_index" + end create_table "blogs", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin", force: :cascade do |t| t.string "title" @@ -35,6 +57,16 @@ ActiveRecord::Schema.define(version: 2018_08_11_215146) do t.index ["type"], name: "index_ckeditor_assets_on_type" end + create_table "games", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci", force: :cascade do |t| + t.string "title" + t.string "status" + t.text "progress" + t.text "description" + t.integer "score" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + create_table "links", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci", force: :cascade do |t| t.string "title", null: false t.string "url", null: false -- cgit 1.4.1