diff --git a/.database_consistency.todo.yml b/.database_consistency.todo.yml new file mode 100644 index 000000000..1b15fcdd2 --- /dev/null +++ b/.database_consistency.todo.yml @@ -0,0 +1,444 @@ +--- +Annotation: + id: + PrimaryKeyTypeChecker: + enabled: false + message: + LengthConstraintChecker: + enabled: false + score: + MissingIndexChecker: + enabled: true + source: + LengthConstraintChecker: + enabled: false + user: + ColumnPresenceChecker: + enabled: false +Announcement: + announcement_viewed: + MissingIndexChecker: + enabled: true + author: + ColumnPresenceChecker: + enabled: false + ForeignKeyChecker: + enabled: false + live: + MissingUniqueIndexChecker: + enabled: false + ThreeStateBooleanChecker: + enabled: false + text: + ColumnPresenceChecker: + enabled: false +AnnouncementViewed: + announcement: + ColumnPresenceChecker: + enabled: false + ForeignKeyChecker: + enabled: false + user: + ColumnPresenceChecker: + enabled: false + ForeignKeyChecker: + enabled: false +ApiKey: + token_digest: + LengthConstraintChecker: + enabled: false + NullConstraintChecker: + enabled: false + user: + ColumnPresenceChecker: + enabled: false + ForeignKeyChecker: + enabled: false +Book: + cases: + MissingIndexChecker: + enabled: true + export_job: + LengthConstraintChecker: + enabled: false + import_job: + LengthConstraintChecker: + enabled: false + name: + LengthConstraintChecker: + enabled: false + owner: + ForeignKeyChecker: + enabled: false + populate_job: + LengthConstraintChecker: + enabled: false + scorer: + ColumnPresenceChecker: + enabled: false + ForeignKeyChecker: + enabled: false + show_rank: + ThreeStateBooleanChecker: + enabled: false + support_implicit_judgements: + ThreeStateBooleanChecker: + enabled: false +BookMetadatum: + user: + ColumnPresenceChecker: + enabled: false + ForeignKeyChecker: + enabled: false +Case: + archived: + ThreeStateBooleanChecker: + enabled: false + book: + ForeignKeyChecker: + enabled: false + case_name: + ColumnPresenceChecker: + enabled: false + LengthConstraintChecker: + enabled: false + id: + PrimaryKeyTypeChecker: + enabled: false + nightly: + ThreeStateBooleanChecker: + enabled: false + public: + ThreeStateBooleanChecker: + enabled: false + scorer: + ForeignKeyChecker: + enabled: false +CaseMetadatum: + id: + PrimaryKeyTypeChecker: + enabled: false +CuratorVariable: + id: + PrimaryKeyTypeChecker: + enabled: false + name: + ColumnPresenceChecker: + enabled: false + LengthConstraintChecker: + enabled: false + try: + ColumnPresenceChecker: + enabled: false + ForeignKeyChecker: + enabled: false + value: + ColumnPresenceChecker: + enabled: false +Judgement: + explanation: + LengthConstraintChecker: + enabled: false + judge_later: + ThreeStateBooleanChecker: + enabled: false + unrateable: + ThreeStateBooleanChecker: + enabled: false + user: + ForeignKeyChecker: + enabled: false +Permission: + action: + LengthConstraintChecker: + enabled: false + id: + PrimaryKeyTypeChecker: + enabled: false + model_type: + LengthConstraintChecker: + enabled: false + 'on': + ThreeStateBooleanChecker: + enabled: false + user: + ColumnPresenceChecker: + enabled: false + ForeignKeyChecker: + enabled: false +Query: + case: + ColumnPresenceChecker: + enabled: false + id: + PrimaryKeyTypeChecker: + enabled: false + information_need: + LengthConstraintChecker: + enabled: false + notes: + LengthConstraintChecker: + enabled: false + options: + LengthConstraintChecker: + enabled: false + query_text: + ColumnPresenceChecker: + enabled: false +QueryDocPair: + doc_id: + ColumnPresenceChecker: + enabled: false + LengthConstraintChecker: + enabled: false + document_fields: + LengthConstraintChecker: + enabled: false + information_need: + LengthConstraintChecker: + enabled: false + notes: + LengthConstraintChecker: + enabled: false + options: + LengthConstraintChecker: + enabled: false + query_text: + ColumnPresenceChecker: + enabled: false +Rating: + doc_id: + LengthConstraintChecker: + enabled: false + id: + PrimaryKeyTypeChecker: + enabled: false + query: + ColumnPresenceChecker: + enabled: false + user: + ForeignKeyChecker: + enabled: false +Score: + all_rated: + ThreeStateBooleanChecker: + enabled: false + case: + ColumnPresenceChecker: + enabled: false + id: + PrimaryKeyTypeChecker: + enabled: false + try: + ColumnPresenceChecker: + enabled: false + ForeignKeyChecker: + enabled: false + user: + ColumnPresenceChecker: + enabled: false +Scorer: + code: + LengthConstraintChecker: + enabled: false + communal: + ThreeStateBooleanChecker: + enabled: false + id: + PrimaryKeyTypeChecker: + enabled: false + name: + LengthConstraintChecker: + enabled: false + owner: + ForeignKeyChecker: + enabled: false + scale: + LengthConstraintChecker: + enabled: false + scale_with_labels: + LengthConstraintChecker: + enabled: false + show_scale_labels: + ThreeStateBooleanChecker: + enabled: false +SearchEndpoint: + api_method: + LengthConstraintChecker: + enabled: false + archived: + ThreeStateBooleanChecker: + enabled: false + basic_auth_credential: + LengthConstraintChecker: + enabled: false + custom_headers: + LengthConstraintChecker: + enabled: false + endpoint_url: + LengthConstraintChecker: + enabled: false + mapper_code: + LengthConstraintChecker: + enabled: false + name: + LengthConstraintChecker: + enabled: false + owner: + ForeignKeyChecker: + enabled: false + proxy_requests: + ThreeStateBooleanChecker: + enabled: false + search_engine: + LengthConstraintChecker: + enabled: false +SelectionStrategy: + description: + LengthConstraintChecker: + enabled: false + name: + LengthConstraintChecker: + enabled: false +Snapshot: + id: + PrimaryKeyTypeChecker: + enabled: false + name: + ColumnPresenceChecker: + enabled: false + LengthConstraintChecker: + enabled: false + scorer: + ForeignKeyChecker: + enabled: false + try: + ForeignKeyChecker: + enabled: false +SnapshotDoc: + doc_id: + LengthConstraintChecker: + enabled: false + explain: + LengthConstraintChecker: + enabled: false + fields: + LengthConstraintChecker: + enabled: false + id: + PrimaryKeyTypeChecker: + enabled: false + rated_only: + ThreeStateBooleanChecker: + enabled: false +SnapshotQuery: + all_rated: + ThreeStateBooleanChecker: + enabled: false + id: + PrimaryKeyTypeChecker: + enabled: false + snapshot_docs: + ForeignKeyCascadeChecker: + enabled: false +Team: + id: + PrimaryKeyTypeChecker: + enabled: false + name: + ColumnPresenceChecker: + enabled: false + LengthConstraintChecker: + enabled: false + MissingUniqueIndexChecker: + enabled: false +Try: + ancestry: + LengthConstraintChecker: + enabled: false + escape_query: + ThreeStateBooleanChecker: + enabled: false + field_spec: + LengthConstraintChecker: + enabled: false + id: + PrimaryKeyTypeChecker: + enabled: false + name: + LengthConstraintChecker: + enabled: false + query_params: + LengthConstraintChecker: + enabled: false + search_endpoint: + ForeignKeyChecker: + enabled: false +User: + administrator: + ThreeStateBooleanChecker: + enabled: false + agreed: + ThreeStateBooleanChecker: + enabled: false + announcements: + MissingIndexChecker: + enabled: true + api_keys: + MissingIndexChecker: + enabled: true + books: + MissingIndexChecker: + enabled: true + cases: + ForeignKeyCascadeChecker: + enabled: false + company: + LengthConstraintChecker: + enabled: false + email: + ColumnPresenceChecker: + enabled: false + LengthConstraintChecker: + enabled: false + id: + PrimaryKeyTypeChecker: + enabled: false + index_users_on_invitation_token: + UniqueIndexChecker: + enabled: false + index_users_on_reset_password_token: + UniqueIndexChecker: + enabled: false + invitation_token: + LengthConstraintChecker: + enabled: false + invited_by: + ForeignKeyChecker: + enabled: false + locked: + ThreeStateBooleanChecker: + enabled: false + name: + LengthConstraintChecker: + enabled: false + owned_scorers: + MissingIndexChecker: + enabled: true + password: + ColumnPresenceChecker: + enabled: false + LengthConstraintChecker: + enabled: false + permissions: + MissingIndexChecker: + enabled: true + profile_pic: + LengthConstraintChecker: + enabled: false + reset_password_token: + LengthConstraintChecker: + enabled: false + stored_raw_invitation_token: + LengthConstraintChecker: + enabled: false diff --git a/.database_consistency.yml b/.database_consistency.yml new file mode 100644 index 000000000..a61683c89 --- /dev/null +++ b/.database_consistency.yml @@ -0,0 +1,13 @@ +# Ignore false positive from Rails' ActionText and ActiveStorage +ActionText::RichText: + enabled: false +ActiveStorage::Attachment: + enabled: false +ActiveStorage::Blob: + enabled: false +ActiveStorage::VariantRecord: + enabled: false +Ahoy::Event: + enabled: false +Ahoy::Visit: + enabled: false diff --git a/Gemfile b/Gemfile index fb8fde5ab..c65d25871 100644 --- a/Gemfile +++ b/Gemfile @@ -71,8 +71,7 @@ group :development do # Add speed badges [https://github.com/MiniProfiler/rack-mini-profiler] # gem 'rack-mini-profiler' - # # Highlight the fine-grained location where an error occurred [https://github.com/ruby/error_highlight] - + gem 'database_consistency', '~> 2.0', require: false gem 'debugbar' gem 'derailed_benchmarks' gem 'letter_opener' diff --git a/Gemfile.lock b/Gemfile.lock index 486519337..76d755a19 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -151,6 +151,8 @@ GEM csv (3.3.2) d3-rails (3.5.17) railties (>= 3.1) + database_consistency (2.0.3) + activerecord (>= 3.2) date (3.4.1) debug (1.10.0) irb (~> 1.10) @@ -563,6 +565,7 @@ DEPENDENCIES capybara colorize d3-rails (~> 3.5.5) + database_consistency (~> 2.0) debug debugbar derailed_benchmarks diff --git a/app/models/announcement.rb b/app/models/announcement.rb index a96654864..95ce46748 100644 --- a/app/models/announcement.rb +++ b/app/models/announcement.rb @@ -11,6 +11,10 @@ # updated_at :datetime not null # author_id :integer # +# Indexes +# +# index_announcements_author_id (author_id) +# class Announcement < ApplicationRecord belongs_to :author, class_name: 'User' has_many :announcement_viewed, dependent: :destroy diff --git a/app/models/announcement_viewed.rb b/app/models/announcement_viewed.rb index c87e25c8c..55ca5a0f1 100644 --- a/app/models/announcement_viewed.rb +++ b/app/models/announcement_viewed.rb @@ -10,6 +10,10 @@ # announcement_id :integer # user_id :integer # +# Indexes +# +# index_announcement_viewed_announcement_id (announcement_id) +# class AnnouncementViewed < ApplicationRecord self.table_name = 'announcement_viewed' belongs_to :user diff --git a/app/models/api_key.rb b/app/models/api_key.rb index 496e34235..bba02045a 100644 --- a/app/models/api_key.rb +++ b/app/models/api_key.rb @@ -13,6 +13,7 @@ # Indexes # # index_api_keys_on_token_digest (token_digest) +# index_api_keys_user_id (user_id) # class ApiKey < ApplicationRecord HMAC_SECRET_KEY = Rails.application.secret_key_base diff --git a/app/models/book.rb b/app/models/book.rb index a53beaa6d..07a478671 100644 --- a/app/models/book.rb +++ b/app/models/book.rb @@ -20,6 +20,7 @@ # Indexes # # index_books_on_selection_strategy_id (selection_strategy_id) +# index_books_owner_id (owner_id) # # Foreign Keys # diff --git a/app/models/case.rb b/app/models/case.rb index be05d0686..3d5dec43a 100644 --- a/app/models/case.rb +++ b/app/models/case.rb @@ -21,7 +21,8 @@ # # Indexes # -# user_id (owner_id) +# index_cases_book_id (book_id) +# user_id (owner_id) # # Foreign Keys # diff --git a/app/models/permission.rb b/app/models/permission.rb index 11053ed54..2195cd55d 100644 --- a/app/models/permission.rb +++ b/app/models/permission.rb @@ -12,6 +12,10 @@ # updated_at :datetime not null # user_id :integer # +# Indexes +# +# index_permissions_user_id (user_id) +# class Permission < ApplicationRecord # Associations diff --git a/app/models/score.rb b/app/models/score.rb index f7e84e171..298ed52b1 100644 --- a/app/models/score.rb +++ b/app/models/score.rb @@ -17,10 +17,10 @@ # # Indexes # -# case_id (case_id) -# index_case_scores_on_annotation_id (annotation_id) -# support_last_score (updated_at,created_at,id) -# user_id (user_id) +# case_id (case_id) +# index_case_scores_annotation_id (annotation_id) UNIQUE +# support_last_score (updated_at,created_at,id) +# user_id (user_id) # # Foreign Keys # diff --git a/app/models/scorer.rb b/app/models/scorer.rb index e166b3b1b..69e31bd78 100644 --- a/app/models/scorer.rb +++ b/app/models/scorer.rb @@ -15,6 +15,10 @@ # updated_at :datetime not null # owner_id :integer # +# Indexes +# +# index_scorers_owner_id (owner_id) +# require 'scale_serializer' diff --git a/db/migrate/20250110133600_add_announcements_author_id_index.rb b/db/migrate/20250110133600_add_announcements_author_id_index.rb new file mode 100644 index 000000000..d548ef793 --- /dev/null +++ b/db/migrate/20250110133600_add_announcements_author_id_index.rb @@ -0,0 +1,5 @@ +class AddAnnouncementsAuthorIdIndex < ActiveRecord::Migration[8.0] + def change + add_index :announcements, :author_id, name: :index_announcements_author_id + end +end diff --git a/db/migrate/20250110133916_add_api_keys_user_id_index.rb b/db/migrate/20250110133916_add_api_keys_user_id_index.rb new file mode 100644 index 000000000..42e7ea579 --- /dev/null +++ b/db/migrate/20250110133916_add_api_keys_user_id_index.rb @@ -0,0 +1,5 @@ +class AddApiKeysUserIdIndex < ActiveRecord::Migration[8.0] + def change + add_index :api_keys, :user_id, name: :index_api_keys_user_id + end +end diff --git a/db/migrate/20250110133917_add_books_owner_id_index.rb b/db/migrate/20250110133917_add_books_owner_id_index.rb new file mode 100644 index 000000000..ab63e7d9d --- /dev/null +++ b/db/migrate/20250110133917_add_books_owner_id_index.rb @@ -0,0 +1,5 @@ +class AddBooksOwnerIdIndex < ActiveRecord::Migration[8.0] + def change + add_index :books, :owner_id, name: :index_books_owner_id + end +end diff --git a/db/migrate/20250110133953_add_cases_book_id_index.rb b/db/migrate/20250110133953_add_cases_book_id_index.rb new file mode 100644 index 000000000..6345c4512 --- /dev/null +++ b/db/migrate/20250110133953_add_cases_book_id_index.rb @@ -0,0 +1,5 @@ +class AddCasesBookIdIndex < ActiveRecord::Migration[8.0] + def change + add_index :cases, :book_id, name: :index_cases_book_id + end +end diff --git a/db/migrate/20250110133954_add_announcement_viewed_announcement_id_index.rb b/db/migrate/20250110133954_add_announcement_viewed_announcement_id_index.rb new file mode 100644 index 000000000..1ea57cc27 --- /dev/null +++ b/db/migrate/20250110133954_add_announcement_viewed_announcement_id_index.rb @@ -0,0 +1,5 @@ +class AddAnnouncementViewedAnnouncementIdIndex < ActiveRecord::Migration[8.0] + def change + add_index :announcement_viewed, :announcement_id, name: :index_announcement_viewed_announcement_id + end +end diff --git a/db/migrate/20250110133955_add_scorers_owner_id_index.rb b/db/migrate/20250110133955_add_scorers_owner_id_index.rb new file mode 100644 index 000000000..49fe150fe --- /dev/null +++ b/db/migrate/20250110133955_add_scorers_owner_id_index.rb @@ -0,0 +1,5 @@ +class AddScorersOwnerIdIndex < ActiveRecord::Migration[8.0] + def change + add_index :scorers, :owner_id, name: :index_scorers_owner_id + end +end diff --git a/db/migrate/20250110133956_add_permissions_user_id_index.rb b/db/migrate/20250110133956_add_permissions_user_id_index.rb new file mode 100644 index 000000000..8a5d09c8b --- /dev/null +++ b/db/migrate/20250110133956_add_permissions_user_id_index.rb @@ -0,0 +1,5 @@ +class AddPermissionsUserIdIndex < ActiveRecord::Migration[8.0] + def change + add_index :permissions, :user_id, name: :index_permissions_user_id + end +end diff --git a/db/migrate/20250110143216_add_case_scores_annotation_id_index.rb b/db/migrate/20250110143216_add_case_scores_annotation_id_index.rb new file mode 100644 index 000000000..5a5fc44b5 --- /dev/null +++ b/db/migrate/20250110143216_add_case_scores_annotation_id_index.rb @@ -0,0 +1,5 @@ +class AddCaseScoresAnnotationIdIndex < ActiveRecord::Migration[8.0] + def change + add_index :case_scores, :annotation_id, name: :index_case_scores_annotation_id, unique: true + end +end diff --git a/db/migrate/20250110161959_remove_index_case_scores_on_annotation_id_index.rb b/db/migrate/20250110161959_remove_index_case_scores_on_annotation_id_index.rb new file mode 100644 index 000000000..751c7a622 --- /dev/null +++ b/db/migrate/20250110161959_remove_index_case_scores_on_annotation_id_index.rb @@ -0,0 +1,5 @@ +class RemoveIndexCaseScoresOnAnnotationIdIndex < ActiveRecord::Migration[8.0] + def change + remove_index 'case_scores', name: 'index_case_scores_on_annotation_id' + end +end diff --git a/db/schema.rb b/db/schema.rb index 878471aa8..6d1ac2fb7 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[8.0].define(version: 2025_01_08_171851) do +ActiveRecord::Schema[8.0].define(version: 2025_01_10_161959) do create_table "active_storage_attachments", charset: "utf8mb4", collation: "utf8mb4_bin", force: :cascade do |t| t.string "name", null: false t.string "record_type", null: false @@ -102,6 +102,7 @@ t.integer "user_id" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.index ["announcement_id"], name: "index_announcement_viewed_announcement_id" end create_table "announcements", charset: "utf8mb4", collation: "utf8mb4_bin", force: :cascade do |t| @@ -110,6 +111,7 @@ t.datetime "created_at", null: false t.datetime "updated_at", null: false t.boolean "live", default: false + t.index ["author_id"], name: "index_announcements_author_id" end create_table "api_keys", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| @@ -118,6 +120,7 @@ t.datetime "created_at", null: false t.datetime "updated_at", null: false t.index ["token_digest"], name: "index_api_keys_on_token_digest" + t.index ["user_id"], name: "index_api_keys_user_id" end create_table "blazer_audits", charset: "utf8mb4", collation: "utf8mb4_bin", force: :cascade do |t| @@ -196,6 +199,7 @@ t.string "export_job" t.string "import_job" t.string "populate_job" + t.index ["owner_id"], name: "index_books_owner_id" t.index ["selection_strategy_id"], name: "index_books_on_selection_strategy_id" end @@ -217,7 +221,7 @@ t.binary "queries", size: :medium t.integer "annotation_id" t.datetime "updated_at", precision: nil - t.index ["annotation_id"], name: "index_case_scores_on_annotation_id" + t.index ["annotation_id"], name: "index_case_scores_annotation_id", unique: true t.index ["case_id"], name: "case_id" t.index ["updated_at", "created_at", "id"], name: "support_last_score" t.index ["user_id"], name: "user_id" @@ -235,6 +239,7 @@ t.boolean "public" t.json "options" t.boolean "nightly" + t.index ["book_id"], name: "index_cases_book_id" t.index ["owner_id"], name: "user_id" end @@ -267,6 +272,7 @@ t.boolean "on", default: false t.datetime "created_at", precision: nil, null: false t.datetime "updated_at", precision: nil, null: false + t.index ["user_id"], name: "index_permissions_user_id" end create_table "queries", id: :integer, charset: "utf8mb3", force: :cascade do |t| @@ -317,6 +323,7 @@ t.datetime "created_at", precision: nil, null: false t.datetime "updated_at", precision: nil, null: false t.boolean "communal", default: false + t.index ["owner_id"], name: "index_scorers_owner_id" end create_table "search_endpoints", charset: "utf8mb3", force: :cascade do |t| diff --git a/test/fixtures/announcements.yml b/test/fixtures/announcements.yml index b4cdf82fe..7a5b8fc38 100644 --- a/test/fixtures/announcements.yml +++ b/test/fixtures/announcements.yml @@ -9,6 +9,10 @@ # updated_at :datetime not null # author_id :integer # +# Indexes +# +# index_announcements_author_id (author_id) +# live_announcement: text: We have a new Scorer! 🥳 diff --git a/test/fixtures/books.yml b/test/fixtures/books.yml index 426f33fb1..64edba1df 100644 --- a/test/fixtures/books.yml +++ b/test/fixtures/books.yml @@ -18,6 +18,7 @@ # Indexes # # index_books_on_selection_strategy_id (selection_strategy_id) +# index_books_owner_id (owner_id) # # Foreign Keys # diff --git a/test/fixtures/cases.yml b/test/fixtures/cases.yml index 7c5087fb9..a250b5101 100644 --- a/test/fixtures/cases.yml +++ b/test/fixtures/cases.yml @@ -17,7 +17,8 @@ # # Indexes # -# user_id (owner_id) +# index_cases_book_id (book_id) +# user_id (owner_id) # # Foreign Keys # diff --git a/test/fixtures/scorers.yml b/test/fixtures/scorers.yml index 13577f6e3..0f6a84dda 100644 --- a/test/fixtures/scorers.yml +++ b/test/fixtures/scorers.yml @@ -20,6 +20,10 @@ # updated_at :datetime not null # owner_id :integer # +# Indexes +# +# index_scorers_owner_id (owner_id) +# quepid_default_scorer: code: pass(); diff --git a/test/fixtures/scores.yml b/test/fixtures/scores.yml index 847fb2573..fce1b617f 100644 --- a/test/fixtures/scores.yml +++ b/test/fixtures/scores.yml @@ -15,10 +15,10 @@ # # Indexes # -# case_id (case_id) -# index_case_scores_on_annotation_id (annotation_id) -# support_last_score (updated_at,created_at,id) -# user_id (user_id) +# case_id (case_id) +# index_case_scores_annotation_id (annotation_id) UNIQUE +# support_last_score (updated_at,created_at,id) +# user_id (user_id) # # Foreign Keys # diff --git a/test/models/announcement_test.rb b/test/models/announcement_test.rb index b37613352..7cf997ed8 100644 --- a/test/models/announcement_test.rb +++ b/test/models/announcement_test.rb @@ -11,6 +11,10 @@ # updated_at :datetime not null # author_id :integer # +# Indexes +# +# index_announcements_author_id (author_id) +# require 'test_helper' class AnnouncementTest < ActiveSupport::TestCase diff --git a/test/models/book_test.rb b/test/models/book_test.rb index 6334f13e6..a405ccca6 100644 --- a/test/models/book_test.rb +++ b/test/models/book_test.rb @@ -20,6 +20,7 @@ # Indexes # # index_books_on_selection_strategy_id (selection_strategy_id) +# index_books_owner_id (owner_id) # # Foreign Keys # diff --git a/test/models/case_test.rb b/test/models/case_test.rb index c63158bef..6f7cff575 100644 --- a/test/models/case_test.rb +++ b/test/models/case_test.rb @@ -19,7 +19,8 @@ # # Indexes # -# user_id (owner_id) +# index_cases_book_id (book_id) +# user_id (owner_id) # # Foreign Keys # diff --git a/test/models/permission_test.rb b/test/models/permission_test.rb index f58e12c38..b84be82fe 100644 --- a/test/models/permission_test.rb +++ b/test/models/permission_test.rb @@ -12,6 +12,10 @@ # updated_at :datetime not null # user_id :integer # +# Indexes +# +# index_permissions_user_id (user_id) +# require 'test_helper' diff --git a/test/models/score_test.rb b/test/models/score_test.rb index 7f1ea2b8d..54f603a9e 100644 --- a/test/models/score_test.rb +++ b/test/models/score_test.rb @@ -17,10 +17,10 @@ # # Indexes # -# case_id (case_id) -# index_case_scores_on_annotation_id (annotation_id) -# support_last_score (updated_at,created_at,id) -# user_id (user_id) +# case_id (case_id) +# index_case_scores_annotation_id (annotation_id) UNIQUE +# support_last_score (updated_at,created_at,id) +# user_id (user_id) # # Foreign Keys # diff --git a/test/models/scorer_test.rb b/test/models/scorer_test.rb index ff61bbbc2..3216c3a6c 100644 --- a/test/models/scorer_test.rb +++ b/test/models/scorer_test.rb @@ -15,6 +15,10 @@ # updated_at :datetime not null # owner_id :integer # +# Indexes +# +# index_scorers_owner_id (owner_id) +# require 'test_helper'