Permalink
Browse files

db optimizations

  • Loading branch information...
ruebot committed Nov 10, 2018
1 parent e3808ce commit 5aa1e76cbb0b6a432b7f8bca8324735fc41b8d07
Showing with 7 additions and 6 deletions.
  1. +1 −1 app/models/collection.rb
  2. +2 −2 app/models/user.rb
  3. +2 −2 app/models/wasapi_file.rb
  4. +2 −1 db/schema.rb
@@ -3,5 +3,5 @@
# Methods for Collections
class Collection < ApplicationRecord
self.primary_key = 'collection_id'
has_many :wasapi_files
has_many :wasapi_files, counter_cache: true
end
@@ -3,8 +3,8 @@
# User model methods.
class User < ApplicationRecord
require 'uri'
has_many :wasapi_files
has_many :collections
has_many :wasapi_files, counter_cache: true
has_many :collections, counter_cache: true
def self.find_or_create_from_auth_hash(auth_hash)
# OmniAuth.
user = where(
@@ -2,6 +2,6 @@
# WASAPI File methods.
class WasapiFile < ApplicationRecord
belongs_to :users, optional: true
belongs_to :collections, optional: true
belongs_to :users, optional: true, counter_cache: true
belongs_to :collections, optional: true, counter_cache: true
end
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20180801124801) do
ActiveRecord::Schema.define(version: 20181110005530) do
create_table "collections", id: false, force: :cascade do |t|
t.integer "collection_id", null: false
@@ -32,6 +32,7 @@
t.datetime "end_time"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["job_id", "user_id", "collection_id", "queue", "start_time", "end_time"], name: "dashboard_index"
end
create_table "delayed_jobs", force: :cascade do |t|

0 comments on commit 5aa1e76

Please sign in to comment.