Skip to content

Commit

Permalink
add unique indexes to allow for concurrent refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
acoffman committed Jul 25, 2024
1 parent 8509b02 commit 8826ed0
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class AddUniqueIndexToNewViews < ActiveRecord::Migration[7.1]
def change
add_index :user_browse_table_rows, :id, unique: true
add_index :organization_browse_table_rows, :id, unique: true
end
end
30 changes: 26 additions & 4 deletions server/db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@
#
# It's strongly recommended that you check this file into your version control system.


ActiveRecord::Schema[7.1].define(version: 2024_06_28_151626) do

ActiveRecord::Schema[7.1].define(version: 2024_07_25_165912) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"

# Custom types defined in this database.
# Note that some types may not work with other database engines. Be careful if changing database.
create_enum "exon_offset_direction", ["positive", "negative"]
create_enum "fusion_partner_status", ["known", "unknown", "multiple"]

create_table "acmg_codes", id: :serial, force: :cascade do |t|
t.text "code"
t.text "description"
Expand Down Expand Up @@ -499,6 +502,17 @@
t.index ["state"], name: "index_flags_on_state"
end

create_table "fusions", force: :cascade do |t|
t.bigint "five_prime_gene_id"
t.bigint "three_prime_gene_id"
t.enum "five_prime_partner_status", default: "unknown", null: false, enum_type: "fusion_partner_status"
t.enum "three_prime_partner_status", default: "unknown", null: false, enum_type: "fusion_partner_status"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["five_prime_gene_id"], name: "index_fusions_on_five_prime_gene_id"
t.index ["three_prime_gene_id"], name: "index_fusions_on_three_prime_gene_id"
end

create_table "gene_aliases", id: :serial, force: :cascade do |t|
t.string "name"
t.index ["name"], name: "index_gene_aliases_on_name"
Expand Down Expand Up @@ -884,6 +898,7 @@
t.text "coordinate_type", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.enum "exon_offset_direction", enum_type: "exon_offset_direction"
t.index ["chromosome"], name: "index_variant_coordinates_on_chromosome"
t.index ["reference_build"], name: "index_variant_coordinates_on_reference_build"
t.index ["representative_transcript"], name: "index_variant_coordinates_on_representative_transcript"
Expand Down Expand Up @@ -965,6 +980,7 @@
t.bigint "feature_id"
t.string "type", null: false
t.string "ncit_id"
t.string "vicc_compliant_name"
t.index "lower((name)::text) varchar_pattern_ops", name: "idx_case_insensitive_variant_name"
t.index "lower((name)::text)", name: "variant_lower_name_idx"
t.index ["chromosome"], name: "index_variants_on_chromosome"
Expand All @@ -981,6 +997,7 @@
t.index ["stop"], name: "index_variants_on_stop"
t.index ["stop2"], name: "index_variants_on_stop2"
t.index ["variant_bases"], name: "index_variants_on_variant_bases"
t.index ["vicc_compliant_name"], name: "index_variants_on_vicc_compliant_name"
end

create_table "view_last_updated_timestamps", force: :cascade do |t|
Expand Down Expand Up @@ -1032,6 +1049,8 @@
add_foreign_key "feature_aliases_features", "features"
add_foreign_key "features_sources", "features"
add_foreign_key "features_sources", "sources"
add_foreign_key "fusions", "genes", column: "five_prime_gene_id"
add_foreign_key "fusions", "genes", column: "three_prime_gene_id"
add_foreign_key "gene_aliases_genes", "gene_aliases"
add_foreign_key "gene_aliases_genes", "genes"
add_foreign_key "genes_sources", "genes"
Expand Down Expand Up @@ -1401,7 +1420,8 @@
LEFT JOIN organizations child ON ((child.parent_id = organizations.id)))
GROUP BY organizations.id;
SQL

add_index "organization_browse_table_rows", ["id"], name: "index_organization_browse_table_rows_on_id", unique: true

create_view "user_browse_table_rows", materialized: true, sql_definition: <<-SQL
SELECT users.id,
users.email,
Expand Down Expand Up @@ -1432,4 +1452,6 @@
LEFT JOIN events ON ((events.originating_user_id = users.id)))
GROUP BY users.id;
SQL
add_index "user_browse_table_rows", ["id"], name: "index_user_browse_table_rows_on_id", unique: true

end

0 comments on commit 8826ed0

Please sign in to comment.