From 7a5b9e0e1b82db289da2dc7b05780e1fe5dab5eb Mon Sep 17 00:00:00 2001 From: Eduardo Martin Rojo Date: Wed, 16 Aug 2023 10:45:41 +0100 Subject: [PATCH] Added schema --- ...dd_index_long_read_qc_results_sample_id.rb | 2 +- db/schema.rb | 33 ++++++++++--------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/db/migrate/20230816092204_add_index_long_read_qc_results_sample_id.rb b/db/migrate/20230816092204_add_index_long_read_qc_results_sample_id.rb index 38e790f4..cb488973 100644 --- a/db/migrate/20230816092204_add_index_long_read_qc_results_sample_id.rb +++ b/db/migrate/20230816092204_add_index_long_read_qc_results_sample_id.rb @@ -3,6 +3,6 @@ # Add index on sample id for long read qc results to be able to join with samples class AddIndexLongReadQcResultsSampleId < ActiveRecord::Migration[7.0] def change - add_index :long_read_qc_results, :sample_id, unique: false + add_index :long_read_qc_result, :sample_id, unique: false end end diff --git a/db/schema.rb b/db/schema.rb index 8eea04a3..be80c5dc 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,8 +10,8 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2023_07_04_101316) do - create_table "bmap_flowcell", primary_key: "id_bmap_flowcell_tmp", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8_unicode_ci", force: :cascade do |t| +ActiveRecord::Schema[7.0].define(version: 2023_08_16_092204) do + create_table "bmap_flowcell", primary_key: "id_bmap_flowcell_tmp", id: :integer, charset: "utf8mb3", collation: "utf8mb3_unicode_ci", force: :cascade do |t| t.datetime "last_updated", precision: nil, null: false, comment: "Timestamp of last update" t.datetime "recorded_at", precision: nil, null: false, comment: "Timestamp of warehouse update" t.integer "id_sample_tmp", null: false, comment: "Sample id, see \"sample.id_sample_tmp\"", unsigned: true @@ -31,7 +31,7 @@ t.index ["id_study_tmp"], name: "fk_bmap_flowcell_to_study" end - create_table "flgen_plate", primary_key: "id_flgen_plate_tmp", id: { type: :integer, unsigned: true }, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "flgen_plate", primary_key: "id_flgen_plate_tmp", id: { type: :integer, unsigned: true }, charset: "utf8mb3", collation: "utf8mb3_unicode_ci", force: :cascade do |t| t.integer "id_sample_tmp", null: false, comment: "Sample id, see \"sample.id_sample_tmp\"", unsigned: true t.integer "id_study_tmp", null: false, comment: "Study id, see \"study.id_study_tmp\"", unsigned: true t.string "cost_code", limit: 20, null: false, comment: "Valid WTSI cost code" @@ -52,7 +52,7 @@ t.index ["id_study_tmp"], name: "flgen_plate_study_fk" end - create_table "iseq_flowcell", primary_key: "id_iseq_flowcell_tmp", id: { type: :integer, unsigned: true }, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "iseq_flowcell", primary_key: "id_iseq_flowcell_tmp", id: { type: :integer, unsigned: true }, charset: "utf8mb3", collation: "utf8mb3_unicode_ci", force: :cascade do |t| t.datetime "last_updated", precision: nil, null: false, comment: "Timestamp of last update" t.datetime "recorded_at", precision: nil, null: false, comment: "Timestamp of warehouse update" t.integer "id_sample_tmp", null: false, comment: "Sample id, see \"sample.id_sample_tmp\"", unsigned: true @@ -107,7 +107,7 @@ t.index ["legacy_library_id"], name: "index_iseq_flowcell_legacy_library_id" end - create_table "labware_location", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "labware_location", id: :integer, charset: "utf8mb3", collation: "utf8mb3_unicode_ci", force: :cascade do |t| t.string "labware_barcode", null: false, comment: "Barcode on the stored labware" t.string "location_barcode", null: false, comment: "Barcode associated with storage location" t.string "full_location_address", null: false, comment: "Fully qualifed address of the nested location" @@ -123,7 +123,7 @@ t.index ["location_barcode"], name: "index_labware_location_on_location_barcode" end - create_table "lighthouse_sample", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "lighthouse_sample", id: :integer, charset: "utf8mb3", collation: "utf8mb3_unicode_ci", force: :cascade do |t| t.string "mongodb_id", comment: "Auto-generated id from MongoDB" t.string "root_sample_id", null: false, comment: "Id for this sample provided by the Lighthouse lab" t.string "cog_uk_id", null: false, comment: "Consortium-wide id, generated by Sanger on import to LIMS" @@ -172,7 +172,7 @@ t.index ["root_sample_id", "rna_id", "result"], name: "index_lighthouse_sample_on_root_sample_id_and_rna_id_and_result", unique: true end - create_table "long_read_qc_result", primary_key: "id_long_read_qc_result_tmp", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3", force: :cascade do |t| + create_table "long_read_qc_result", primary_key: "id_long_read_qc_result_tmp", charset: "utf8mb3", force: :cascade do |t| t.string "labware_barcode", null: false, comment: "Barcode of the labware that was the source for the QC tests." t.string "sample_id", null: false, comment: "External identifier for the sample(s)." t.string "assay_type", null: false, comment: "Type of the QC test." @@ -186,9 +186,10 @@ t.datetime "recorded_at", precision: nil, comment: "Timestamp of the latest warehouse update." t.string "qc_status", comment: "Status of the QC decision eg pass, fail etc" t.string "qc_status_decision_by", comment: "Who made the QC status decision eg ToL, Long Read" + t.index ["sample_id"], name: "index_long_read_qc_result_on_sample_id" end - create_table "oseq_flowcell", primary_key: "id_oseq_flowcell_tmp", id: { type: :integer, unsigned: true }, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "oseq_flowcell", primary_key: "id_oseq_flowcell_tmp", id: { type: :integer, unsigned: true }, charset: "utf8mb3", collation: "utf8mb3_unicode_ci", force: :cascade do |t| t.string "id_flowcell_lims", null: false, comment: "LIMs-specific flowcell id" t.datetime "last_updated", precision: nil, null: false, comment: "Timestamp of last update" t.datetime "recorded_at", precision: nil, null: false, comment: "Timestamp of warehouse update" @@ -218,7 +219,7 @@ t.index ["id_study_tmp"], name: "fk_oseq_flowcell_to_study" end - create_table "pac_bio_run", primary_key: "id_pac_bio_tmp", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "pac_bio_run", primary_key: "id_pac_bio_tmp", id: :integer, charset: "utf8mb3", collation: "utf8mb3_unicode_ci", force: :cascade do |t| t.datetime "last_updated", precision: nil, null: false, comment: "Timestamp of last update" t.datetime "recorded_at", precision: nil, null: false, comment: "Timestamp of warehouse update" t.integer "id_sample_tmp", null: false, comment: "Sample id, see \"sample.id_sample_tmp\"", unsigned: true @@ -255,14 +256,14 @@ t.index ["id_study_tmp"], name: "fk_pac_bio_run_to_study" end - create_table "psd_sample_compounds_components", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3", comment: "A join table owned by PSD to associate compound samples with their component samples.", force: :cascade do |t| + create_table "psd_sample_compounds_components", charset: "utf8mb3", comment: "A join table owned by PSD to associate compound samples with their component samples.", force: :cascade do |t| t.integer "compound_id_sample_tmp", null: false, comment: "The warehouse ID of the compound sample in the association." t.integer "component_id_sample_tmp", null: false, comment: "The warehouse ID of the component sample in the association." t.datetime "last_updated", precision: nil, null: false, comment: "Timestamp of last update." t.datetime "recorded_at", precision: nil, null: false, comment: "Timestamp of warehouse update." end - create_table "qc_result", primary_key: "id_qc_result_tmp", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "qc_result", primary_key: "id_qc_result_tmp", id: :integer, charset: "utf8mb3", collation: "utf8mb3_unicode_ci", force: :cascade do |t| t.integer "id_sample_tmp", null: false, unsigned: true t.string "id_qc_result_lims", limit: 20, null: false, comment: "LIMS-specific qc_result identifier" t.string "id_lims", limit: 10, null: false, comment: "LIMS system identifier (e.g. SEQUENCESCAPE)" @@ -282,7 +283,7 @@ t.index ["id_sample_tmp"], name: "fk_qc_result_to_sample" end - create_table "sample", primary_key: "id_sample_tmp", id: { type: :integer, unsigned: true }, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "sample", primary_key: "id_sample_tmp", id: { type: :integer, unsigned: true }, charset: "utf8mb3", collation: "utf8mb3_unicode_ci", force: :cascade do |t| t.string "id_lims", limit: 10, null: false, comment: "LIM system identifier, e.g. CLARITY-GCLP, SEQSCAPE" t.string "uuid_sample_lims", limit: 36, comment: "LIMS-specific sample uuid" t.string "id_sample_lims", limit: 20, null: false, comment: "LIMS-specific sample identifier" @@ -353,7 +354,7 @@ t.index ["uuid_sample_lims"], name: "sample_uuid_sample_lims_index", unique: true end - create_table "samples_extraction_activity", primary_key: "id_activity_tmp", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "samples_extraction_activity", primary_key: "id_activity_tmp", id: :integer, charset: "utf8mb3", collation: "utf8mb3_unicode_ci", force: :cascade do |t| t.string "id_activity_lims", null: false, comment: "LIMs-specific activity id" t.integer "id_sample_tmp", null: false, comment: "Sample id, see \"sample.id_sample_tmp\"", unsigned: true t.string "activity_type", null: false, comment: "The type of the activity performed" @@ -372,7 +373,7 @@ t.index ["id_sample_tmp"], name: "fk_rails_bbdd0468f0" end - create_table "stock_resource", primary_key: "id_stock_resource_tmp", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "stock_resource", primary_key: "id_stock_resource_tmp", id: :integer, charset: "utf8mb3", collation: "utf8mb3_unicode_ci", force: :cascade do |t| t.datetime "last_updated", precision: nil, null: false, comment: "Timestamp of last update" t.datetime "recorded_at", precision: nil, null: false, comment: "Timestamp of warehouse update" t.datetime "created", precision: nil, null: false, comment: "Timestamp of initial registration of stock in LIMS" @@ -398,7 +399,7 @@ t.index ["id_study_tmp"], name: "fk_stock_resource_to_study" end - create_table "study", primary_key: "id_study_tmp", id: { type: :integer, unsigned: true }, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "study", primary_key: "id_study_tmp", id: { type: :integer, unsigned: true }, charset: "utf8mb3", collation: "utf8mb3_unicode_ci", force: :cascade do |t| t.string "id_lims", limit: 10, null: false, comment: "LIM system identifier, e.g. GCLP-CLARITY, SEQSCAPE" t.string "uuid_study_lims", limit: 36, comment: "LIMS-specific study uuid" t.string "id_study_lims", limit: 20, null: false, comment: "LIMS-specific study identifier" @@ -444,7 +445,7 @@ t.index ["uuid_study_lims"], name: "study_uuid_study_lims_index", unique: true end - create_table "study_users", primary_key: "id_study_users_tmp", id: { type: :integer, unsigned: true }, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "study_users", primary_key: "id_study_users_tmp", id: { type: :integer, unsigned: true }, charset: "utf8mb3", collation: "utf8mb3_unicode_ci", force: :cascade do |t| t.integer "id_study_tmp", null: false, comment: "Study id, see \"study.id_study_tmp\"", unsigned: true t.datetime "last_updated", precision: nil, null: false, comment: "Timestamp of last update" t.string "role"