From aa9ca022bf7e59b089e450ff20f671fb43f9a7bd Mon Sep 17 00:00:00 2001 From: Ramiro Rodriguez Date: Wed, 12 Jun 2024 08:15:23 -0700 Subject: [PATCH] added fixes for worker and added more rake tasks --- app/models/study.rb | 150 - app/models/study_downloader.rb | 14 + app/models/study_json_record/worker.rb | 5 + app/models/study_relationship.rb | 12 + db/admin_structure.sql | 6394 +++++++++++++++++++++--- db/public_structure.sql | 5159 ++++++++++++++++--- db/staging_structure.sql | 28 +- db/structure.sql | 5151 ++++++++++++++++--- lib/tasks/import.rake | 81 + lib/tasks/load.rake | 22 + lib/tasks/stats.rake | 137 + 11 files changed, 14778 insertions(+), 2375 deletions(-) create mode 100644 lib/tasks/import.rake create mode 100644 lib/tasks/stats.rake diff --git a/app/models/study.rb b/app/models/study.rb index 448efb1c..4961fff4 100644 --- a/app/models/study.rb +++ b/app/models/study.rb @@ -112,50 +112,6 @@ def self.all_nctids all.collect{|s|s.nct_id} end - def create - ActiveRecord::Base.logger=nil - s=Study.where('nct_id=?',nct_id).first - s.try(:destroy) - update(attribs) - groups=DesignGroup.create_all_from(opts) - Intervention.create_all_from(opts.merge(:design_groups=>groups)) - DetailedDescription.new.create_from(opts).try(:save) - Design.new.create_from(opts).try(:save) - BriefSummary.new.create_from(opts).try(:save) - Eligibility.new.create_from(opts).save - ParticipantFlow.new.create_from(opts).try(:save) - - BaselineMeasurement.create_all_from(opts) - BrowseCondition.create_all_from(opts) - BrowseIntervention.create_all_from(opts) - CentralContact.create_all_from(opts) - Condition.create_all_from(opts) - Country.create_all_from(opts) - Document.create_all_from(opts) - Facility.create_all_from(opts) - IdInformation.create_all_from(opts) - IpdInformationType.create_all_from(opts) - Keyword.create_all_from(opts) - Link.create_all_from(opts) - Milestone.create_all_from(opts) - Outcome.create_all_from(opts) - OverallOfficial.create_all_from(opts) - DesignOutcome.create_all_from(opts) - PendingResult.create_all_from(opts) - ProvidedDocument.create_all_from(opts) - ReportedEvent.create_all_from(opts) - ResponsibleParty.create_all_from(opts) - ResultAgreement.create_all_from(opts) - ResultContact.create_all_from(opts) - Reference.create_all_from(opts) - Sponsor.create_all_from(opts) - # During full load, indexes are dropped. Populating CalculatedValues requires several db queries - so they're scanned and very slow. - # Populate the CalculatedValues after the indexes have been recreated after the full load completes. - CalculatedValue.new.create_from(self).save if ENV['load_type'] == 'incremental' - self.set_downcase if ENV['load_type'] == 'incremental' - self - end - def set_downcase con=ActiveRecord::Base.connection con.execute("UPDATE browse_conditions SET downcase_mesh_term=lower(mesh_term) where nct_id = '#{nct_id}';") @@ -230,112 +186,6 @@ def name brief_title end - def self.mapper(json) - return unless json.protocol_section - - ident = json.protocol_section['identificationModule'] - nct_id = ident['nctId'] - status = json.protocol_section['statusModule'] - design = key_check(json.protocol_section['designModule']) - oversight = key_check(json.protocol_section['oversightModule']) - ipd_sharing = key_check(json.protocol_section['ipdSharingStatementModule']) - study_posted = status['studyFirstPostDateStruct'] - results_posted = key_check(status['resultsFirstPostDateStruct']) - disp_posted = key_check(status['dispFirstPostDateStruct']) - last_posted = status['lastUpdatePostDateStruct'] - start_date = key_check(status['startDateStruct']) - completion_date = key_check(status['completionDateStruct']) - primary_completion_date = key_check(status['primaryCompletionDateStruct']) - results = json.results_section || {} - more_info = results['moreInfoModule'] - baseline = key_check(results['baselineCharacteristicsModule']) - enrollment = key_check(design['enrollmentInfo']) - expanded_access = status.dig('expandedAccessInfo', 'hasExpandedAccess') - expanded = key_check(design['expandedAccessTypes']) - biospec = key_check(design['bioSpec']) - arms_intervention = key_check(json.protocol_section['armsInterventionsModule']) - study_type = design['studyType'] - patient_registry = design['patientRegistry'] || '' - study_type = "#{study_type} [Patient Registry]" if patient_registry =~ /Yes/i - groups = key_check(arms_intervention['armGroups']) - num_of_groups = groups.count == 0 ? nil : groups.count - arms_count = study_type =~ /Interventional/i ? num_of_groups : nil - groups_count = arms_count ? nil : num_of_groups - phase_list = design['phases'] - phase_list = phase_list.join('/') if phase_list - - { - nct_id: nct_id, - nlm_download_date_description: nil, - study_first_submitted_date: convert_to_date(status['studyFirstSubmitDate']), - study_first_submitted_qc_date: convert_to_date(status['studyFirstSubmitQcDate']), - study_first_posted_date: convert_to_date(study_posted['date']), - study_first_posted_date_type: study_posted['type'], - results_first_submitted_date: convert_to_date(status['resultsFirstSubmitDate']), - results_first_submitted_qc_date: status['resultsFirstSubmitQcDate'], - results_first_posted_date: results_posted['date'], - results_first_posted_date_type: results_posted['type'], - disposition_first_submitted_date: convert_to_date(status['dispFirstSubmitDate']), - disposition_first_submitted_qc_date: status['dispFirstSubmitQcDate'], - disposition_first_posted_date: disp_posted['date'], - disposition_first_posted_date_type: disp_posted['type'], - last_update_submitted_date: convert_to_date(status['lastUpdateSubmitDate']), - last_update_submitted_qc_date: convert_to_date(status['lastUpdateSubmitDate']), # this should not go here (Ramiro comment) - last_update_posted_date: convert_to_date(last_posted['date']), - last_update_posted_date_type: last_posted['type'], - start_month_year: start_date['date'], - start_date_type: start_date['type'], - start_date: convert_to_date(start_date['date']), - verification_month_year: status['statusVerifiedDate'], - verification_date: convert_to_date(status['statusVerifiedDate']), - completion_month_year: completion_date['date'], - completion_date_type: completion_date['type'], - completion_date: convert_to_date(completion_date['date']), - primary_completion_month_year: primary_completion_date['date'], - primary_completion_date_type: primary_completion_date['type'], - primary_completion_date: convert_to_date(primary_completion_date['date']), - baseline_population: baseline['populationDescription'], - brief_title: ident['briefTitle'], - official_title: ident['officialTitle'], - acronym: ident['acronym'], - overall_status: status['overallStatus'], - last_known_status: status['lastKnownStatus'], - why_stopped: status['whyStopped'], - delayed_posting: status['delayedPosting'], - phase: phase_list, - enrollment: enrollment['count'], - enrollment_type: enrollment['type'], - source: ident.dig('organization', 'fullName'), - source_class: ident.dig('organization', 'class'), - limitations_and_caveats: key_check(more_info&.dig('limitationsAndCaveats'))&.dig('description'), - number_of_arms: arms_count, - number_of_groups: groups_count, - target_duration: design['targetDuration'], - study_type: study_type, - has_expanded_access: get_boolean(expanded_access), - expanded_access_nctid: status.dig('expandedAccessInfo', 'nctId'), - expanded_access_status_for_nctid: status.dig('expandedAccessInfo', 'statusForNctId'), - expanded_access_type_individual: get_boolean(expanded['individual']), - expanded_access_type_intermediate: get_boolean(expanded['intermediate']), - expanded_access_type_treatment: get_boolean(expanded['treatment']), - has_dmc: get_boolean(oversight['oversightHasDmc']), - is_fda_regulated_drug: get_boolean(oversight['isFdaRegulatedDrug']), - is_fda_regulated_device: get_boolean(oversight['isFdaRegulatedDevice']), - is_unapproved_device: get_boolean(oversight['isUnapprovedDevice']), - is_ppsd: get_boolean(oversight['isPpsd']), - is_us_export: get_boolean(oversight['isUsExport']), - fdaaa801_violation: get_boolean(oversight['fdaaa801Violation']), - biospec_retention: biospec['retention'], - biospec_description: biospec['description'], - plan_to_share_ipd: ipd_sharing['ipdSharing'], - plan_to_share_ipd_description: ipd_sharing['description'], - ipd_time_frame: ipd_sharing['timeFrame'], - ipd_access_criteria: ipd_sharing['accessCriteria'], - ipd_url: ipd_sharing['url'], - baseline_type_units_analyzed: baseline['typeUnitsAnalyzed'] - } - end - def get_groups(opts) self.groups=ResultGroup.create_all_from(opts) end diff --git a/app/models/study_downloader.rb b/app/models/study_downloader.rb index 2bcc6047..cf2d4599 100644 --- a/app/models/study_downloader.rb +++ b/app/models/study_downloader.rb @@ -55,4 +55,18 @@ def self.find_studies_to_update current = Hash[StudyJsonRecord.where(version: '2').pluck(:nct_id, :updated_at)] changed = studies.select{|k| current[k[:nct_id]].nil? || current[k[:nct_id]] < DateTime.parse(k[:updated]) }.map{|k| k[:nct_id]} end + + def self.find_studies_to_remove + studies = ClinicalTrialsApiV2.all + + with_search_path('ctgov_v2, support, public') do + json = StudyJsonRecord.where(version: '2').pluck(:nct_id) + removing = json - studies.map{|k| k[:nct_id]} + puts "removing #{removing.length} studies from study_json_records".red + + imported = Study.pluck(:nct_id) + removing = imported - studies.map{|k| k[:nct_id]} + puts "removing #{removing.length} studies from imported".red + end + end end diff --git a/app/models/study_json_record/worker.rb b/app/models/study_json_record/worker.rb index 79050f8b..e17beb43 100644 --- a/app/models/study_json_record/worker.rb +++ b/app/models/study_json_record/worker.rb @@ -151,6 +151,7 @@ def build end def append_parent(hash, value) + return unless hash if hash['$parent'] append_parent(hash['$parent'], value) else @@ -173,6 +174,7 @@ def add_missing_keys(item, keys) end def flatten(path, data, parent=nil) + # puts "🛑🛑🛑🛑 FLATTEN #{path} - #{data} - #{parent} 🛑🛑🛑🛑" return [] unless data child_key = path.first result = [] @@ -195,6 +197,9 @@ def flatten(path, data, parent=nil) item else res = flatten(path[1..-1], children, item) + if res.first.nil? + byebug + end append_parent(res.first, parent) if parent res end diff --git a/app/models/study_relationship.rb b/app/models/study_relationship.rb index 6475aa2f..6804ed0b 100644 --- a/app/models/study_relationship.rb +++ b/app/models/study_relationship.rb @@ -379,4 +379,16 @@ def self.update_data_definitions end end end + + def self.swhere(opts={}, version='1') + table_name = self.table_name.gsub(/ctgov_v2.|ctgov./, '') + case version + when '1' + self.table_name = "ctgov.#{table_name}" + where(opts) + when '2' + self.table_name = "ctgov_v2.#{table_name}" + where(opts) + end + end end diff --git a/db/admin_structure.sql b/db/admin_structure.sql index fa1688c1..85b5afaa 100644 --- a/db/admin_structure.sql +++ b/db/admin_structure.sql @@ -17,17 +17,10 @@ CREATE SCHEMA ctgov; -- --- Name: public; Type: SCHEMA; Schema: -; Owner: - +-- Name: ctgov_v2; Type: SCHEMA; Schema: -; Owner: - -- -CREATE SCHEMA public; - - --- --- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: - --- - -COMMENT ON SCHEMA public IS 'standard public schema'; +CREATE SCHEMA ctgov_v2; -- @@ -264,6 +257,233 @@ CREATE FUNCTION ctgov.study_summaries_for_condition(character varying) RETURNS T $_$; +-- +-- Name: category_insert_function(); Type: FUNCTION; Schema: ctgov_v2; Owner: - +-- + +CREATE FUNCTION ctgov_v2.category_insert_function() RETURNS trigger + LANGUAGE plpgsql + AS $$ + BEGIN + INSERT INTO ctgov_v2.search_results (id, nct_id, name, created_at, updated_at, grouping, study_search_id) + + VALUES (NEW.id, NEW.nct_id, NEW.name, NEW.created_at, NEW.updated_at, NEW.grouping, NEW.study_search_id); + RETURN NEW; + END; + $$; + + +-- +-- Name: ids_for_org(character varying); Type: FUNCTION; Schema: ctgov_v2; Owner: - +-- + +CREATE FUNCTION ctgov_v2.ids_for_org(character varying) RETURNS TABLE(nct_id character varying) + LANGUAGE sql + AS $_$ + SELECT DISTINCT nct_id FROM responsible_parties WHERE lower(affiliation) like lower($1) + UNION + SELECT DISTINCT nct_id FROM facilities WHERE lower(name) like lower($1) or lower(city) like lower($1) or lower(state) like lower($1) or lower(country) like lower($1) + UNION + SELECT DISTINCT nct_id FROM sponsors WHERE lower(name) like lower($1) + UNION + SELECT DISTINCT nct_id FROM result_contacts WHERE lower(organization) like lower($1) + ; + $_$; + + +-- +-- Name: ids_for_term(character varying); Type: FUNCTION; Schema: ctgov_v2; Owner: - +-- + +CREATE FUNCTION ctgov_v2.ids_for_term(character varying) RETURNS TABLE(nct_id character varying) + LANGUAGE sql + AS $_$ + SELECT DISTINCT nct_id FROM browse_conditions WHERE downcase_mesh_term like lower($1) + UNION + SELECT DISTINCT nct_id FROM browse_interventions WHERE downcase_mesh_term like lower($1) + UNION + SELECT DISTINCT nct_id FROM studies WHERE lower(brief_title) like lower($1) + UNION + SELECT DISTINCT nct_id FROM keywords WHERE lower(name) like lower($1) + ; + $_$; + + +-- +-- Name: study_summaries_for_condition(character varying); Type: FUNCTION; Schema: ctgov_v2; Owner: - +-- + +CREATE FUNCTION ctgov_v2.study_summaries_for_condition(character varying) RETURNS TABLE(nct_id character varying, title text, recruitment character varying, were_results_reported boolean, conditions text, interventions text, gender character varying, age text, phase character varying, enrollment integer, study_type character varying, sponsors text, other_ids text, study_first_submitted_date date, start_date date, completion_month_year character varying, last_update_submitted_date date, verification_month_year character varying, results_first_submitted_date date, acronym character varying, primary_completion_month_year character varying, outcome_measures text, disposition_first_submitted_date date, allocation character varying, intervention_model character varying, observational_model character varying, primary_purpose character varying, time_perspective character varying, masking character varying, masking_description text, intervention_model_description text, subject_masked boolean, caregiver_masked boolean, investigator_masked boolean, outcomes_assessor_masked boolean, number_of_facilities integer) + LANGUAGE sql + AS $_$ + SELECT DISTINCT s.nct_id, + s.brief_title, + s.overall_status, + cv.were_results_reported, + bc.mesh_term, + i.names as interventions, + e.gender, + CASE + WHEN e.minimum_age = 'N/A' AND e.maximum_age = 'N/A' THEN 'No age restriction' + WHEN e.minimum_age != 'N/A' AND e.maximum_age = 'N/A' THEN concat(e.minimum_age, ' and older') + WHEN e.minimum_age = 'N/A' AND e.maximum_age != 'N/A' THEN concat('up to ', e.maximum_age) + ELSE concat(e.minimum_age, ' to ', e.maximum_age) + END, + CASE + WHEN s.phase='N/A' THEN NULL + ELSE s.phase + END, + s.enrollment, + s.study_type, + sp.names as sponsors, + id.names as id_values, + s.study_first_submitted_date, + s.start_date, + s.completion_month_year, + s.last_update_submitted_date, + s.verification_month_year, + s.results_first_submitted_date, + s.acronym, + s.primary_completion_month_year, + o.names as design_outcomes, + s.disposition_first_submitted_date, + d.allocation, + d.intervention_model, + d.observational_model, + d.primary_purpose, + d.time_perspective, + d.masking, + d.masking_description, + d.intervention_model_description, + d.subject_masked, + d.caregiver_masked, + d.investigator_masked, + d.outcomes_assessor_masked, + cv.number_of_facilities + FROM studies s + INNER JOIN browse_conditions bc ON s.nct_id = bc.nct_id and bc.downcase_mesh_term like lower($1) + LEFT OUTER JOIN calculated_values cv ON s.nct_id = cv.nct_id + LEFT OUTER JOIN all_conditions c ON s.nct_id = c.nct_id + LEFT OUTER JOIN all_interventions i ON s.nct_id = i.nct_id + LEFT OUTER JOIN all_sponsors sp ON s.nct_id = sp.nct_id + LEFT OUTER JOIN eligibilities e ON s.nct_id = e.nct_id + LEFT OUTER JOIN all_id_information id ON s.nct_id = id.nct_id + LEFT OUTER JOIN all_design_outcomes o ON s.nct_id = o.nct_id + LEFT OUTER JOIN designs d ON s.nct_id = d.nct_id + UNION + SELECT DISTINCT s.nct_id, + s.brief_title, + s.overall_status, + cv.were_results_reported, + bc.name, + i.names as interventions, + e.gender, + CASE + WHEN e.minimum_age = 'N/A' AND e.maximum_age = 'N/A' THEN 'No age restriction' + WHEN e.minimum_age != 'N/A' AND e.maximum_age = 'N/A' THEN concat(e.minimum_age, ' and older') + WHEN e.minimum_age = 'N/A' AND e.maximum_age != 'N/A' THEN concat('up to ', e.maximum_age) + ELSE concat(e.minimum_age, ' to ', e.maximum_age) + END, + CASE + WHEN s.phase='N/A' THEN NULL + ELSE s.phase + END, + s.enrollment, + s.study_type, + sp.names as sponsors, + id.names as id_values, + s.study_first_submitted_date, + s.start_date, + s.completion_month_year, + s.last_update_submitted_date, + s.verification_month_year, + s.results_first_submitted_date, + s.acronym, + s.primary_completion_month_year, + o.names as design_outcomes, + s.disposition_first_submitted_date, + d.allocation, + d.intervention_model, + d.observational_model, + d.primary_purpose, + d.time_perspective, + d.masking, + d.masking_description, + d.intervention_model_description, + d.subject_masked, + d.caregiver_masked, + d.investigator_masked, + d.outcomes_assessor_masked, + cv.number_of_facilities + FROM studies s + INNER JOIN conditions bc ON s.nct_id = bc.nct_id and bc.downcase_name like lower($1) + LEFT OUTER JOIN calculated_values cv ON s.nct_id = cv.nct_id + LEFT OUTER JOIN all_conditions c ON s.nct_id = c.nct_id + LEFT OUTER JOIN all_interventions i ON s.nct_id = i.nct_id + LEFT OUTER JOIN all_sponsors sp ON s.nct_id = sp.nct_id + LEFT OUTER JOIN eligibilities e ON s.nct_id = e.nct_id + LEFT OUTER JOIN all_id_information id ON s.nct_id = id.nct_id + LEFT OUTER JOIN all_design_outcomes o ON s.nct_id = o.nct_id + LEFT OUTER JOIN designs d ON s.nct_id = d.nct_id + UNION + SELECT DISTINCT s.nct_id, + s.brief_title, + s.overall_status, + cv.were_results_reported, + k.name, + i.names as interventions, + e.gender, + CASE + WHEN e.minimum_age = 'N/A' AND e.maximum_age = 'N/A' THEN 'No age restriction' + WHEN e.minimum_age != 'N/A' AND e.maximum_age = 'N/A' THEN concat(e.minimum_age, ' and older') + WHEN e.minimum_age = 'N/A' AND e.maximum_age != 'N/A' THEN concat('up to ', e.maximum_age) + ELSE concat(e.minimum_age, ' to ', e.maximum_age) + END, + CASE + WHEN s.phase='N/A' THEN NULL + ELSE s.phase + END, + s.enrollment, + s.study_type, + sp.names as sponsors, + id.names as id_values, + s.study_first_submitted_date, + s.start_date, + s.completion_month_year, + s.last_update_submitted_date, + s.verification_month_year, + s.results_first_submitted_date, + s.acronym, + s.primary_completion_month_year, + o.names as outcome_measures, + s.disposition_first_submitted_date, + d.allocation, + d.intervention_model, + d.observational_model, + d.primary_purpose, + d.time_perspective, + d.masking, + d.masking_description, + d.intervention_model_description, + d.subject_masked, + d.caregiver_masked, + d.investigator_masked, + d.outcomes_assessor_masked, + cv.number_of_facilities + FROM studies s + INNER JOIN keywords k ON s.nct_id = k.nct_id and k.downcase_name like lower($1) + LEFT OUTER JOIN calculated_values cv ON s.nct_id = cv.nct_id + LEFT OUTER JOIN all_conditions c ON s.nct_id = c.nct_id + LEFT OUTER JOIN all_interventions i ON s.nct_id = i.nct_id + LEFT OUTER JOIN all_sponsors sp ON s.nct_id = sp.nct_id + LEFT OUTER JOIN eligibilities e ON s.nct_id = e.nct_id + LEFT OUTER JOIN all_id_information id ON s.nct_id = id.nct_id + LEFT OUTER JOIN all_design_outcomes o ON s.nct_id = o.nct_id + LEFT OUTER JOIN designs d ON s.nct_id = d.nct_id + ; + $_$; + + -- -- Name: count_estimate(text); Type: FUNCTION; Schema: public; Owner: - -- @@ -650,6 +870,45 @@ CREATE VIEW ctgov.all_states AS GROUP BY facilities.nct_id; +-- +-- Name: attachments; Type: TABLE; Schema: ctgov; Owner: - +-- + +CREATE TABLE ctgov.attachments ( + id integer NOT NULL, + project_id integer, + file_name character varying, + content_type character varying, + file_contents bytea, + is_image boolean, + description text, + source text, + original_file_name character varying, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL +); + + +-- +-- Name: attachments_id_seq; Type: SEQUENCE; Schema: ctgov; Owner: - +-- + +CREATE SEQUENCE ctgov.attachments_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: attachments_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov; Owner: - +-- + +ALTER SEQUENCE ctgov.attachments_id_seq OWNED BY ctgov.attachments.id; + + -- -- Name: baseline_counts; Type: TABLE; Schema: ctgov; Owner: - -- @@ -1027,14 +1286,93 @@ CREATE TABLE ctgov.eligibilities ( -- --- Name: covid_19_studies; Type: VIEW; Schema: ctgov; Owner: - +-- Name: studies; Type: TABLE; Schema: ctgov_v2; Owner: - -- -CREATE VIEW ctgov.covid_19_studies AS - SELECT s.nct_id, - s.overall_status, - s.study_type, - s.official_title, +CREATE TABLE ctgov_v2.studies ( + nct_id character varying, + nlm_download_date_description character varying, + study_first_submitted_date date, + results_first_submitted_date date, + disposition_first_submitted_date date, + last_update_submitted_date date, + study_first_submitted_qc_date date, + study_first_posted_date date, + study_first_posted_date_type character varying, + results_first_submitted_qc_date date, + results_first_posted_date date, + results_first_posted_date_type character varying, + disposition_first_submitted_qc_date date, + disposition_first_posted_date date, + disposition_first_posted_date_type character varying, + last_update_submitted_qc_date date, + last_update_posted_date date, + last_update_posted_date_type character varying, + start_month_year character varying, + start_date_type character varying, + start_date date, + verification_month_year character varying, + verification_date date, + completion_month_year character varying, + completion_date_type character varying, + completion_date date, + primary_completion_month_year character varying, + primary_completion_date_type character varying, + primary_completion_date date, + target_duration character varying, + study_type character varying, + acronym character varying, + baseline_population text, + brief_title text, + official_title text, + overall_status character varying, + last_known_status character varying, + phase character varying, + enrollment integer, + enrollment_type character varying, + source character varying, + limitations_and_caveats character varying, + number_of_arms integer, + number_of_groups integer, + why_stopped character varying, + has_expanded_access boolean, + expanded_access_type_individual boolean, + expanded_access_type_intermediate boolean, + expanded_access_type_treatment boolean, + has_dmc boolean, + is_fda_regulated_drug boolean, + is_fda_regulated_device boolean, + is_unapproved_device boolean, + is_ppsd boolean, + is_us_export boolean, + biospec_retention character varying, + biospec_description text, + ipd_time_frame character varying, + ipd_access_criteria character varying, + ipd_url character varying, + plan_to_share_ipd character varying, + plan_to_share_ipd_description character varying, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL, + source_class character varying, + delayed_posting boolean, + expanded_access_nctid character varying, + expanded_access_status_for_nctid character varying, + fdaaa801_violation boolean, + baseline_type_units_analyzed character varying, + patient_registry boolean +); + + +-- +-- Name: covid_19_studies; Type: VIEW; Schema: ctgov; Owner: - +-- + +CREATE VIEW ctgov.covid_19_studies AS + SELECT s.nct_id, + s.overall_status, + s.study_type, + s.official_title, s.acronym, s.phase, s.why_stopped, @@ -1098,6 +1436,125 @@ CREATE VIEW ctgov.covid_19_studies AS WHERE ((search_results.name)::text = 'covid-19'::text)))); +-- +-- Name: data_definitions; Type: TABLE; Schema: ctgov; Owner: - +-- + +CREATE TABLE ctgov.data_definitions ( + id integer NOT NULL, + db_section character varying, + table_name character varying, + column_name character varying, + data_type character varying, + source character varying, + ctti_note text, + nlm_link character varying, + row_count integer, + enumerations json, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL, + db_schema character varying +); + + +-- +-- Name: data_definitions_id_seq; Type: SEQUENCE; Schema: ctgov; Owner: - +-- + +CREATE SEQUENCE ctgov.data_definitions_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: data_definitions_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov; Owner: - +-- + +ALTER SEQUENCE ctgov.data_definitions_id_seq OWNED BY ctgov.data_definitions.id; + + +-- +-- Name: datasets; Type: TABLE; Schema: ctgov; Owner: - +-- + +CREATE TABLE ctgov.datasets ( + id integer NOT NULL, + project_id integer, + schema_name character varying, + table_name character varying, + dataset_type character varying, + file_name character varying, + content_type character varying, + name character varying, + file_contents bytea, + url character varying, + made_available_on date, + description text, + source text, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL +); + + +-- +-- Name: datasets_id_seq; Type: SEQUENCE; Schema: ctgov; Owner: - +-- + +CREATE SEQUENCE ctgov.datasets_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: datasets_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov; Owner: - +-- + +ALTER SEQUENCE ctgov.datasets_id_seq OWNED BY ctgov.datasets.id; + + +-- +-- Name: db_user_activities; Type: TABLE; Schema: ctgov; Owner: - +-- + +CREATE TABLE ctgov.db_user_activities ( + id integer NOT NULL, + username character varying, + event_count integer, + when_recorded timestamp without time zone, + unit_of_time character varying, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL +); + + +-- +-- Name: db_user_activities_id_seq; Type: SEQUENCE; Schema: ctgov; Owner: - +-- + +CREATE SEQUENCE ctgov.db_user_activities_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: db_user_activities_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov; Owner: - +-- + +ALTER SEQUENCE ctgov.db_user_activities_id_seq OWNED BY ctgov.db_user_activities.id; + + -- -- Name: design_group_interventions; Type: TABLE; Schema: ctgov; Owner: - -- @@ -1302,6 +1759,43 @@ CREATE SEQUENCE ctgov.eligibilities_id_seq ALTER SEQUENCE ctgov.eligibilities_id_seq OWNED BY ctgov.eligibilities.id; +-- +-- Name: enumerations; Type: TABLE; Schema: ctgov; Owner: - +-- + +CREATE TABLE ctgov.enumerations ( + id integer NOT NULL, + table_name character varying, + column_name character varying, + column_value character varying, + value_count integer, + value_percent numeric, + description character varying, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL +); + + +-- +-- Name: enumerations_id_seq; Type: SEQUENCE; Schema: ctgov; Owner: - +-- + +CREATE SEQUENCE ctgov.enumerations_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: enumerations_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov; Owner: - +-- + +ALTER SEQUENCE ctgov.enumerations_id_seq OWNED BY ctgov.enumerations.id; + + -- -- Name: facilities_id_seq; Type: SEQUENCE; Schema: ctgov; Owner: - -- @@ -1392,42 +1886,26 @@ ALTER SEQUENCE ctgov.facility_investigators_id_seq OWNED BY ctgov.facility_inves -- --- Name: id_information_id_seq; Type: SEQUENCE; Schema: ctgov; Owner: - --- - -CREATE SEQUENCE ctgov.id_information_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: id_information_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov; Owner: - --- - -ALTER SEQUENCE ctgov.id_information_id_seq OWNED BY ctgov.id_information.id; - - --- --- Name: intervention_other_names; Type: TABLE; Schema: ctgov; Owner: - +-- Name: faqs; Type: TABLE; Schema: ctgov; Owner: - -- -CREATE TABLE ctgov.intervention_other_names ( +CREATE TABLE ctgov.faqs ( id integer NOT NULL, - nct_id character varying, - intervention_id integer, - name character varying + project_id integer, + question character varying, + answer text, + citation character varying, + url character varying, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL ); -- --- Name: intervention_other_names_id_seq; Type: SEQUENCE; Schema: ctgov; Owner: - +-- Name: faqs_id_seq; Type: SEQUENCE; Schema: ctgov; Owner: - -- -CREATE SEQUENCE ctgov.intervention_other_names_id_seq +CREATE SEQUENCE ctgov.faqs_id_seq AS integer START WITH 1 INCREMENT BY 1 @@ -1437,17 +1915,29 @@ CREATE SEQUENCE ctgov.intervention_other_names_id_seq -- --- Name: intervention_other_names_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov; Owner: - +-- Name: faqs_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov; Owner: - -- -ALTER SEQUENCE ctgov.intervention_other_names_id_seq OWNED BY ctgov.intervention_other_names.id; +ALTER SEQUENCE ctgov.faqs_id_seq OWNED BY ctgov.faqs.id; -- --- Name: interventions_id_seq; Type: SEQUENCE; Schema: ctgov; Owner: - +-- Name: file_downloads; Type: TABLE; Schema: ctgov; Owner: - -- -CREATE SEQUENCE ctgov.interventions_id_seq +CREATE TABLE ctgov.file_downloads ( + id integer NOT NULL, + file_record_id integer, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: file_downloads_id_seq; Type: SEQUENCE; Schema: ctgov; Owner: - +-- + +CREATE SEQUENCE ctgov.file_downloads_id_seq AS integer START WITH 1 INCREMENT BY 1 @@ -1457,28 +1947,33 @@ CREATE SEQUENCE ctgov.interventions_id_seq -- --- Name: interventions_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov; Owner: - +-- Name: file_downloads_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov; Owner: - -- -ALTER SEQUENCE ctgov.interventions_id_seq OWNED BY ctgov.interventions.id; +ALTER SEQUENCE ctgov.file_downloads_id_seq OWNED BY ctgov.file_downloads.id; -- --- Name: ipd_information_types; Type: TABLE; Schema: ctgov; Owner: - +-- Name: health_checks; Type: TABLE; Schema: ctgov; Owner: - -- -CREATE TABLE ctgov.ipd_information_types ( +CREATE TABLE ctgov.health_checks ( id integer NOT NULL, - nct_id character varying, - name character varying + query text, + cost character varying, + actual_time double precision, + row_count integer, + description character varying, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL ); -- --- Name: ipd_information_types_id_seq; Type: SEQUENCE; Schema: ctgov; Owner: - +-- Name: health_checks_id_seq; Type: SEQUENCE; Schema: ctgov; Owner: - -- -CREATE SEQUENCE ctgov.ipd_information_types_id_seq +CREATE SEQUENCE ctgov.health_checks_id_seq AS integer START WITH 1 INCREMENT BY 1 @@ -1488,17 +1983,17 @@ CREATE SEQUENCE ctgov.ipd_information_types_id_seq -- --- Name: ipd_information_types_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov; Owner: - +-- Name: health_checks_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov; Owner: - -- -ALTER SEQUENCE ctgov.ipd_information_types_id_seq OWNED BY ctgov.ipd_information_types.id; +ALTER SEQUENCE ctgov.health_checks_id_seq OWNED BY ctgov.health_checks.id; -- --- Name: keywords_id_seq; Type: SEQUENCE; Schema: ctgov; Owner: - +-- Name: id_information_id_seq; Type: SEQUENCE; Schema: ctgov; Owner: - -- -CREATE SEQUENCE ctgov.keywords_id_seq +CREATE SEQUENCE ctgov.id_information_id_seq AS integer START WITH 1 INCREMENT BY 1 @@ -1508,10 +2003,113 @@ CREATE SEQUENCE ctgov.keywords_id_seq -- --- Name: keywords_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov; Owner: - +-- Name: id_information_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov; Owner: - -- -ALTER SEQUENCE ctgov.keywords_id_seq OWNED BY ctgov.keywords.id; +ALTER SEQUENCE ctgov.id_information_id_seq OWNED BY ctgov.id_information.id; + + +-- +-- Name: intervention_other_names; Type: TABLE; Schema: ctgov; Owner: - +-- + +CREATE TABLE ctgov.intervention_other_names ( + id integer NOT NULL, + nct_id character varying, + intervention_id integer, + name character varying +); + + +-- +-- Name: intervention_other_names_id_seq; Type: SEQUENCE; Schema: ctgov; Owner: - +-- + +CREATE SEQUENCE ctgov.intervention_other_names_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: intervention_other_names_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov; Owner: - +-- + +ALTER SEQUENCE ctgov.intervention_other_names_id_seq OWNED BY ctgov.intervention_other_names.id; + + +-- +-- Name: interventions_id_seq; Type: SEQUENCE; Schema: ctgov; Owner: - +-- + +CREATE SEQUENCE ctgov.interventions_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: interventions_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov; Owner: - +-- + +ALTER SEQUENCE ctgov.interventions_id_seq OWNED BY ctgov.interventions.id; + + +-- +-- Name: ipd_information_types; Type: TABLE; Schema: ctgov; Owner: - +-- + +CREATE TABLE ctgov.ipd_information_types ( + id integer NOT NULL, + nct_id character varying, + name character varying +); + + +-- +-- Name: ipd_information_types_id_seq; Type: SEQUENCE; Schema: ctgov; Owner: - +-- + +CREATE SEQUENCE ctgov.ipd_information_types_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: ipd_information_types_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov; Owner: - +-- + +ALTER SEQUENCE ctgov.ipd_information_types_id_seq OWNED BY ctgov.ipd_information_types.id; + + +-- +-- Name: keywords_id_seq; Type: SEQUENCE; Schema: ctgov; Owner: - +-- + +CREATE SEQUENCE ctgov.keywords_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: keywords_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov; Owner: - +-- + +ALTER SEQUENCE ctgov.keywords_id_seq OWNED BY ctgov.keywords.id; -- @@ -1650,6 +2248,43 @@ CREATE SEQUENCE ctgov.milestones_id_seq ALTER SEQUENCE ctgov.milestones_id_seq OWNED BY ctgov.milestones.id; +-- +-- Name: notices; Type: TABLE; Schema: ctgov; Owner: - +-- + +CREATE TABLE ctgov.notices ( + id integer NOT NULL, + body character varying, + user_id integer, + title character varying, + send_emails boolean, + emails_sent_at timestamp without time zone, + visible boolean, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: notices_id_seq; Type: SEQUENCE; Schema: ctgov; Owner: - +-- + +CREATE SEQUENCE ctgov.notices_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: notices_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov; Owner: - +-- + +ALTER SEQUENCE ctgov.notices_id_seq OWNED BY ctgov.notices.id; + + -- -- Name: outcome_analyses; Type: TABLE; Schema: ctgov; Owner: - -- @@ -1797,7 +2432,10 @@ CREATE TABLE ctgov.outcome_measurements ( dispersion_upper_limit numeric, explanation_of_na text, dispersion_upper_limit_raw character varying, - dispersion_lower_limit_raw character varying + dispersion_lower_limit_raw character varying, + denom_units character varying, + denom_value double precision, + denom_value_raw double precision ); @@ -1948,6 +2586,59 @@ CREATE SEQUENCE ctgov.pending_results_id_seq ALTER SEQUENCE ctgov.pending_results_id_seq OWNED BY ctgov.pending_results.id; +-- +-- Name: projects; Type: TABLE; Schema: ctgov; Owner: - +-- + +CREATE TABLE ctgov.projects ( + id integer NOT NULL, + status character varying, + start_date date, + completion_date date, + schema_name character varying, + data_available boolean, + migration_file_name character varying, + name character varying, + year integer, + aact_version character varying, + brief_summary character varying, + investigators character varying, + organizations character varying, + url character varying, + description text, + protocol text, + issues text, + study_selection_criteria text, + submitter_name character varying, + contact_info character varying, + contact_url character varying, + email character varying, + image bytea, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL +); + + +-- +-- Name: projects_id_seq; Type: SEQUENCE; Schema: ctgov; Owner: - +-- + +CREATE SEQUENCE ctgov.projects_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: projects_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov; Owner: - +-- + +ALTER SEQUENCE ctgov.projects_id_seq OWNED BY ctgov.projects.id; + + -- -- Name: provided_documents; Type: TABLE; Schema: ctgov; Owner: - -- @@ -1984,6 +2675,114 @@ CREATE SEQUENCE ctgov.provided_documents_id_seq ALTER SEQUENCE ctgov.provided_documents_id_seq OWNED BY ctgov.provided_documents.id; +-- +-- Name: public_announcements; Type: TABLE; Schema: ctgov; Owner: - +-- + +CREATE TABLE ctgov.public_announcements ( + id integer NOT NULL, + description character varying, + is_sticky boolean +); + + +-- +-- Name: public_announcements_id_seq; Type: SEQUENCE; Schema: ctgov; Owner: - +-- + +CREATE SEQUENCE ctgov.public_announcements_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: public_announcements_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov; Owner: - +-- + +ALTER SEQUENCE ctgov.public_announcements_id_seq OWNED BY ctgov.public_announcements.id; + + +-- +-- Name: publications; Type: TABLE; Schema: ctgov; Owner: - +-- + +CREATE TABLE ctgov.publications ( + id integer NOT NULL, + project_id integer, + pub_type character varying, + journal_name character varying, + title character varying, + url character varying, + citation character varying, + pmid character varying, + pmcid character varying, + doi character varying, + publication_date date, + abstract text, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL +); + + +-- +-- Name: publications_id_seq; Type: SEQUENCE; Schema: ctgov; Owner: - +-- + +CREATE SEQUENCE ctgov.publications_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: publications_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov; Owner: - +-- + +ALTER SEQUENCE ctgov.publications_id_seq OWNED BY ctgov.publications.id; + + +-- +-- Name: releases; Type: TABLE; Schema: ctgov; Owner: - +-- + +CREATE TABLE ctgov.releases ( + id integer NOT NULL, + title character varying, + subtitle character varying, + released_on date, + body text, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: releases_id_seq; Type: SEQUENCE; Schema: ctgov; Owner: - +-- + +CREATE SEQUENCE ctgov.releases_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: releases_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov; Owner: - +-- + +ALTER SEQUENCE ctgov.releases_id_seq OWNED BY ctgov.releases.id; + + -- -- Name: reported_event_totals; Type: TABLE; Schema: ctgov; Owner: - -- @@ -2239,10 +3038,26 @@ ALTER SEQUENCE ctgov.retractions_id_seq OWNED BY ctgov.retractions.id; -- --- Name: search_results_id_seq; Type: SEQUENCE; Schema: ctgov; Owner: - +-- Name: saved_queries; Type: TABLE; Schema: ctgov; Owner: - -- -CREATE SEQUENCE ctgov.search_results_id_seq +CREATE TABLE ctgov.saved_queries ( + id integer NOT NULL, + title character varying, + description character varying, + sql character varying, + public boolean, + user_id integer, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL +); + + +-- +-- Name: saved_queries_id_seq; Type: SEQUENCE; Schema: ctgov; Owner: - +-- + +CREATE SEQUENCE ctgov.saved_queries_id_seq AS integer START WITH 1 INCREMENT BY 1 @@ -2252,17 +3067,37 @@ CREATE SEQUENCE ctgov.search_results_id_seq -- --- Name: search_results_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov; Owner: - +-- Name: saved_queries_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov; Owner: - -- -ALTER SEQUENCE ctgov.search_results_id_seq OWNED BY ctgov.search_results.id; +ALTER SEQUENCE ctgov.saved_queries_id_seq OWNED BY ctgov.saved_queries.id; -- --- Name: sponsors_id_seq; Type: SEQUENCE; Schema: ctgov; Owner: - +-- Name: search_results_id_seq; Type: SEQUENCE; Schema: ctgov; Owner: - -- -CREATE SEQUENCE ctgov.sponsors_id_seq +CREATE SEQUENCE ctgov.search_results_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: search_results_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov; Owner: - +-- + +ALTER SEQUENCE ctgov.search_results_id_seq OWNED BY ctgov.search_results.id; + + +-- +-- Name: sponsors_id_seq; Type: SEQUENCE; Schema: ctgov; Owner: - +-- + +CREATE SEQUENCE ctgov.sponsors_id_seq AS integer START WITH 1 INCREMENT BY 1 @@ -2461,45 +3296,27 @@ ALTER SEQUENCE ctgov.study_searches_id_seq OWNED BY ctgov.study_searches.id; -- --- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: - --- - -CREATE TABLE public.ar_internal_metadata ( - key character varying NOT NULL, - value character varying, - created_at timestamp(6) without time zone NOT NULL, - updated_at timestamp(6) without time zone NOT NULL -); - - --- --- Name: schema_migrations; Type: TABLE; Schema: public; Owner: - --- - -CREATE TABLE public.schema_migrations ( - version character varying NOT NULL -); - - --- --- Name: active_storage_attachments; Type: TABLE; Schema: support; Owner: - +-- Name: use_case_attachments; Type: TABLE; Schema: ctgov; Owner: - -- -CREATE TABLE support.active_storage_attachments ( - id bigint NOT NULL, - name character varying NOT NULL, - record_type character varying NOT NULL, - record_id bigint NOT NULL, - blob_id bigint NOT NULL, - created_at timestamp without time zone NOT NULL +CREATE TABLE ctgov.use_case_attachments ( + id integer NOT NULL, + use_case_id integer, + file_name character varying, + content_type character varying, + file_contents bytea, + is_image boolean, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL ); -- --- Name: active_storage_attachments_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- Name: use_case_attachments_id_seq; Type: SEQUENCE; Schema: ctgov; Owner: - -- -CREATE SEQUENCE support.active_storage_attachments_id_seq +CREATE SEQUENCE ctgov.use_case_attachments_id_seq + AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -2508,33 +3325,31 @@ CREATE SEQUENCE support.active_storage_attachments_id_seq -- --- Name: active_storage_attachments_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- Name: use_case_attachments_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov; Owner: - -- -ALTER SEQUENCE support.active_storage_attachments_id_seq OWNED BY support.active_storage_attachments.id; +ALTER SEQUENCE ctgov.use_case_attachments_id_seq OWNED BY ctgov.use_case_attachments.id; -- --- Name: active_storage_blobs; Type: TABLE; Schema: support; Owner: - +-- Name: use_case_datasets; Type: TABLE; Schema: ctgov; Owner: - -- -CREATE TABLE support.active_storage_blobs ( - id bigint NOT NULL, - key character varying NOT NULL, - filename character varying NOT NULL, - content_type character varying, - metadata text, - byte_size bigint NOT NULL, - checksum character varying NOT NULL, - created_at timestamp without time zone NOT NULL +CREATE TABLE ctgov.use_case_datasets ( + id integer NOT NULL, + use_case_id integer, + dataset_type character varying, + name character varying, + description text ); -- --- Name: active_storage_blobs_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- Name: use_case_datasets_id_seq; Type: SEQUENCE; Schema: ctgov; Owner: - -- -CREATE SEQUENCE support.active_storage_blobs_id_seq +CREATE SEQUENCE ctgov.use_case_datasets_id_seq + AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -2543,36 +3358,30 @@ CREATE SEQUENCE support.active_storage_blobs_id_seq -- --- Name: active_storage_blobs_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- Name: use_case_datasets_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov; Owner: - -- -ALTER SEQUENCE support.active_storage_blobs_id_seq OWNED BY support.active_storage_blobs.id; +ALTER SEQUENCE ctgov.use_case_datasets_id_seq OWNED BY ctgov.use_case_datasets.id; -- --- Name: background_jobs; Type: TABLE; Schema: support; Owner: - +-- Name: use_case_publications; Type: TABLE; Schema: ctgov; Owner: - -- -CREATE TABLE support.background_jobs ( - id bigint NOT NULL, - user_id integer, - status character varying, - completed_at timestamp without time zone, - logs character varying, - type character varying, - data json, - url character varying, - created_at timestamp(6) without time zone NOT NULL, - updated_at timestamp(6) without time zone NOT NULL, - user_error_message character varying +CREATE TABLE ctgov.use_case_publications ( + id integer NOT NULL, + use_case_id integer, + name character varying, + url character varying ); -- --- Name: background_jobs_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- Name: use_case_publications_id_seq; Type: SEQUENCE; Schema: ctgov; Owner: - -- -CREATE SEQUENCE support.background_jobs_id_seq +CREATE SEQUENCE ctgov.use_case_publications_id_seq + AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -2581,33 +3390,45 @@ CREATE SEQUENCE support.background_jobs_id_seq -- --- Name: background_jobs_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- Name: use_case_publications_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov; Owner: - -- -ALTER SEQUENCE support.background_jobs_id_seq OWNED BY support.background_jobs.id; +ALTER SEQUENCE ctgov.use_case_publications_id_seq OWNED BY ctgov.use_case_publications.id; -- --- Name: file_records; Type: TABLE; Schema: support; Owner: - +-- Name: use_cases; Type: TABLE; Schema: ctgov; Owner: - -- -CREATE TABLE support.file_records ( - id bigint NOT NULL, - filename character varying, - file_size bigint, - file_type character varying, - created_at timestamp(6) without time zone NOT NULL, - updated_at timestamp(6) without time zone NOT NULL, +CREATE TABLE ctgov.use_cases ( + id integer NOT NULL, + status character varying, + completion_date date, + title character varying, + year integer, + brief_summary character varying, + investigators character varying, + organizations character varying, url character varying, - load_event_id bigint + detailed_description text, + protocol text, + issues text, + study_selection_criteria text, + submitter_name character varying, + contact_info character varying, + email character varying, + image bytea, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL ); -- --- Name: file_records_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- Name: use_cases_id_seq; Type: SEQUENCE; Schema: ctgov; Owner: - -- -CREATE SEQUENCE support.file_records_id_seq +CREATE SEQUENCE ctgov.use_cases_id_seq + AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -2616,37 +3437,32 @@ CREATE SEQUENCE support.file_records_id_seq -- --- Name: file_records_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- Name: use_cases_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov; Owner: - -- -ALTER SEQUENCE support.file_records_id_seq OWNED BY support.file_records.id; +ALTER SEQUENCE ctgov.use_cases_id_seq OWNED BY ctgov.use_cases.id; -- --- Name: load_events; Type: TABLE; Schema: support; Owner: - +-- Name: user_events; Type: TABLE; Schema: ctgov; Owner: - -- -CREATE TABLE support.load_events ( +CREATE TABLE ctgov.user_events ( id integer NOT NULL, + email character varying, event_type character varying, - status character varying, description text, - problems text, - should_add integer, - should_change integer, - processed integer, - load_time character varying, - completed_at timestamp without time zone, + file_names character varying, created_at timestamp without time zone NOT NULL, updated_at timestamp without time zone NOT NULL ); -- --- Name: load_events_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- Name: user_events_id_seq; Type: SEQUENCE; Schema: ctgov; Owner: - -- -CREATE SEQUENCE support.load_events_id_seq +CREATE SEQUENCE ctgov.user_events_id_seq AS integer START WITH 1 INCREMENT BY 1 @@ -2656,29 +3472,46 @@ CREATE SEQUENCE support.load_events_id_seq -- --- Name: load_events_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- Name: user_events_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov; Owner: - -- -ALTER SEQUENCE support.load_events_id_seq OWNED BY support.load_events.id; +ALTER SEQUENCE ctgov.user_events_id_seq OWNED BY ctgov.user_events.id; -- --- Name: load_issues; Type: TABLE; Schema: support; Owner: - +-- Name: users; Type: TABLE; Schema: ctgov; Owner: - -- -CREATE TABLE support.load_issues ( - id bigint NOT NULL, - load_event_id bigint, - nct_id character varying, - message character varying +CREATE TABLE ctgov.users ( + id integer NOT NULL, + email character varying DEFAULT ''::character varying NOT NULL, + encrypted_password character varying DEFAULT ''::character varying NOT NULL, + reset_password_token character varying, + reset_password_sent_at timestamp without time zone, + remember_created_at timestamp without time zone, + sign_in_count integer DEFAULT 0 NOT NULL, + current_sign_in_at timestamp without time zone, + last_sign_in_at timestamp without time zone, + current_sign_in_ip character varying, + last_sign_in_ip character varying, + first_name character varying, + last_name character varying, + username character varying, + confirmation_token character varying, + confirmed_at timestamp without time zone, + confirmation_sent_at timestamp without time zone, + db_activity bigint, + last_db_activity timestamp without time zone, + admin boolean DEFAULT false ); -- --- Name: load_issues_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- Name: users_id_seq; Type: SEQUENCE; Schema: ctgov; Owner: - -- -CREATE SEQUENCE support.load_issues_id_seq +CREATE SEQUENCE ctgov.users_id_seq + AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -2687,1734 +3520,5759 @@ CREATE SEQUENCE support.load_issues_id_seq -- --- Name: load_issues_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov; Owner: - -- -ALTER SEQUENCE support.load_issues_id_seq OWNED BY support.load_issues.id; +ALTER SEQUENCE ctgov.users_id_seq OWNED BY ctgov.users.id; -- --- Name: sanity_checks; Type: TABLE; Schema: support; Owner: - +-- Name: browse_conditions; Type: TABLE; Schema: ctgov_v2; Owner: - -- -CREATE TABLE support.sanity_checks ( +CREATE TABLE ctgov_v2.browse_conditions ( id integer NOT NULL, - table_name character varying, nct_id character varying, - column_name character varying, - check_type character varying, - row_count integer, - description text, - most_current boolean, - created_at timestamp without time zone NOT NULL, - updated_at timestamp without time zone NOT NULL, - load_event_id bigint + mesh_term character varying, + downcase_mesh_term character varying, + mesh_type character varying ); -- --- Name: sanity_checks_id_seq; Type: SEQUENCE; Schema: support; Owner: - --- - -CREATE SEQUENCE support.sanity_checks_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: sanity_checks_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- Name: all_browse_conditions; Type: VIEW; Schema: ctgov_v2; Owner: - -- -ALTER SEQUENCE support.sanity_checks_id_seq OWNED BY support.sanity_checks.id; +CREATE VIEW ctgov_v2.all_browse_conditions AS + SELECT browse_conditions.nct_id, + array_to_string(array_agg(DISTINCT browse_conditions.mesh_term), '|'::text) AS names + FROM ctgov_v2.browse_conditions + GROUP BY browse_conditions.nct_id; -- --- Name: study_json_records; Type: TABLE; Schema: support; Owner: - +-- Name: browse_interventions; Type: TABLE; Schema: ctgov_v2; Owner: - -- -CREATE TABLE support.study_json_records ( +CREATE TABLE ctgov_v2.browse_interventions ( id integer NOT NULL, - nct_id character varying NOT NULL, - content jsonb NOT NULL, - saved_study_at timestamp without time zone, - created_at timestamp without time zone NOT NULL, - updated_at timestamp without time zone NOT NULL, - download_date character varying, - version character varying DEFAULT '1'::character varying + nct_id character varying, + mesh_term character varying, + downcase_mesh_term character varying, + mesh_type character varying ); -- --- Name: study_json_records_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- Name: all_browse_interventions; Type: VIEW; Schema: ctgov_v2; Owner: - -- -CREATE SEQUENCE support.study_json_records_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; +CREATE VIEW ctgov_v2.all_browse_interventions AS + SELECT browse_interventions.nct_id, + array_to_string(array_agg(browse_interventions.mesh_term), '|'::text) AS names + FROM ctgov_v2.browse_interventions + GROUP BY browse_interventions.nct_id; -- --- Name: study_json_records_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- Name: facilities; Type: TABLE; Schema: ctgov_v2; Owner: - -- -ALTER SEQUENCE support.study_json_records_id_seq OWNED BY support.study_json_records.id; +CREATE TABLE ctgov_v2.facilities ( + id integer NOT NULL, + nct_id character varying, + status character varying, + name character varying, + city character varying, + state character varying, + zip character varying, + country character varying +); -- --- Name: study_statistics_comparisons; Type: TABLE; Schema: support; Owner: - +-- Name: all_cities; Type: VIEW; Schema: ctgov_v2; Owner: - -- -CREATE TABLE support.study_statistics_comparisons ( - id bigint NOT NULL, - ctgov_selector character varying, - "table" character varying, - "column" character varying, - condition character varying, - instances_query character varying, - unique_query character varying -); +CREATE VIEW ctgov_v2.all_cities AS + SELECT facilities.nct_id, + array_to_string(array_agg(DISTINCT facilities.city), '|'::text) AS names + FROM ctgov_v2.facilities + GROUP BY facilities.nct_id; -- --- Name: study_statistics_comparisons_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- Name: conditions; Type: TABLE; Schema: ctgov_v2; Owner: - -- -CREATE SEQUENCE support.study_statistics_comparisons_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; +CREATE TABLE ctgov_v2.conditions ( + id integer NOT NULL, + nct_id character varying, + name character varying, + downcase_name character varying +); -- --- Name: study_statistics_comparisons_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- Name: all_conditions; Type: VIEW; Schema: ctgov_v2; Owner: - -- -ALTER SEQUENCE support.study_statistics_comparisons_id_seq OWNED BY support.study_statistics_comparisons.id; +CREATE VIEW ctgov_v2.all_conditions AS + SELECT conditions.nct_id, + array_to_string(array_agg(DISTINCT conditions.name), '|'::text) AS names + FROM ctgov_v2.conditions + GROUP BY conditions.nct_id; -- --- Name: study_xml_records; Type: TABLE; Schema: support; Owner: - +-- Name: countries; Type: TABLE; Schema: ctgov_v2; Owner: - -- -CREATE TABLE support.study_xml_records ( +CREATE TABLE ctgov_v2.countries ( id integer NOT NULL, nct_id character varying, - content xml, - created_study_at timestamp without time zone, - created_at timestamp without time zone NOT NULL, - updated_at timestamp without time zone NOT NULL + name character varying, + removed boolean ); -- --- Name: study_xml_records_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- Name: all_countries; Type: VIEW; Schema: ctgov_v2; Owner: - -- -CREATE SEQUENCE support.study_xml_records_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE +CREATE VIEW ctgov_v2.all_countries AS + SELECT countries.nct_id, + array_to_string(array_agg(DISTINCT countries.name), '|'::text) AS names + FROM ctgov_v2.countries + WHERE (countries.removed IS NOT TRUE) + GROUP BY countries.nct_id; + + +-- +-- Name: design_outcomes; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.design_outcomes ( + id integer NOT NULL, + nct_id character varying, + outcome_type character varying, + measure text, + time_frame text, + population character varying, + description text +); + + +-- +-- Name: all_design_outcomes; Type: VIEW; Schema: ctgov_v2; Owner: - +-- + +CREATE VIEW ctgov_v2.all_design_outcomes AS + SELECT design_outcomes.nct_id, + array_to_string(array_agg(DISTINCT design_outcomes.measure), '|'::text) AS names + FROM ctgov_v2.design_outcomes + GROUP BY design_outcomes.nct_id; + + +-- +-- Name: all_facilities; Type: VIEW; Schema: ctgov_v2; Owner: - +-- + +CREATE VIEW ctgov_v2.all_facilities AS + SELECT facilities.nct_id, + array_to_string(array_agg(facilities.name), '|'::text) AS names + FROM ctgov_v2.facilities + GROUP BY facilities.nct_id; + + +-- +-- Name: design_groups; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.design_groups ( + id integer NOT NULL, + nct_id character varying, + group_type character varying, + title character varying, + description text +); + + +-- +-- Name: all_group_types; Type: VIEW; Schema: ctgov_v2; Owner: - +-- + +CREATE VIEW ctgov_v2.all_group_types AS + SELECT design_groups.nct_id, + array_to_string(array_agg(DISTINCT design_groups.group_type), '|'::text) AS names + FROM ctgov_v2.design_groups + GROUP BY design_groups.nct_id; + + +-- +-- Name: id_information; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.id_information ( + id integer NOT NULL, + nct_id character varying, + id_source character varying, + id_value character varying, + id_type character varying, + id_type_description character varying, + id_link character varying +); + + +-- +-- Name: all_id_information; Type: VIEW; Schema: ctgov_v2; Owner: - +-- + +CREATE VIEW ctgov_v2.all_id_information AS + SELECT id_information.nct_id, + array_to_string(array_agg(DISTINCT id_information.id_value), '|'::text) AS names + FROM ctgov_v2.id_information + GROUP BY id_information.nct_id; + + +-- +-- Name: interventions; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.interventions ( + id integer NOT NULL, + nct_id character varying, + intervention_type character varying, + name character varying, + description text +); + + +-- +-- Name: all_intervention_types; Type: VIEW; Schema: ctgov_v2; Owner: - +-- + +CREATE VIEW ctgov_v2.all_intervention_types AS + SELECT interventions.nct_id, + array_to_string(array_agg(interventions.intervention_type), '|'::text) AS names + FROM ctgov_v2.interventions + GROUP BY interventions.nct_id; + + +-- +-- Name: all_interventions; Type: VIEW; Schema: ctgov_v2; Owner: - +-- + +CREATE VIEW ctgov_v2.all_interventions AS + SELECT interventions.nct_id, + array_to_string(array_agg(interventions.name), '|'::text) AS names + FROM ctgov_v2.interventions + GROUP BY interventions.nct_id; + + +-- +-- Name: keywords; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.keywords ( + id integer NOT NULL, + nct_id character varying, + name character varying, + downcase_name character varying +); + + +-- +-- Name: all_keywords; Type: VIEW; Schema: ctgov_v2; Owner: - +-- + +CREATE VIEW ctgov_v2.all_keywords AS + SELECT keywords.nct_id, + array_to_string(array_agg(DISTINCT keywords.name), '|'::text) AS names + FROM ctgov_v2.keywords + GROUP BY keywords.nct_id; + + +-- +-- Name: overall_officials; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.overall_officials ( + id integer NOT NULL, + nct_id character varying, + role character varying, + name character varying, + affiliation character varying +); + + +-- +-- Name: all_overall_official_affiliations; Type: VIEW; Schema: ctgov_v2; Owner: - +-- + +CREATE VIEW ctgov_v2.all_overall_official_affiliations AS + SELECT overall_officials.nct_id, + array_to_string(array_agg(overall_officials.affiliation), '|'::text) AS names + FROM ctgov_v2.overall_officials + GROUP BY overall_officials.nct_id; + + +-- +-- Name: all_overall_officials; Type: VIEW; Schema: ctgov_v2; Owner: - +-- + +CREATE VIEW ctgov_v2.all_overall_officials AS + SELECT overall_officials.nct_id, + array_to_string(array_agg(overall_officials.name), '|'::text) AS names + FROM ctgov_v2.overall_officials + GROUP BY overall_officials.nct_id; + + +-- +-- Name: all_primary_outcome_measures; Type: VIEW; Schema: ctgov_v2; Owner: - +-- + +CREATE VIEW ctgov_v2.all_primary_outcome_measures AS + SELECT design_outcomes.nct_id, + array_to_string(array_agg(DISTINCT design_outcomes.measure), '|'::text) AS names + FROM ctgov_v2.design_outcomes + WHERE ((design_outcomes.outcome_type)::text = 'primary'::text) + GROUP BY design_outcomes.nct_id; + + +-- +-- Name: all_secondary_outcome_measures; Type: VIEW; Schema: ctgov_v2; Owner: - +-- + +CREATE VIEW ctgov_v2.all_secondary_outcome_measures AS + SELECT design_outcomes.nct_id, + array_to_string(array_agg(DISTINCT design_outcomes.measure), '|'::text) AS names + FROM ctgov_v2.design_outcomes + WHERE ((design_outcomes.outcome_type)::text = 'secondary'::text) + GROUP BY design_outcomes.nct_id; + + +-- +-- Name: sponsors; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.sponsors ( + id integer NOT NULL, + nct_id character varying, + agency_class character varying, + lead_or_collaborator character varying, + name character varying +); + + +-- +-- Name: all_sponsors; Type: VIEW; Schema: ctgov_v2; Owner: - +-- + +CREATE VIEW ctgov_v2.all_sponsors AS + SELECT sponsors.nct_id, + array_to_string(array_agg(DISTINCT sponsors.name), '|'::text) AS names + FROM ctgov_v2.sponsors + GROUP BY sponsors.nct_id; + + +-- +-- Name: all_states; Type: VIEW; Schema: ctgov_v2; Owner: - +-- + +CREATE VIEW ctgov_v2.all_states AS + SELECT facilities.nct_id, + array_to_string(array_agg(DISTINCT facilities.state), '|'::text) AS names + FROM ctgov_v2.facilities + GROUP BY facilities.nct_id; + + +-- +-- Name: baseline_counts; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.baseline_counts ( + id integer NOT NULL, + nct_id character varying, + result_group_id integer, + ctgov_v2_group_code character varying, + units character varying, + scope character varying, + count integer +); + + +-- +-- Name: baseline_counts_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.baseline_counts_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: baseline_counts_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.baseline_counts_id_seq OWNED BY ctgov_v2.baseline_counts.id; + + +-- +-- Name: baseline_measurements; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.baseline_measurements ( + id integer NOT NULL, + nct_id character varying, + result_group_id integer, + ctgov_v2_group_code character varying, + classification character varying, + category character varying, + title character varying, + description text, + units character varying, + param_type character varying, + param_value character varying, + param_value_num numeric, + dispersion_type character varying, + dispersion_value character varying, + dispersion_value_num numeric, + dispersion_lower_limit numeric, + dispersion_upper_limit numeric, + explanation_of_na character varying, + number_analyzed integer, + number_analyzed_units character varying, + population_description character varying, + calculate_percentage character varying +); + + +-- +-- Name: baseline_measurements_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.baseline_measurements_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE NO MAXVALUE CACHE 1; -- --- Name: study_xml_records_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- Name: baseline_measurements_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.baseline_measurements_id_seq OWNED BY ctgov_v2.baseline_measurements.id; + + +-- +-- Name: brief_summaries; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.brief_summaries ( + id integer NOT NULL, + nct_id character varying, + description text +); + + +-- +-- Name: brief_summaries_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.brief_summaries_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: brief_summaries_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.brief_summaries_id_seq OWNED BY ctgov_v2.brief_summaries.id; + + +-- +-- Name: browse_conditions_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.browse_conditions_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: browse_conditions_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.browse_conditions_id_seq OWNED BY ctgov_v2.browse_conditions.id; + + +-- +-- Name: browse_interventions_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.browse_interventions_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: browse_interventions_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.browse_interventions_id_seq OWNED BY ctgov_v2.browse_interventions.id; + + +-- +-- Name: calculated_values; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.calculated_values ( + id integer NOT NULL, + nct_id character varying, + number_of_facilities integer, + number_of_nsae_subjects integer, + number_of_sae_subjects integer, + registered_in_calendar_year integer, + nlm_download_date date, + actual_duration integer, + were_results_reported boolean DEFAULT false, + months_to_report_results integer, + has_us_facility boolean, + has_single_facility boolean DEFAULT false, + minimum_age_num integer, + maximum_age_num integer, + minimum_age_unit character varying, + maximum_age_unit character varying, + number_of_primary_outcomes_to_measure integer, + number_of_secondary_outcomes_to_measure integer, + number_of_other_outcomes_to_measure integer +); + + +-- +-- Name: calculated_values_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.calculated_values_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: calculated_values_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.calculated_values_id_seq OWNED BY ctgov_v2.calculated_values.id; + + +-- +-- Name: search_results; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.search_results ( + id integer NOT NULL, + nct_id character varying NOT NULL, + name character varying NOT NULL, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL, + "grouping" character varying DEFAULT ''::character varying NOT NULL, + study_search_id integer +); + + +-- +-- Name: categories; Type: VIEW; Schema: ctgov_v2; Owner: - +-- + +CREATE VIEW ctgov_v2.categories AS + SELECT search_results.id, + search_results.nct_id, + search_results.name, + search_results.created_at, + search_results.updated_at, + search_results."grouping", + search_results.study_search_id + FROM ctgov_v2.search_results; + + +-- +-- Name: categories_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.categories_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: central_contacts; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.central_contacts ( + id integer NOT NULL, + nct_id character varying, + contact_type character varying, + name character varying, + phone character varying, + email character varying, + phone_extension character varying, + role character varying +); + + +-- +-- Name: central_contacts_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.central_contacts_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: central_contacts_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.central_contacts_id_seq OWNED BY ctgov_v2.central_contacts.id; + + +-- +-- Name: conditions_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.conditions_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: conditions_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.conditions_id_seq OWNED BY ctgov_v2.conditions.id; + + +-- +-- Name: countries_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.countries_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: countries_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.countries_id_seq OWNED BY ctgov_v2.countries.id; + + +-- +-- Name: design_group_interventions; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.design_group_interventions ( + id integer NOT NULL, + nct_id character varying, + design_group_id integer, + intervention_id integer +); + + +-- +-- Name: design_group_interventions_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.design_group_interventions_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: design_group_interventions_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.design_group_interventions_id_seq OWNED BY ctgov_v2.design_group_interventions.id; + + +-- +-- Name: design_groups_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.design_groups_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: design_groups_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.design_groups_id_seq OWNED BY ctgov_v2.design_groups.id; + + +-- +-- Name: design_outcomes_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.design_outcomes_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: design_outcomes_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.design_outcomes_id_seq OWNED BY ctgov_v2.design_outcomes.id; + + +-- +-- Name: designs; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.designs ( + id integer NOT NULL, + nct_id character varying, + allocation character varying, + intervention_model character varying, + observational_model character varying, + primary_purpose character varying, + time_perspective character varying, + masking character varying, + masking_description text, + intervention_model_description text, + subject_masked boolean, + caregiver_masked boolean, + investigator_masked boolean, + outcomes_assessor_masked boolean +); + + +-- +-- Name: designs_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.designs_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: designs_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.designs_id_seq OWNED BY ctgov_v2.designs.id; + + +-- +-- Name: detailed_descriptions; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.detailed_descriptions ( + id integer NOT NULL, + nct_id character varying, + description text +); + + +-- +-- Name: detailed_descriptions_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.detailed_descriptions_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: detailed_descriptions_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.detailed_descriptions_id_seq OWNED BY ctgov_v2.detailed_descriptions.id; + + +-- +-- Name: documents; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.documents ( + id integer NOT NULL, + nct_id character varying, + document_id character varying, + document_type character varying, + url character varying, + comment text +); + + +-- +-- Name: documents_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.documents_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: documents_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.documents_id_seq OWNED BY ctgov_v2.documents.id; + + +-- +-- Name: drop_withdrawals; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.drop_withdrawals ( + id integer NOT NULL, + nct_id character varying, + result_group_id integer, + ctgov_v2_group_code character varying, + period character varying, + reason character varying, + count integer, + drop_withdraw_comment character varying, + reason_comment character varying, + count_units integer +); + + +-- +-- Name: drop_withdrawals_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.drop_withdrawals_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: drop_withdrawals_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.drop_withdrawals_id_seq OWNED BY ctgov_v2.drop_withdrawals.id; + + +-- +-- Name: eligibilities; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.eligibilities ( + id integer NOT NULL, + nct_id character varying, + sampling_method character varying, + gender character varying, + minimum_age character varying, + maximum_age character varying, + healthy_volunteers boolean, + population text, + criteria text, + gender_description text, + gender_based boolean, + adult boolean, + child boolean, + older_adult boolean +); + + +-- +-- Name: eligibilities_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.eligibilities_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: eligibilities_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.eligibilities_id_seq OWNED BY ctgov_v2.eligibilities.id; + + +-- +-- Name: facilities_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.facilities_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: facilities_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.facilities_id_seq OWNED BY ctgov_v2.facilities.id; + + +-- +-- Name: facility_contacts; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.facility_contacts ( + id integer NOT NULL, + nct_id character varying, + facility_id integer, + contact_type character varying, + name character varying, + email character varying, + phone character varying, + phone_extension character varying +); + + +-- +-- Name: facility_contacts_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.facility_contacts_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: facility_contacts_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.facility_contacts_id_seq OWNED BY ctgov_v2.facility_contacts.id; + + +-- +-- Name: facility_investigators; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.facility_investigators ( + id integer NOT NULL, + nct_id character varying, + facility_id integer, + role character varying, + name character varying +); + + +-- +-- Name: facility_investigators_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.facility_investigators_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: facility_investigators_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.facility_investigators_id_seq OWNED BY ctgov_v2.facility_investigators.id; + + +-- +-- Name: id_information_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.id_information_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: id_information_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.id_information_id_seq OWNED BY ctgov_v2.id_information.id; + + +-- +-- Name: intervention_other_names; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.intervention_other_names ( + id integer NOT NULL, + nct_id character varying, + intervention_id integer, + name character varying +); + + +-- +-- Name: intervention_other_names_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.intervention_other_names_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: intervention_other_names_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.intervention_other_names_id_seq OWNED BY ctgov_v2.intervention_other_names.id; + + +-- +-- Name: interventions_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.interventions_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: interventions_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.interventions_id_seq OWNED BY ctgov_v2.interventions.id; + + +-- +-- Name: ipd_information_types; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.ipd_information_types ( + id integer NOT NULL, + nct_id character varying, + name character varying +); + + +-- +-- Name: ipd_information_types_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.ipd_information_types_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: ipd_information_types_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.ipd_information_types_id_seq OWNED BY ctgov_v2.ipd_information_types.id; + + +-- +-- Name: keywords_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.keywords_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: keywords_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.keywords_id_seq OWNED BY ctgov_v2.keywords.id; + + +-- +-- Name: links; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.links ( + id integer NOT NULL, + nct_id character varying, + url character varying, + description text +); + + +-- +-- Name: links_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.links_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: links_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.links_id_seq OWNED BY ctgov_v2.links.id; + + +-- +-- Name: mesh_headings; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.mesh_headings ( + id integer NOT NULL, + qualifier character varying, + heading character varying, + subcategory character varying +); + + +-- +-- Name: mesh_headings_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.mesh_headings_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: mesh_headings_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.mesh_headings_id_seq OWNED BY ctgov_v2.mesh_headings.id; + + +-- +-- Name: mesh_terms; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.mesh_terms ( + id integer NOT NULL, + qualifier character varying, + tree_number character varying, + description character varying, + mesh_term character varying, + downcase_mesh_term character varying +); + + +-- +-- Name: mesh_terms_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.mesh_terms_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: mesh_terms_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.mesh_terms_id_seq OWNED BY ctgov_v2.mesh_terms.id; + + +-- +-- Name: milestones; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.milestones ( + id integer NOT NULL, + nct_id character varying, + result_group_id integer, + ctgov_v2_group_code character varying, + title character varying, + period character varying, + description text, + count integer, + milestone_description character varying, + count_units character varying +); + + +-- +-- Name: milestones_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.milestones_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: milestones_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.milestones_id_seq OWNED BY ctgov_v2.milestones.id; + + +-- +-- Name: outcome_analyses; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.outcome_analyses ( + id integer NOT NULL, + nct_id character varying, + outcome_id integer, + non_inferiority_type character varying, + non_inferiority_description text, + param_type character varying, + param_value numeric, + dispersion_type character varying, + dispersion_value numeric, + p_value_modifier character varying, + p_value double precision, + ci_n_sides character varying, + ci_percent numeric, + ci_lower_limit numeric, + ci_upper_limit numeric, + ci_upper_limit_na_comment character varying, + p_value_description character varying, + method character varying, + method_description text, + estimate_description text, + groups_description text, + other_analysis_description text, + ci_upper_limit_raw character varying, + ci_lower_limit_raw character varying, + p_value_raw character varying +); + + +-- +-- Name: outcome_analyses_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.outcome_analyses_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: outcome_analyses_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.outcome_analyses_id_seq OWNED BY ctgov_v2.outcome_analyses.id; + + +-- +-- Name: outcome_analysis_groups; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.outcome_analysis_groups ( + id integer NOT NULL, + nct_id character varying, + outcome_analysis_id integer, + result_group_id integer, + ctgov_v2_group_code character varying +); + + +-- +-- Name: outcome_analysis_groups_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.outcome_analysis_groups_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: outcome_analysis_groups_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.outcome_analysis_groups_id_seq OWNED BY ctgov_v2.outcome_analysis_groups.id; + + +-- +-- Name: outcome_counts; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.outcome_counts ( + id integer NOT NULL, + nct_id character varying, + outcome_id integer, + result_group_id integer, + ctgov_v2_group_code character varying, + scope character varying, + units character varying, + count integer +); + + +-- +-- Name: outcome_counts_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.outcome_counts_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: outcome_counts_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.outcome_counts_id_seq OWNED BY ctgov_v2.outcome_counts.id; + + +-- +-- Name: outcome_measurements; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.outcome_measurements ( + id integer NOT NULL, + nct_id character varying, + outcome_id integer, + result_group_id integer, + ctgov_v2_group_code character varying, + classification character varying, + category character varying, + title character varying, + description text, + units character varying, + param_type character varying, + param_value character varying, + param_value_num numeric, + dispersion_type character varying, + dispersion_value character varying, + dispersion_value_num numeric, + dispersion_lower_limit numeric, + dispersion_upper_limit numeric, + explanation_of_na text, + dispersion_upper_limit_raw character varying, + dispersion_lower_limit_raw character varying +); + + +-- +-- Name: outcome_measurements_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.outcome_measurements_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: outcome_measurements_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.outcome_measurements_id_seq OWNED BY ctgov_v2.outcome_measurements.id; + + +-- +-- Name: outcomes; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.outcomes ( + id integer NOT NULL, + nct_id character varying, + outcome_type character varying, + title text, + description text, + time_frame text, + population text, + anticipated_posting_date date, + anticipated_posting_month_year character varying, + units character varying, + units_analyzed character varying, + dispersion_type character varying, + param_type character varying +); + + +-- +-- Name: outcomes_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.outcomes_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: outcomes_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.outcomes_id_seq OWNED BY ctgov_v2.outcomes.id; + + +-- +-- Name: overall_officials_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.overall_officials_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: overall_officials_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.overall_officials_id_seq OWNED BY ctgov_v2.overall_officials.id; + + +-- +-- Name: participant_flows; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.participant_flows ( + id integer NOT NULL, + nct_id character varying, + recruitment_details text, + pre_assignment_details text, + units_analyzed character varying +); + + +-- +-- Name: participant_flows_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.participant_flows_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: participant_flows_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.participant_flows_id_seq OWNED BY ctgov_v2.participant_flows.id; + + +-- +-- Name: pending_results; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.pending_results ( + id integer NOT NULL, + nct_id character varying, + event character varying, + event_date_description character varying, + event_date date +); + + +-- +-- Name: pending_results_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.pending_results_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: pending_results_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.pending_results_id_seq OWNED BY ctgov_v2.pending_results.id; + + +-- +-- Name: provided_documents; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.provided_documents ( + id integer NOT NULL, + nct_id character varying, + document_type character varying, + has_protocol boolean, + has_icf boolean, + has_sap boolean, + document_date date, + url character varying +); + + +-- +-- Name: provided_documents_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.provided_documents_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: provided_documents_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.provided_documents_id_seq OWNED BY ctgov_v2.provided_documents.id; + + +-- +-- Name: reported_event_totals; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.reported_event_totals ( + id integer NOT NULL, + nct_id character varying NOT NULL, + ctgov_v2_group_code character varying NOT NULL, + event_type character varying, + classification character varying NOT NULL, + subjects_affected integer, + subjects_at_risk integer, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL +); + + +-- +-- Name: reported_event_totals_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.reported_event_totals_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: reported_event_totals_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.reported_event_totals_id_seq OWNED BY ctgov_v2.reported_event_totals.id; + + +-- +-- Name: reported_events; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.reported_events ( + id integer NOT NULL, + nct_id character varying, + result_group_id integer, + ctgov_v2_group_code character varying, + time_frame text, + event_type character varying, + default_vocab character varying, + default_assessment character varying, + subjects_affected integer, + subjects_at_risk integer, + description text, + event_count integer, + organ_system character varying, + adverse_event_term character varying, + frequency_threshold integer, + vocab character varying, + assessment character varying +); + + +-- +-- Name: reported_events_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.reported_events_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: reported_events_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.reported_events_id_seq OWNED BY ctgov_v2.reported_events.id; + + +-- +-- Name: responsible_parties; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.responsible_parties ( + id integer NOT NULL, + nct_id character varying, + responsible_party_type character varying, + name character varying, + title character varying, + organization character varying, + affiliation text, + old_name_title character varying +); + + +-- +-- Name: responsible_parties_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.responsible_parties_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: responsible_parties_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.responsible_parties_id_seq OWNED BY ctgov_v2.responsible_parties.id; + + +-- +-- Name: result_agreements; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.result_agreements ( + id integer NOT NULL, + nct_id character varying, + pi_employee boolean, + agreement text, + restriction_type character varying, + other_details text, + restrictive_agreement boolean +); + + +-- +-- Name: result_agreements_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.result_agreements_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: result_agreements_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.result_agreements_id_seq OWNED BY ctgov_v2.result_agreements.id; + + +-- +-- Name: result_contacts; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.result_contacts ( + id integer NOT NULL, + nct_id character varying, + organization character varying, + name character varying, + phone character varying, + email character varying, + extension character varying +); + + +-- +-- Name: result_contacts_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.result_contacts_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: result_contacts_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.result_contacts_id_seq OWNED BY ctgov_v2.result_contacts.id; + + +-- +-- Name: result_groups; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.result_groups ( + id integer NOT NULL, + nct_id character varying, + ctgov_v2_group_code character varying, + result_type character varying, + title character varying, + description text +); + + +-- +-- Name: result_groups_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.result_groups_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: result_groups_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.result_groups_id_seq OWNED BY ctgov_v2.result_groups.id; + + +-- +-- Name: retractions; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.retractions ( + id bigint NOT NULL, + reference_id integer, + pmid character varying, + source character varying, + nct_id character varying +); + + +-- +-- Name: retractions_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.retractions_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: retractions_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.retractions_id_seq OWNED BY ctgov_v2.retractions.id; + + +-- +-- Name: search_results_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.search_results_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: search_results_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.search_results_id_seq OWNED BY ctgov_v2.search_results.id; + + +-- +-- Name: sponsors_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.sponsors_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: sponsors_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.sponsors_id_seq OWNED BY ctgov_v2.sponsors.id; + + +-- +-- Name: study_records; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.study_records ( + id bigint NOT NULL, + nct_id character varying, + type character varying, + content json, + sha character varying, + created_at timestamp(6) without time zone NOT NULL, + updated_at timestamp(6) without time zone NOT NULL +); + + +-- +-- Name: study_records_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.study_records_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: study_records_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.study_records_id_seq OWNED BY ctgov_v2.study_records.id; + + +-- +-- Name: study_references; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.study_references ( + id integer NOT NULL, + nct_id character varying, + pmid character varying, + reference_type character varying, + citation text +); + + +-- +-- Name: study_references_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.study_references_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: study_references_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.study_references_id_seq OWNED BY ctgov_v2.study_references.id; + + +-- +-- Name: study_searches; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.study_searches ( + id integer NOT NULL, + save_tsv boolean DEFAULT false NOT NULL, + query character varying NOT NULL, + "grouping" character varying DEFAULT ''::character varying NOT NULL, + name character varying DEFAULT ''::character varying NOT NULL, + beta_api boolean DEFAULT false NOT NULL, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL, + active boolean +); + + +-- +-- Name: study_searches_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.study_searches_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: study_searches_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.study_searches_id_seq OWNED BY ctgov_v2.study_searches.id; + + +-- +-- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.ar_internal_metadata ( + key character varying NOT NULL, + value character varying, + created_at timestamp(6) without time zone NOT NULL, + updated_at timestamp(6) without time zone NOT NULL +); + + +-- +-- Name: schema_migrations; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.schema_migrations ( + version character varying NOT NULL +); + + +-- +-- Name: active_storage_attachments; Type: TABLE; Schema: support; Owner: - +-- + +CREATE TABLE support.active_storage_attachments ( + id bigint NOT NULL, + name character varying NOT NULL, + record_type character varying NOT NULL, + record_id bigint NOT NULL, + blob_id bigint NOT NULL, + created_at timestamp without time zone NOT NULL +); + + +-- +-- Name: active_storage_attachments_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- + +CREATE SEQUENCE support.active_storage_attachments_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: active_storage_attachments_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- + +ALTER SEQUENCE support.active_storage_attachments_id_seq OWNED BY support.active_storage_attachments.id; + + +-- +-- Name: active_storage_blobs; Type: TABLE; Schema: support; Owner: - +-- + +CREATE TABLE support.active_storage_blobs ( + id bigint NOT NULL, + key character varying NOT NULL, + filename character varying NOT NULL, + content_type character varying, + metadata text, + byte_size bigint NOT NULL, + checksum character varying NOT NULL, + created_at timestamp without time zone NOT NULL +); + + +-- +-- Name: active_storage_blobs_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- + +CREATE SEQUENCE support.active_storage_blobs_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: active_storage_blobs_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- + +ALTER SEQUENCE support.active_storage_blobs_id_seq OWNED BY support.active_storage_blobs.id; + + +-- +-- Name: background_jobs; Type: TABLE; Schema: support; Owner: - +-- + +CREATE TABLE support.background_jobs ( + id bigint NOT NULL, + user_id integer, + status character varying, + completed_at timestamp without time zone, + logs character varying, + type character varying, + data json, + url character varying, + created_at timestamp(6) without time zone NOT NULL, + updated_at timestamp(6) without time zone NOT NULL, + user_error_message character varying +); + + +-- +-- Name: background_jobs_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- + +CREATE SEQUENCE support.background_jobs_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: background_jobs_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- + +ALTER SEQUENCE support.background_jobs_id_seq OWNED BY support.background_jobs.id; + + +-- +-- Name: file_records; Type: TABLE; Schema: support; Owner: - +-- + +CREATE TABLE support.file_records ( + id bigint NOT NULL, + filename character varying, + file_size bigint, + file_type character varying, + created_at timestamp(6) without time zone NOT NULL, + updated_at timestamp(6) without time zone NOT NULL, + url character varying, + load_event_id bigint +); + + +-- +-- Name: file_records_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- + +CREATE SEQUENCE support.file_records_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: file_records_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- + +ALTER SEQUENCE support.file_records_id_seq OWNED BY support.file_records.id; + + +-- +-- Name: load_events; Type: TABLE; Schema: support; Owner: - +-- + +CREATE TABLE support.load_events ( + id integer NOT NULL, + event_type character varying, + status character varying, + description text, + problems text, + should_add integer, + should_change integer, + processed integer, + load_time character varying, + completed_at timestamp without time zone, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL +); + + +-- +-- Name: load_events_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- + +CREATE SEQUENCE support.load_events_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: load_events_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- + +ALTER SEQUENCE support.load_events_id_seq OWNED BY support.load_events.id; + + +-- +-- Name: load_issues; Type: TABLE; Schema: support; Owner: - +-- + +CREATE TABLE support.load_issues ( + id bigint NOT NULL, + load_event_id bigint, + nct_id character varying, + message character varying +); + + +-- +-- Name: load_issues_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- + +CREATE SEQUENCE support.load_issues_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: load_issues_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- + +ALTER SEQUENCE support.load_issues_id_seq OWNED BY support.load_issues.id; + + +-- +-- Name: sanity_checks; Type: TABLE; Schema: support; Owner: - +-- + +CREATE TABLE support.sanity_checks ( + id integer NOT NULL, + table_name character varying, + nct_id character varying, + column_name character varying, + check_type character varying, + row_count integer, + description text, + most_current boolean, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL, + load_event_id bigint +); + + +-- +-- Name: sanity_checks_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- + +CREATE SEQUENCE support.sanity_checks_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: sanity_checks_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- + +ALTER SEQUENCE support.sanity_checks_id_seq OWNED BY support.sanity_checks.id; + + +-- +-- Name: study_json_records; Type: TABLE; Schema: support; Owner: - +-- + +CREATE TABLE support.study_json_records ( + id integer NOT NULL, + nct_id character varying NOT NULL, + content jsonb NOT NULL, + saved_study_at timestamp without time zone, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL, + download_date character varying, + version character varying DEFAULT '1'::character varying +); + + +-- +-- Name: study_json_records_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- + +CREATE SEQUENCE support.study_json_records_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: study_json_records_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- + +ALTER SEQUENCE support.study_json_records_id_seq OWNED BY support.study_json_records.id; + + +-- +-- Name: study_statistics_comparisons; Type: TABLE; Schema: support; Owner: - +-- + +CREATE TABLE support.study_statistics_comparisons ( + id bigint NOT NULL, + ctgov_selector character varying, + "table" character varying, + "column" character varying, + condition character varying, + instances_query character varying, + unique_query character varying +); + + +-- +-- Name: study_statistics_comparisons_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- + +CREATE SEQUENCE support.study_statistics_comparisons_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: study_statistics_comparisons_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- + +ALTER SEQUENCE support.study_statistics_comparisons_id_seq OWNED BY support.study_statistics_comparisons.id; + + +-- +-- Name: study_xml_records; Type: TABLE; Schema: support; Owner: - +-- + +CREATE TABLE support.study_xml_records ( + id integer NOT NULL, + nct_id character varying, + content xml, + created_study_at timestamp without time zone, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL +); + + +-- +-- Name: study_xml_records_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- + +CREATE SEQUENCE support.study_xml_records_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: study_xml_records_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- + +ALTER SEQUENCE support.study_xml_records_id_seq OWNED BY support.study_xml_records.id; + + +-- +-- Name: verifiers; Type: TABLE; Schema: support; Owner: - +-- + +CREATE TABLE support.verifiers ( + id bigint NOT NULL, + differences json DEFAULT '[]'::json NOT NULL, + last_run timestamp without time zone, + source json, + created_at timestamp(6) without time zone NOT NULL, + updated_at timestamp(6) without time zone NOT NULL, + load_event_id integer +); + + +-- +-- Name: verifiers_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- + +CREATE SEQUENCE support.verifiers_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: verifiers_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- + +ALTER SEQUENCE support.verifiers_id_seq OWNED BY support.verifiers.id; + + +-- +-- Name: attachments id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.attachments ALTER COLUMN id SET DEFAULT nextval('ctgov.attachments_id_seq'::regclass); + + +-- +-- Name: baseline_counts id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.baseline_counts ALTER COLUMN id SET DEFAULT nextval('ctgov.baseline_counts_id_seq'::regclass); + + +-- +-- Name: baseline_measurements id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.baseline_measurements ALTER COLUMN id SET DEFAULT nextval('ctgov.baseline_measurements_id_seq'::regclass); + + +-- +-- Name: brief_summaries id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.brief_summaries ALTER COLUMN id SET DEFAULT nextval('ctgov.brief_summaries_id_seq'::regclass); + + +-- +-- Name: browse_conditions id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.browse_conditions ALTER COLUMN id SET DEFAULT nextval('ctgov.browse_conditions_id_seq'::regclass); + + +-- +-- Name: browse_interventions id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.browse_interventions ALTER COLUMN id SET DEFAULT nextval('ctgov.browse_interventions_id_seq'::regclass); + + +-- +-- Name: calculated_values id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.calculated_values ALTER COLUMN id SET DEFAULT nextval('ctgov.calculated_values_id_seq'::regclass); + + +-- +-- Name: central_contacts id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.central_contacts ALTER COLUMN id SET DEFAULT nextval('ctgov.central_contacts_id_seq'::regclass); + + +-- +-- Name: conditions id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.conditions ALTER COLUMN id SET DEFAULT nextval('ctgov.conditions_id_seq'::regclass); + + +-- +-- Name: countries id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.countries ALTER COLUMN id SET DEFAULT nextval('ctgov.countries_id_seq'::regclass); + + +-- +-- Name: data_definitions id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.data_definitions ALTER COLUMN id SET DEFAULT nextval('ctgov.data_definitions_id_seq'::regclass); + + +-- +-- Name: datasets id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.datasets ALTER COLUMN id SET DEFAULT nextval('ctgov.datasets_id_seq'::regclass); + + +-- +-- Name: db_user_activities id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.db_user_activities ALTER COLUMN id SET DEFAULT nextval('ctgov.db_user_activities_id_seq'::regclass); + + +-- +-- Name: design_group_interventions id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.design_group_interventions ALTER COLUMN id SET DEFAULT nextval('ctgov.design_group_interventions_id_seq'::regclass); + + +-- +-- Name: design_groups id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.design_groups ALTER COLUMN id SET DEFAULT nextval('ctgov.design_groups_id_seq'::regclass); + + +-- +-- Name: design_outcomes id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.design_outcomes ALTER COLUMN id SET DEFAULT nextval('ctgov.design_outcomes_id_seq'::regclass); + + +-- +-- Name: designs id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.designs ALTER COLUMN id SET DEFAULT nextval('ctgov.designs_id_seq'::regclass); + + +-- +-- Name: detailed_descriptions id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.detailed_descriptions ALTER COLUMN id SET DEFAULT nextval('ctgov.detailed_descriptions_id_seq'::regclass); + + +-- +-- Name: documents id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.documents ALTER COLUMN id SET DEFAULT nextval('ctgov.documents_id_seq'::regclass); + + +-- +-- Name: drop_withdrawals id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.drop_withdrawals ALTER COLUMN id SET DEFAULT nextval('ctgov.drop_withdrawals_id_seq'::regclass); + + +-- +-- Name: eligibilities id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.eligibilities ALTER COLUMN id SET DEFAULT nextval('ctgov.eligibilities_id_seq'::regclass); + + +-- +-- Name: enumerations id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.enumerations ALTER COLUMN id SET DEFAULT nextval('ctgov.enumerations_id_seq'::regclass); + + +-- +-- Name: facilities id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.facilities ALTER COLUMN id SET DEFAULT nextval('ctgov.facilities_id_seq'::regclass); + + +-- +-- Name: facility_contacts id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.facility_contacts ALTER COLUMN id SET DEFAULT nextval('ctgov.facility_contacts_id_seq'::regclass); + + +-- +-- Name: facility_investigators id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.facility_investigators ALTER COLUMN id SET DEFAULT nextval('ctgov.facility_investigators_id_seq'::regclass); + + +-- +-- Name: faqs id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.faqs ALTER COLUMN id SET DEFAULT nextval('ctgov.faqs_id_seq'::regclass); + + +-- +-- Name: file_downloads id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.file_downloads ALTER COLUMN id SET DEFAULT nextval('ctgov.file_downloads_id_seq'::regclass); + + +-- +-- Name: health_checks id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.health_checks ALTER COLUMN id SET DEFAULT nextval('ctgov.health_checks_id_seq'::regclass); + + +-- +-- Name: id_information id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.id_information ALTER COLUMN id SET DEFAULT nextval('ctgov.id_information_id_seq'::regclass); + + +-- +-- Name: intervention_other_names id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.intervention_other_names ALTER COLUMN id SET DEFAULT nextval('ctgov.intervention_other_names_id_seq'::regclass); + + +-- +-- Name: interventions id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.interventions ALTER COLUMN id SET DEFAULT nextval('ctgov.interventions_id_seq'::regclass); + + +-- +-- Name: ipd_information_types id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.ipd_information_types ALTER COLUMN id SET DEFAULT nextval('ctgov.ipd_information_types_id_seq'::regclass); + + +-- +-- Name: keywords id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.keywords ALTER COLUMN id SET DEFAULT nextval('ctgov.keywords_id_seq'::regclass); + + +-- +-- Name: links id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.links ALTER COLUMN id SET DEFAULT nextval('ctgov.links_id_seq'::regclass); + + +-- +-- Name: mesh_headings id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.mesh_headings ALTER COLUMN id SET DEFAULT nextval('ctgov.mesh_headings_id_seq'::regclass); + + +-- +-- Name: mesh_terms id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.mesh_terms ALTER COLUMN id SET DEFAULT nextval('ctgov.mesh_terms_id_seq'::regclass); + + +-- +-- Name: milestones id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.milestones ALTER COLUMN id SET DEFAULT nextval('ctgov.milestones_id_seq'::regclass); + + +-- +-- Name: notices id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.notices ALTER COLUMN id SET DEFAULT nextval('ctgov.notices_id_seq'::regclass); + + +-- +-- Name: outcome_analyses id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.outcome_analyses ALTER COLUMN id SET DEFAULT nextval('ctgov.outcome_analyses_id_seq'::regclass); + + +-- +-- Name: outcome_analysis_groups id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.outcome_analysis_groups ALTER COLUMN id SET DEFAULT nextval('ctgov.outcome_analysis_groups_id_seq'::regclass); + + +-- +-- Name: outcome_counts id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.outcome_counts ALTER COLUMN id SET DEFAULT nextval('ctgov.outcome_counts_id_seq'::regclass); + + +-- +-- Name: outcome_measurements id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.outcome_measurements ALTER COLUMN id SET DEFAULT nextval('ctgov.outcome_measurements_id_seq'::regclass); + + +-- +-- Name: outcomes id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.outcomes ALTER COLUMN id SET DEFAULT nextval('ctgov.outcomes_id_seq'::regclass); + + +-- +-- Name: overall_officials id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.overall_officials ALTER COLUMN id SET DEFAULT nextval('ctgov.overall_officials_id_seq'::regclass); + + +-- +-- Name: participant_flows id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.participant_flows ALTER COLUMN id SET DEFAULT nextval('ctgov.participant_flows_id_seq'::regclass); + + +-- +-- Name: pending_results id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.pending_results ALTER COLUMN id SET DEFAULT nextval('ctgov.pending_results_id_seq'::regclass); + + +-- +-- Name: projects id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.projects ALTER COLUMN id SET DEFAULT nextval('ctgov.projects_id_seq'::regclass); + + +-- +-- Name: provided_documents id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.provided_documents ALTER COLUMN id SET DEFAULT nextval('ctgov.provided_documents_id_seq'::regclass); + + +-- +-- Name: public_announcements id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.public_announcements ALTER COLUMN id SET DEFAULT nextval('ctgov.public_announcements_id_seq'::regclass); + + +-- +-- Name: publications id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.publications ALTER COLUMN id SET DEFAULT nextval('ctgov.publications_id_seq'::regclass); + + +-- +-- Name: releases id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.releases ALTER COLUMN id SET DEFAULT nextval('ctgov.releases_id_seq'::regclass); + + +-- +-- Name: reported_event_totals id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.reported_event_totals ALTER COLUMN id SET DEFAULT nextval('ctgov.reported_event_totals_id_seq'::regclass); + + +-- +-- Name: reported_events id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.reported_events ALTER COLUMN id SET DEFAULT nextval('ctgov.reported_events_id_seq'::regclass); + + +-- +-- Name: responsible_parties id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.responsible_parties ALTER COLUMN id SET DEFAULT nextval('ctgov.responsible_parties_id_seq'::regclass); + + +-- +-- Name: result_agreements id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.result_agreements ALTER COLUMN id SET DEFAULT nextval('ctgov.result_agreements_id_seq'::regclass); + + +-- +-- Name: result_contacts id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.result_contacts ALTER COLUMN id SET DEFAULT nextval('ctgov.result_contacts_id_seq'::regclass); + + +-- +-- Name: result_groups id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.result_groups ALTER COLUMN id SET DEFAULT nextval('ctgov.result_groups_id_seq'::regclass); + + +-- +-- Name: retractions id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.retractions ALTER COLUMN id SET DEFAULT nextval('ctgov.retractions_id_seq'::regclass); + + +-- +-- Name: saved_queries id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.saved_queries ALTER COLUMN id SET DEFAULT nextval('ctgov.saved_queries_id_seq'::regclass); + + +-- +-- Name: search_results id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.search_results ALTER COLUMN id SET DEFAULT nextval('ctgov.search_results_id_seq'::regclass); + + +-- +-- Name: sponsors id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.sponsors ALTER COLUMN id SET DEFAULT nextval('ctgov.sponsors_id_seq'::regclass); + + +-- +-- Name: study_records id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.study_records ALTER COLUMN id SET DEFAULT nextval('ctgov.study_records_id_seq'::regclass); + + +-- +-- Name: study_references id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.study_references ALTER COLUMN id SET DEFAULT nextval('ctgov.study_references_id_seq'::regclass); + + +-- +-- Name: study_searches id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.study_searches ALTER COLUMN id SET DEFAULT nextval('ctgov.study_searches_id_seq'::regclass); + + +-- +-- Name: use_case_attachments id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.use_case_attachments ALTER COLUMN id SET DEFAULT nextval('ctgov.use_case_attachments_id_seq'::regclass); + + +-- +-- Name: use_case_datasets id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.use_case_datasets ALTER COLUMN id SET DEFAULT nextval('ctgov.use_case_datasets_id_seq'::regclass); + + +-- +-- Name: use_case_publications id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.use_case_publications ALTER COLUMN id SET DEFAULT nextval('ctgov.use_case_publications_id_seq'::regclass); + + +-- +-- Name: use_cases id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.use_cases ALTER COLUMN id SET DEFAULT nextval('ctgov.use_cases_id_seq'::regclass); + + +-- +-- Name: user_events id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.user_events ALTER COLUMN id SET DEFAULT nextval('ctgov.user_events_id_seq'::regclass); + + +-- +-- Name: users id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.users ALTER COLUMN id SET DEFAULT nextval('ctgov.users_id_seq'::regclass); + + +-- +-- Name: baseline_counts id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.baseline_counts ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.baseline_counts_id_seq'::regclass); + + +-- +-- Name: baseline_measurements id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.baseline_measurements ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.baseline_measurements_id_seq'::regclass); + + +-- +-- Name: brief_summaries id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.brief_summaries ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.brief_summaries_id_seq'::regclass); + + +-- +-- Name: browse_conditions id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.browse_conditions ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.browse_conditions_id_seq'::regclass); + + +-- +-- Name: browse_interventions id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.browse_interventions ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.browse_interventions_id_seq'::regclass); + + +-- +-- Name: calculated_values id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.calculated_values ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.calculated_values_id_seq'::regclass); + + +-- +-- Name: central_contacts id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.central_contacts ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.central_contacts_id_seq'::regclass); + + +-- +-- Name: conditions id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.conditions ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.conditions_id_seq'::regclass); + + +-- +-- Name: countries id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.countries ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.countries_id_seq'::regclass); + + +-- +-- Name: design_group_interventions id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.design_group_interventions ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.design_group_interventions_id_seq'::regclass); + + +-- +-- Name: design_groups id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.design_groups ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.design_groups_id_seq'::regclass); + + +-- +-- Name: design_outcomes id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.design_outcomes ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.design_outcomes_id_seq'::regclass); + + +-- +-- Name: designs id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.designs ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.designs_id_seq'::regclass); + + +-- +-- Name: detailed_descriptions id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.detailed_descriptions ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.detailed_descriptions_id_seq'::regclass); + + +-- +-- Name: documents id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.documents ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.documents_id_seq'::regclass); + + +-- +-- Name: drop_withdrawals id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.drop_withdrawals ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.drop_withdrawals_id_seq'::regclass); + + +-- +-- Name: eligibilities id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.eligibilities ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.eligibilities_id_seq'::regclass); + + +-- +-- Name: facilities id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.facilities ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.facilities_id_seq'::regclass); + + +-- +-- Name: facility_contacts id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.facility_contacts ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.facility_contacts_id_seq'::regclass); + + +-- +-- Name: facility_investigators id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.facility_investigators ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.facility_investigators_id_seq'::regclass); + + +-- +-- Name: id_information id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.id_information ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.id_information_id_seq'::regclass); + + +-- +-- Name: intervention_other_names id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.intervention_other_names ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.intervention_other_names_id_seq'::regclass); + + +-- +-- Name: interventions id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.interventions ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.interventions_id_seq'::regclass); + + +-- +-- Name: ipd_information_types id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.ipd_information_types ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.ipd_information_types_id_seq'::regclass); + + +-- +-- Name: keywords id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.keywords ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.keywords_id_seq'::regclass); + + +-- +-- Name: links id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.links ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.links_id_seq'::regclass); + + +-- +-- Name: mesh_headings id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.mesh_headings ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.mesh_headings_id_seq'::regclass); + + +-- +-- Name: mesh_terms id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.mesh_terms ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.mesh_terms_id_seq'::regclass); + + +-- +-- Name: milestones id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.milestones ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.milestones_id_seq'::regclass); + + +-- +-- Name: outcome_analyses id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.outcome_analyses ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.outcome_analyses_id_seq'::regclass); + + +-- +-- Name: outcome_analysis_groups id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.outcome_analysis_groups ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.outcome_analysis_groups_id_seq'::regclass); + + +-- +-- Name: outcome_counts id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.outcome_counts ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.outcome_counts_id_seq'::regclass); + + +-- +-- Name: outcome_measurements id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.outcome_measurements ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.outcome_measurements_id_seq'::regclass); + + +-- +-- Name: outcomes id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.outcomes ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.outcomes_id_seq'::regclass); + + +-- +-- Name: overall_officials id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.overall_officials ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.overall_officials_id_seq'::regclass); + + +-- +-- Name: participant_flows id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.participant_flows ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.participant_flows_id_seq'::regclass); + + +-- +-- Name: pending_results id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.pending_results ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.pending_results_id_seq'::regclass); + + +-- +-- Name: provided_documents id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.provided_documents ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.provided_documents_id_seq'::regclass); + + +-- +-- Name: reported_event_totals id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.reported_event_totals ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.reported_event_totals_id_seq'::regclass); + + +-- +-- Name: reported_events id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.reported_events ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.reported_events_id_seq'::regclass); + + +-- +-- Name: responsible_parties id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.responsible_parties ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.responsible_parties_id_seq'::regclass); + + +-- +-- Name: result_agreements id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.result_agreements ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.result_agreements_id_seq'::regclass); + + +-- +-- Name: result_contacts id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.result_contacts ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.result_contacts_id_seq'::regclass); + + +-- +-- Name: result_groups id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.result_groups ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.result_groups_id_seq'::regclass); + + +-- +-- Name: retractions id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.retractions ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.retractions_id_seq'::regclass); + + +-- +-- Name: search_results id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.search_results ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.search_results_id_seq'::regclass); + + +-- +-- Name: sponsors id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.sponsors ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.sponsors_id_seq'::regclass); + + +-- +-- Name: study_records id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.study_records ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.study_records_id_seq'::regclass); + + +-- +-- Name: study_references id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.study_references ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.study_references_id_seq'::regclass); + + +-- +-- Name: study_searches id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.study_searches ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.study_searches_id_seq'::regclass); + + +-- +-- Name: active_storage_attachments id; Type: DEFAULT; Schema: support; Owner: - +-- + +ALTER TABLE ONLY support.active_storage_attachments ALTER COLUMN id SET DEFAULT nextval('support.active_storage_attachments_id_seq'::regclass); + + +-- +-- Name: active_storage_blobs id; Type: DEFAULT; Schema: support; Owner: - +-- + +ALTER TABLE ONLY support.active_storage_blobs ALTER COLUMN id SET DEFAULT nextval('support.active_storage_blobs_id_seq'::regclass); + + +-- +-- Name: background_jobs id; Type: DEFAULT; Schema: support; Owner: - +-- + +ALTER TABLE ONLY support.background_jobs ALTER COLUMN id SET DEFAULT nextval('support.background_jobs_id_seq'::regclass); + + +-- +-- Name: file_records id; Type: DEFAULT; Schema: support; Owner: - +-- + +ALTER TABLE ONLY support.file_records ALTER COLUMN id SET DEFAULT nextval('support.file_records_id_seq'::regclass); + + +-- +-- Name: load_events id; Type: DEFAULT; Schema: support; Owner: - +-- + +ALTER TABLE ONLY support.load_events ALTER COLUMN id SET DEFAULT nextval('support.load_events_id_seq'::regclass); + + +-- +-- Name: load_issues id; Type: DEFAULT; Schema: support; Owner: - +-- + +ALTER TABLE ONLY support.load_issues ALTER COLUMN id SET DEFAULT nextval('support.load_issues_id_seq'::regclass); + + +-- +-- Name: sanity_checks id; Type: DEFAULT; Schema: support; Owner: - +-- + +ALTER TABLE ONLY support.sanity_checks ALTER COLUMN id SET DEFAULT nextval('support.sanity_checks_id_seq'::regclass); + + +-- +-- Name: study_json_records id; Type: DEFAULT; Schema: support; Owner: - +-- + +ALTER TABLE ONLY support.study_json_records ALTER COLUMN id SET DEFAULT nextval('support.study_json_records_id_seq'::regclass); + + +-- +-- Name: study_statistics_comparisons id; Type: DEFAULT; Schema: support; Owner: - +-- + +ALTER TABLE ONLY support.study_statistics_comparisons ALTER COLUMN id SET DEFAULT nextval('support.study_statistics_comparisons_id_seq'::regclass); + + +-- +-- Name: study_xml_records id; Type: DEFAULT; Schema: support; Owner: - +-- + +ALTER TABLE ONLY support.study_xml_records ALTER COLUMN id SET DEFAULT nextval('support.study_xml_records_id_seq'::regclass); + + +-- +-- Name: verifiers id; Type: DEFAULT; Schema: support; Owner: - +-- + +ALTER TABLE ONLY support.verifiers ALTER COLUMN id SET DEFAULT nextval('support.verifiers_id_seq'::regclass); + + +-- +-- Name: attachments attachments_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.attachments + ADD CONSTRAINT attachments_pkey PRIMARY KEY (id); + + +-- +-- Name: baseline_counts baseline_counts_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.baseline_counts + ADD CONSTRAINT baseline_counts_pkey PRIMARY KEY (id); + + +-- +-- Name: baseline_measurements baseline_measurements_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.baseline_measurements + ADD CONSTRAINT baseline_measurements_pkey PRIMARY KEY (id); + + +-- +-- Name: brief_summaries brief_summaries_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.brief_summaries + ADD CONSTRAINT brief_summaries_pkey PRIMARY KEY (id); + + +-- +-- Name: browse_conditions browse_conditions_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.browse_conditions + ADD CONSTRAINT browse_conditions_pkey PRIMARY KEY (id); + + +-- +-- Name: browse_interventions browse_interventions_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.browse_interventions + ADD CONSTRAINT browse_interventions_pkey PRIMARY KEY (id); + + +-- +-- Name: calculated_values calculated_values_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.calculated_values + ADD CONSTRAINT calculated_values_pkey PRIMARY KEY (id); + + +-- +-- Name: central_contacts central_contacts_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.central_contacts + ADD CONSTRAINT central_contacts_pkey PRIMARY KEY (id); + + +-- +-- Name: conditions conditions_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.conditions + ADD CONSTRAINT conditions_pkey PRIMARY KEY (id); + + +-- +-- Name: countries countries_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.countries + ADD CONSTRAINT countries_pkey PRIMARY KEY (id); + + +-- +-- Name: data_definitions data_definitions_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.data_definitions + ADD CONSTRAINT data_definitions_pkey PRIMARY KEY (id); + + +-- +-- Name: datasets datasets_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.datasets + ADD CONSTRAINT datasets_pkey PRIMARY KEY (id); + + +-- +-- Name: db_user_activities db_user_activities_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.db_user_activities + ADD CONSTRAINT db_user_activities_pkey PRIMARY KEY (id); + + +-- +-- Name: design_group_interventions design_group_interventions_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.design_group_interventions + ADD CONSTRAINT design_group_interventions_pkey PRIMARY KEY (id); + + +-- +-- Name: design_groups design_groups_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.design_groups + ADD CONSTRAINT design_groups_pkey PRIMARY KEY (id); + + +-- +-- Name: design_outcomes design_outcomes_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.design_outcomes + ADD CONSTRAINT design_outcomes_pkey PRIMARY KEY (id); + + +-- +-- Name: designs designs_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.designs + ADD CONSTRAINT designs_pkey PRIMARY KEY (id); + + +-- +-- Name: detailed_descriptions detailed_descriptions_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.detailed_descriptions + ADD CONSTRAINT detailed_descriptions_pkey PRIMARY KEY (id); + + +-- +-- Name: documents documents_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.documents + ADD CONSTRAINT documents_pkey PRIMARY KEY (id); + + +-- +-- Name: drop_withdrawals drop_withdrawals_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.drop_withdrawals + ADD CONSTRAINT drop_withdrawals_pkey PRIMARY KEY (id); + + +-- +-- Name: eligibilities eligibilities_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.eligibilities + ADD CONSTRAINT eligibilities_pkey PRIMARY KEY (id); + + +-- +-- Name: enumerations enumerations_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.enumerations + ADD CONSTRAINT enumerations_pkey PRIMARY KEY (id); + + +-- +-- Name: facilities facilities_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.facilities + ADD CONSTRAINT facilities_pkey PRIMARY KEY (id); + + +-- +-- Name: facility_contacts facility_contacts_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.facility_contacts + ADD CONSTRAINT facility_contacts_pkey PRIMARY KEY (id); + + +-- +-- Name: facility_investigators facility_investigators_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.facility_investigators + ADD CONSTRAINT facility_investigators_pkey PRIMARY KEY (id); + + +-- +-- Name: faqs faqs_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.faqs + ADD CONSTRAINT faqs_pkey PRIMARY KEY (id); + + +-- +-- Name: file_downloads file_downloads_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.file_downloads + ADD CONSTRAINT file_downloads_pkey PRIMARY KEY (id); + + +-- +-- Name: health_checks health_checks_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.health_checks + ADD CONSTRAINT health_checks_pkey PRIMARY KEY (id); + + +-- +-- Name: id_information id_information_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.id_information + ADD CONSTRAINT id_information_pkey PRIMARY KEY (id); + + +-- +-- Name: intervention_other_names intervention_other_names_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.intervention_other_names + ADD CONSTRAINT intervention_other_names_pkey PRIMARY KEY (id); + + +-- +-- Name: interventions interventions_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.interventions + ADD CONSTRAINT interventions_pkey PRIMARY KEY (id); + + +-- +-- Name: ipd_information_types ipd_information_types_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.ipd_information_types + ADD CONSTRAINT ipd_information_types_pkey PRIMARY KEY (id); + + +-- +-- Name: keywords keywords_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.keywords + ADD CONSTRAINT keywords_pkey PRIMARY KEY (id); + + +-- +-- Name: links links_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.links + ADD CONSTRAINT links_pkey PRIMARY KEY (id); + + +-- +-- Name: mesh_headings mesh_headings_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.mesh_headings + ADD CONSTRAINT mesh_headings_pkey PRIMARY KEY (id); + + +-- +-- Name: mesh_terms mesh_terms_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.mesh_terms + ADD CONSTRAINT mesh_terms_pkey PRIMARY KEY (id); + + +-- +-- Name: milestones milestones_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.milestones + ADD CONSTRAINT milestones_pkey PRIMARY KEY (id); + + +-- +-- Name: notices notices_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.notices + ADD CONSTRAINT notices_pkey PRIMARY KEY (id); + + +-- +-- Name: outcome_analyses outcome_analyses_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.outcome_analyses + ADD CONSTRAINT outcome_analyses_pkey PRIMARY KEY (id); + + +-- +-- Name: outcome_analysis_groups outcome_analysis_groups_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.outcome_analysis_groups + ADD CONSTRAINT outcome_analysis_groups_pkey PRIMARY KEY (id); + + +-- +-- Name: outcome_counts outcome_counts_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.outcome_counts + ADD CONSTRAINT outcome_counts_pkey PRIMARY KEY (id); + + +-- +-- Name: outcome_measurements outcome_measurements_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.outcome_measurements + ADD CONSTRAINT outcome_measurements_pkey PRIMARY KEY (id); + + +-- +-- Name: outcomes outcomes_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.outcomes + ADD CONSTRAINT outcomes_pkey PRIMARY KEY (id); + + +-- +-- Name: overall_officials overall_officials_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.overall_officials + ADD CONSTRAINT overall_officials_pkey PRIMARY KEY (id); + + +-- +-- Name: participant_flows participant_flows_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.participant_flows + ADD CONSTRAINT participant_flows_pkey PRIMARY KEY (id); + + +-- +-- Name: pending_results pending_results_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.pending_results + ADD CONSTRAINT pending_results_pkey PRIMARY KEY (id); + + +-- +-- Name: projects projects_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.projects + ADD CONSTRAINT projects_pkey PRIMARY KEY (id); + + +-- +-- Name: provided_documents provided_documents_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.provided_documents + ADD CONSTRAINT provided_documents_pkey PRIMARY KEY (id); + + +-- +-- Name: public_announcements public_announcements_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.public_announcements + ADD CONSTRAINT public_announcements_pkey PRIMARY KEY (id); + + +-- +-- Name: publications publications_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.publications + ADD CONSTRAINT publications_pkey PRIMARY KEY (id); + + +-- +-- Name: releases releases_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.releases + ADD CONSTRAINT releases_pkey PRIMARY KEY (id); + + +-- +-- Name: reported_event_totals reported_event_totals_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.reported_event_totals + ADD CONSTRAINT reported_event_totals_pkey PRIMARY KEY (id); + + +-- +-- Name: reported_events reported_events_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.reported_events + ADD CONSTRAINT reported_events_pkey PRIMARY KEY (id); + + +-- +-- Name: responsible_parties responsible_parties_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.responsible_parties + ADD CONSTRAINT responsible_parties_pkey PRIMARY KEY (id); + + +-- +-- Name: result_agreements result_agreements_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.result_agreements + ADD CONSTRAINT result_agreements_pkey PRIMARY KEY (id); + + +-- +-- Name: result_contacts result_contacts_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.result_contacts + ADD CONSTRAINT result_contacts_pkey PRIMARY KEY (id); + + +-- +-- Name: result_groups result_groups_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.result_groups + ADD CONSTRAINT result_groups_pkey PRIMARY KEY (id); + + +-- +-- Name: retractions retractions_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.retractions + ADD CONSTRAINT retractions_pkey PRIMARY KEY (id); + + +-- +-- Name: saved_queries saved_queries_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.saved_queries + ADD CONSTRAINT saved_queries_pkey PRIMARY KEY (id); + + +-- +-- Name: search_results search_results_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.search_results + ADD CONSTRAINT search_results_pkey PRIMARY KEY (id); + + +-- +-- Name: sponsors sponsors_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.sponsors + ADD CONSTRAINT sponsors_pkey PRIMARY KEY (id); + + +-- +-- Name: study_records study_records_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.study_records + ADD CONSTRAINT study_records_pkey PRIMARY KEY (id); + + +-- +-- Name: study_references study_references_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.study_references + ADD CONSTRAINT study_references_pkey PRIMARY KEY (id); + + +-- +-- Name: study_searches study_searches_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.study_searches + ADD CONSTRAINT study_searches_pkey PRIMARY KEY (id); + + +-- +-- Name: use_case_attachments use_case_attachments_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.use_case_attachments + ADD CONSTRAINT use_case_attachments_pkey PRIMARY KEY (id); + + +-- +-- Name: use_case_datasets use_case_datasets_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.use_case_datasets + ADD CONSTRAINT use_case_datasets_pkey PRIMARY KEY (id); + + +-- +-- Name: use_case_publications use_case_publications_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.use_case_publications + ADD CONSTRAINT use_case_publications_pkey PRIMARY KEY (id); + + +-- +-- Name: use_cases use_cases_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.use_cases + ADD CONSTRAINT use_cases_pkey PRIMARY KEY (id); + + +-- +-- Name: user_events user_events_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.user_events + ADD CONSTRAINT user_events_pkey PRIMARY KEY (id); + + +-- +-- Name: users users_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.users + ADD CONSTRAINT users_pkey PRIMARY KEY (id); + + +-- +-- Name: baseline_counts baseline_counts_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.baseline_counts + ADD CONSTRAINT baseline_counts_pkey PRIMARY KEY (id); + + +-- +-- Name: baseline_measurements baseline_measurements_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.baseline_measurements + ADD CONSTRAINT baseline_measurements_pkey PRIMARY KEY (id); + + +-- +-- Name: brief_summaries brief_summaries_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.brief_summaries + ADD CONSTRAINT brief_summaries_pkey PRIMARY KEY (id); + + +-- +-- Name: browse_conditions browse_conditions_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.browse_conditions + ADD CONSTRAINT browse_conditions_pkey PRIMARY KEY (id); + + +-- +-- Name: browse_interventions browse_interventions_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.browse_interventions + ADD CONSTRAINT browse_interventions_pkey PRIMARY KEY (id); + + +-- +-- Name: calculated_values calculated_values_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.calculated_values + ADD CONSTRAINT calculated_values_pkey PRIMARY KEY (id); + + +-- +-- Name: central_contacts central_contacts_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.central_contacts + ADD CONSTRAINT central_contacts_pkey PRIMARY KEY (id); + + +-- +-- Name: conditions conditions_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.conditions + ADD CONSTRAINT conditions_pkey PRIMARY KEY (id); + + +-- +-- Name: countries countries_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.countries + ADD CONSTRAINT countries_pkey PRIMARY KEY (id); + + +-- +-- Name: design_group_interventions design_group_interventions_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.design_group_interventions + ADD CONSTRAINT design_group_interventions_pkey PRIMARY KEY (id); + + +-- +-- Name: design_groups design_groups_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.design_groups + ADD CONSTRAINT design_groups_pkey PRIMARY KEY (id); + + +-- +-- Name: design_outcomes design_outcomes_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.design_outcomes + ADD CONSTRAINT design_outcomes_pkey PRIMARY KEY (id); + + +-- +-- Name: designs designs_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.designs + ADD CONSTRAINT designs_pkey PRIMARY KEY (id); + + +-- +-- Name: detailed_descriptions detailed_descriptions_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.detailed_descriptions + ADD CONSTRAINT detailed_descriptions_pkey PRIMARY KEY (id); + + +-- +-- Name: documents documents_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.documents + ADD CONSTRAINT documents_pkey PRIMARY KEY (id); + + +-- +-- Name: drop_withdrawals drop_withdrawals_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.drop_withdrawals + ADD CONSTRAINT drop_withdrawals_pkey PRIMARY KEY (id); + + +-- +-- Name: eligibilities eligibilities_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.eligibilities + ADD CONSTRAINT eligibilities_pkey PRIMARY KEY (id); + + +-- +-- Name: facilities facilities_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.facilities + ADD CONSTRAINT facilities_pkey PRIMARY KEY (id); + + +-- +-- Name: facility_contacts facility_contacts_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.facility_contacts + ADD CONSTRAINT facility_contacts_pkey PRIMARY KEY (id); + + +-- +-- Name: facility_investigators facility_investigators_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.facility_investigators + ADD CONSTRAINT facility_investigators_pkey PRIMARY KEY (id); + + +-- +-- Name: id_information id_information_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.id_information + ADD CONSTRAINT id_information_pkey PRIMARY KEY (id); + + +-- +-- Name: intervention_other_names intervention_other_names_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.intervention_other_names + ADD CONSTRAINT intervention_other_names_pkey PRIMARY KEY (id); + + +-- +-- Name: interventions interventions_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.interventions + ADD CONSTRAINT interventions_pkey PRIMARY KEY (id); + + +-- +-- Name: ipd_information_types ipd_information_types_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.ipd_information_types + ADD CONSTRAINT ipd_information_types_pkey PRIMARY KEY (id); + + +-- +-- Name: keywords keywords_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.keywords + ADD CONSTRAINT keywords_pkey PRIMARY KEY (id); + + +-- +-- Name: links links_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.links + ADD CONSTRAINT links_pkey PRIMARY KEY (id); + + +-- +-- Name: mesh_headings mesh_headings_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.mesh_headings + ADD CONSTRAINT mesh_headings_pkey PRIMARY KEY (id); + + +-- +-- Name: mesh_terms mesh_terms_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.mesh_terms + ADD CONSTRAINT mesh_terms_pkey PRIMARY KEY (id); + + +-- +-- Name: milestones milestones_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.milestones + ADD CONSTRAINT milestones_pkey PRIMARY KEY (id); + + +-- +-- Name: outcome_analyses outcome_analyses_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.outcome_analyses + ADD CONSTRAINT outcome_analyses_pkey PRIMARY KEY (id); + + +-- +-- Name: outcome_analysis_groups outcome_analysis_groups_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.outcome_analysis_groups + ADD CONSTRAINT outcome_analysis_groups_pkey PRIMARY KEY (id); + + +-- +-- Name: outcome_counts outcome_counts_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.outcome_counts + ADD CONSTRAINT outcome_counts_pkey PRIMARY KEY (id); + + +-- +-- Name: outcome_measurements outcome_measurements_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.outcome_measurements + ADD CONSTRAINT outcome_measurements_pkey PRIMARY KEY (id); + + +-- +-- Name: outcomes outcomes_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.outcomes + ADD CONSTRAINT outcomes_pkey PRIMARY KEY (id); + + +-- +-- Name: overall_officials overall_officials_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.overall_officials + ADD CONSTRAINT overall_officials_pkey PRIMARY KEY (id); + + +-- +-- Name: participant_flows participant_flows_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER SEQUENCE support.study_xml_records_id_seq OWNED BY support.study_xml_records.id; +ALTER TABLE ONLY ctgov_v2.participant_flows + ADD CONSTRAINT participant_flows_pkey PRIMARY KEY (id); -- --- Name: verifiers; Type: TABLE; Schema: support; Owner: - +-- Name: pending_results pending_results_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -CREATE TABLE support.verifiers ( - id bigint NOT NULL, - differences json DEFAULT '[]'::json NOT NULL, - last_run timestamp without time zone, - source json, - created_at timestamp(6) without time zone NOT NULL, - updated_at timestamp(6) without time zone NOT NULL, - load_event_id integer -); +ALTER TABLE ONLY ctgov_v2.pending_results + ADD CONSTRAINT pending_results_pkey PRIMARY KEY (id); -- --- Name: verifiers_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- Name: provided_documents provided_documents_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -CREATE SEQUENCE support.verifiers_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; +ALTER TABLE ONLY ctgov_v2.provided_documents + ADD CONSTRAINT provided_documents_pkey PRIMARY KEY (id); -- --- Name: verifiers_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- Name: reported_event_totals reported_event_totals_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER SEQUENCE support.verifiers_id_seq OWNED BY support.verifiers.id; +ALTER TABLE ONLY ctgov_v2.reported_event_totals + ADD CONSTRAINT reported_event_totals_pkey PRIMARY KEY (id); -- --- Name: baseline_counts id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: reported_events reported_events_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER TABLE ONLY ctgov.baseline_counts ALTER COLUMN id SET DEFAULT nextval('ctgov.baseline_counts_id_seq'::regclass); +ALTER TABLE ONLY ctgov_v2.reported_events + ADD CONSTRAINT reported_events_pkey PRIMARY KEY (id); -- --- Name: baseline_measurements id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: responsible_parties responsible_parties_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER TABLE ONLY ctgov.baseline_measurements ALTER COLUMN id SET DEFAULT nextval('ctgov.baseline_measurements_id_seq'::regclass); +ALTER TABLE ONLY ctgov_v2.responsible_parties + ADD CONSTRAINT responsible_parties_pkey PRIMARY KEY (id); -- --- Name: brief_summaries id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: result_agreements result_agreements_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER TABLE ONLY ctgov.brief_summaries ALTER COLUMN id SET DEFAULT nextval('ctgov.brief_summaries_id_seq'::regclass); +ALTER TABLE ONLY ctgov_v2.result_agreements + ADD CONSTRAINT result_agreements_pkey PRIMARY KEY (id); -- --- Name: browse_conditions id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: result_contacts result_contacts_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER TABLE ONLY ctgov.browse_conditions ALTER COLUMN id SET DEFAULT nextval('ctgov.browse_conditions_id_seq'::regclass); +ALTER TABLE ONLY ctgov_v2.result_contacts + ADD CONSTRAINT result_contacts_pkey PRIMARY KEY (id); -- --- Name: browse_interventions id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: result_groups result_groups_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER TABLE ONLY ctgov.browse_interventions ALTER COLUMN id SET DEFAULT nextval('ctgov.browse_interventions_id_seq'::regclass); +ALTER TABLE ONLY ctgov_v2.result_groups + ADD CONSTRAINT result_groups_pkey PRIMARY KEY (id); -- --- Name: calculated_values id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: retractions retractions_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER TABLE ONLY ctgov.calculated_values ALTER COLUMN id SET DEFAULT nextval('ctgov.calculated_values_id_seq'::regclass); +ALTER TABLE ONLY ctgov_v2.retractions + ADD CONSTRAINT retractions_pkey PRIMARY KEY (id); -- --- Name: central_contacts id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: search_results search_results_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER TABLE ONLY ctgov.central_contacts ALTER COLUMN id SET DEFAULT nextval('ctgov.central_contacts_id_seq'::regclass); +ALTER TABLE ONLY ctgov_v2.search_results + ADD CONSTRAINT search_results_pkey PRIMARY KEY (id); -- --- Name: conditions id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: sponsors sponsors_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER TABLE ONLY ctgov.conditions ALTER COLUMN id SET DEFAULT nextval('ctgov.conditions_id_seq'::regclass); +ALTER TABLE ONLY ctgov_v2.sponsors + ADD CONSTRAINT sponsors_pkey PRIMARY KEY (id); -- --- Name: countries id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: study_records study_records_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER TABLE ONLY ctgov.countries ALTER COLUMN id SET DEFAULT nextval('ctgov.countries_id_seq'::regclass); +ALTER TABLE ONLY ctgov_v2.study_records + ADD CONSTRAINT study_records_pkey PRIMARY KEY (id); -- --- Name: design_group_interventions id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: study_references study_references_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER TABLE ONLY ctgov.design_group_interventions ALTER COLUMN id SET DEFAULT nextval('ctgov.design_group_interventions_id_seq'::regclass); +ALTER TABLE ONLY ctgov_v2.study_references + ADD CONSTRAINT study_references_pkey PRIMARY KEY (id); -- --- Name: design_groups id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: study_searches study_searches_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER TABLE ONLY ctgov.design_groups ALTER COLUMN id SET DEFAULT nextval('ctgov.design_groups_id_seq'::regclass); +ALTER TABLE ONLY ctgov_v2.study_searches + ADD CONSTRAINT study_searches_pkey PRIMARY KEY (id); -- --- Name: design_outcomes id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: ar_internal_metadata ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY ctgov.design_outcomes ALTER COLUMN id SET DEFAULT nextval('ctgov.design_outcomes_id_seq'::regclass); +ALTER TABLE ONLY public.ar_internal_metadata + ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key); -- --- Name: designs id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY ctgov.designs ALTER COLUMN id SET DEFAULT nextval('ctgov.designs_id_seq'::regclass); +ALTER TABLE ONLY public.schema_migrations + ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version); -- --- Name: detailed_descriptions id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: active_storage_attachments active_storage_attachments_pkey; Type: CONSTRAINT; Schema: support; Owner: - -- -ALTER TABLE ONLY ctgov.detailed_descriptions ALTER COLUMN id SET DEFAULT nextval('ctgov.detailed_descriptions_id_seq'::regclass); +ALTER TABLE ONLY support.active_storage_attachments + ADD CONSTRAINT active_storage_attachments_pkey PRIMARY KEY (id); -- --- Name: documents id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: active_storage_blobs active_storage_blobs_pkey; Type: CONSTRAINT; Schema: support; Owner: - -- -ALTER TABLE ONLY ctgov.documents ALTER COLUMN id SET DEFAULT nextval('ctgov.documents_id_seq'::regclass); +ALTER TABLE ONLY support.active_storage_blobs + ADD CONSTRAINT active_storage_blobs_pkey PRIMARY KEY (id); -- --- Name: drop_withdrawals id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: background_jobs background_jobs_pkey; Type: CONSTRAINT; Schema: support; Owner: - -- -ALTER TABLE ONLY ctgov.drop_withdrawals ALTER COLUMN id SET DEFAULT nextval('ctgov.drop_withdrawals_id_seq'::regclass); +ALTER TABLE ONLY support.background_jobs + ADD CONSTRAINT background_jobs_pkey PRIMARY KEY (id); -- --- Name: eligibilities id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: file_records file_records_pkey; Type: CONSTRAINT; Schema: support; Owner: - -- -ALTER TABLE ONLY ctgov.eligibilities ALTER COLUMN id SET DEFAULT nextval('ctgov.eligibilities_id_seq'::regclass); +ALTER TABLE ONLY support.file_records + ADD CONSTRAINT file_records_pkey PRIMARY KEY (id); -- --- Name: facilities id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: load_events load_events_pkey; Type: CONSTRAINT; Schema: support; Owner: - -- -ALTER TABLE ONLY ctgov.facilities ALTER COLUMN id SET DEFAULT nextval('ctgov.facilities_id_seq'::regclass); +ALTER TABLE ONLY support.load_events + ADD CONSTRAINT load_events_pkey PRIMARY KEY (id); -- --- Name: facility_contacts id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: load_issues load_issues_pkey; Type: CONSTRAINT; Schema: support; Owner: - -- -ALTER TABLE ONLY ctgov.facility_contacts ALTER COLUMN id SET DEFAULT nextval('ctgov.facility_contacts_id_seq'::regclass); +ALTER TABLE ONLY support.load_issues + ADD CONSTRAINT load_issues_pkey PRIMARY KEY (id); -- --- Name: facility_investigators id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: sanity_checks sanity_checks_pkey; Type: CONSTRAINT; Schema: support; Owner: - -- -ALTER TABLE ONLY ctgov.facility_investigators ALTER COLUMN id SET DEFAULT nextval('ctgov.facility_investigators_id_seq'::regclass); +ALTER TABLE ONLY support.sanity_checks + ADD CONSTRAINT sanity_checks_pkey PRIMARY KEY (id); -- --- Name: id_information id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: study_json_records study_json_records_pkey; Type: CONSTRAINT; Schema: support; Owner: - -- -ALTER TABLE ONLY ctgov.id_information ALTER COLUMN id SET DEFAULT nextval('ctgov.id_information_id_seq'::regclass); +ALTER TABLE ONLY support.study_json_records + ADD CONSTRAINT study_json_records_pkey PRIMARY KEY (id); -- --- Name: intervention_other_names id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: study_statistics_comparisons study_statistics_comparisons_pkey; Type: CONSTRAINT; Schema: support; Owner: - -- -ALTER TABLE ONLY ctgov.intervention_other_names ALTER COLUMN id SET DEFAULT nextval('ctgov.intervention_other_names_id_seq'::regclass); +ALTER TABLE ONLY support.study_statistics_comparisons + ADD CONSTRAINT study_statistics_comparisons_pkey PRIMARY KEY (id); -- --- Name: interventions id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: study_xml_records study_xml_records_pkey; Type: CONSTRAINT; Schema: support; Owner: - -- -ALTER TABLE ONLY ctgov.interventions ALTER COLUMN id SET DEFAULT nextval('ctgov.interventions_id_seq'::regclass); +ALTER TABLE ONLY support.study_xml_records + ADD CONSTRAINT study_xml_records_pkey PRIMARY KEY (id); -- --- Name: ipd_information_types id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: verifiers verifiers_pkey; Type: CONSTRAINT; Schema: support; Owner: - -- -ALTER TABLE ONLY ctgov.ipd_information_types ALTER COLUMN id SET DEFAULT nextval('ctgov.ipd_information_types_id_seq'::regclass); +ALTER TABLE ONLY support.verifiers + ADD CONSTRAINT verifiers_pkey PRIMARY KEY (id); -- --- Name: keywords id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: index_baseline_measurements_on_category; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.keywords ALTER COLUMN id SET DEFAULT nextval('ctgov.keywords_id_seq'::regclass); +CREATE INDEX index_baseline_measurements_on_category ON ctgov.baseline_measurements USING btree (category); -- --- Name: links id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: index_baseline_measurements_on_classification; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.links ALTER COLUMN id SET DEFAULT nextval('ctgov.links_id_seq'::regclass); +CREATE INDEX index_baseline_measurements_on_classification ON ctgov.baseline_measurements USING btree (classification); -- --- Name: mesh_headings id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: index_baseline_measurements_on_dispersion_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.mesh_headings ALTER COLUMN id SET DEFAULT nextval('ctgov.mesh_headings_id_seq'::regclass); +CREATE INDEX index_baseline_measurements_on_dispersion_type ON ctgov.baseline_measurements USING btree (dispersion_type); -- --- Name: mesh_terms id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: index_baseline_measurements_on_param_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.mesh_terms ALTER COLUMN id SET DEFAULT nextval('ctgov.mesh_terms_id_seq'::regclass); +CREATE INDEX index_baseline_measurements_on_param_type ON ctgov.baseline_measurements USING btree (param_type); -- --- Name: milestones id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: index_browse_conditions_on_downcase_mesh_term; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.milestones ALTER COLUMN id SET DEFAULT nextval('ctgov.milestones_id_seq'::regclass); +CREATE INDEX index_browse_conditions_on_downcase_mesh_term ON ctgov.browse_conditions USING btree (downcase_mesh_term); -- --- Name: outcome_analyses id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: index_browse_conditions_on_mesh_term; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.outcome_analyses ALTER COLUMN id SET DEFAULT nextval('ctgov.outcome_analyses_id_seq'::regclass); +CREATE INDEX index_browse_conditions_on_mesh_term ON ctgov.browse_conditions USING btree (mesh_term); -- --- Name: outcome_analysis_groups id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: index_browse_conditions_on_nct_id; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.outcome_analysis_groups ALTER COLUMN id SET DEFAULT nextval('ctgov.outcome_analysis_groups_id_seq'::regclass); +CREATE INDEX index_browse_conditions_on_nct_id ON ctgov.browse_conditions USING btree (nct_id); -- --- Name: outcome_counts id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: index_browse_interventions_on_downcase_mesh_term; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.outcome_counts ALTER COLUMN id SET DEFAULT nextval('ctgov.outcome_counts_id_seq'::regclass); +CREATE INDEX index_browse_interventions_on_downcase_mesh_term ON ctgov.browse_interventions USING btree (downcase_mesh_term); -- --- Name: outcome_measurements id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: index_browse_interventions_on_mesh_term; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.outcome_measurements ALTER COLUMN id SET DEFAULT nextval('ctgov.outcome_measurements_id_seq'::regclass); +CREATE INDEX index_browse_interventions_on_mesh_term ON ctgov.browse_interventions USING btree (mesh_term); -- --- Name: outcomes id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: index_browse_interventions_on_nct_id; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.outcomes ALTER COLUMN id SET DEFAULT nextval('ctgov.outcomes_id_seq'::regclass); +CREATE INDEX index_browse_interventions_on_nct_id ON ctgov.browse_interventions USING btree (nct_id); -- --- Name: overall_officials id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: index_calculated_values_on_actual_duration; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.overall_officials ALTER COLUMN id SET DEFAULT nextval('ctgov.overall_officials_id_seq'::regclass); +CREATE INDEX index_calculated_values_on_actual_duration ON ctgov.calculated_values USING btree (actual_duration); -- --- Name: participant_flows id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: index_calculated_values_on_months_to_report_results; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.participant_flows ALTER COLUMN id SET DEFAULT nextval('ctgov.participant_flows_id_seq'::regclass); +CREATE INDEX index_calculated_values_on_months_to_report_results ON ctgov.calculated_values USING btree (months_to_report_results); -- --- Name: pending_results id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: index_calculated_values_on_number_of_facilities; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.pending_results ALTER COLUMN id SET DEFAULT nextval('ctgov.pending_results_id_seq'::regclass); +CREATE INDEX index_calculated_values_on_number_of_facilities ON ctgov.calculated_values USING btree (number_of_facilities); -- --- Name: provided_documents id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: index_central_contacts_on_contact_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.provided_documents ALTER COLUMN id SET DEFAULT nextval('ctgov.provided_documents_id_seq'::regclass); +CREATE INDEX index_central_contacts_on_contact_type ON ctgov.central_contacts USING btree (contact_type); -- --- Name: reported_event_totals id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: index_conditions_on_downcase_name; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.reported_event_totals ALTER COLUMN id SET DEFAULT nextval('ctgov.reported_event_totals_id_seq'::regclass); +CREATE INDEX index_conditions_on_downcase_name ON ctgov.conditions USING btree (downcase_name); -- --- Name: reported_events id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: index_conditions_on_name; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.reported_events ALTER COLUMN id SET DEFAULT nextval('ctgov.reported_events_id_seq'::regclass); +CREATE INDEX index_conditions_on_name ON ctgov.conditions USING btree (name); -- --- Name: responsible_parties id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: index_ctgov.use_case_datasets_on_dataset_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.responsible_parties ALTER COLUMN id SET DEFAULT nextval('ctgov.responsible_parties_id_seq'::regclass); +CREATE INDEX "index_ctgov.use_case_datasets_on_dataset_type" ON ctgov.use_case_datasets USING btree (dataset_type); -- --- Name: result_agreements id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: index_ctgov.use_case_datasets_on_name; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.result_agreements ALTER COLUMN id SET DEFAULT nextval('ctgov.result_agreements_id_seq'::regclass); +CREATE INDEX "index_ctgov.use_case_datasets_on_name" ON ctgov.use_case_datasets USING btree (name); -- --- Name: result_contacts id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: index_ctgov.use_cases_on_completion_date; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.result_contacts ALTER COLUMN id SET DEFAULT nextval('ctgov.result_contacts_id_seq'::regclass); +CREATE INDEX "index_ctgov.use_cases_on_completion_date" ON ctgov.use_cases USING btree (completion_date); -- --- Name: result_groups id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: index_ctgov.use_cases_on_organizations; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.result_groups ALTER COLUMN id SET DEFAULT nextval('ctgov.result_groups_id_seq'::regclass); +CREATE INDEX "index_ctgov.use_cases_on_organizations" ON ctgov.use_cases USING btree (organizations); -- --- Name: retractions id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: index_ctgov.use_cases_on_year; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.retractions ALTER COLUMN id SET DEFAULT nextval('ctgov.retractions_id_seq'::regclass); +CREATE INDEX "index_ctgov.use_cases_on_year" ON ctgov.use_cases USING btree (year); -- --- Name: search_results id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: index_ctgov.users_on_confirmation_token; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.search_results ALTER COLUMN id SET DEFAULT nextval('ctgov.search_results_id_seq'::regclass); +CREATE UNIQUE INDEX "index_ctgov.users_on_confirmation_token" ON ctgov.users USING btree (confirmation_token); -- --- Name: sponsors id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: index_ctgov.users_on_email; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.sponsors ALTER COLUMN id SET DEFAULT nextval('ctgov.sponsors_id_seq'::regclass); +CREATE UNIQUE INDEX "index_ctgov.users_on_email" ON ctgov.users USING btree (email); -- --- Name: study_records id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: index_ctgov.users_on_reset_password_token; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.study_records ALTER COLUMN id SET DEFAULT nextval('ctgov.study_records_id_seq'::regclass); +CREATE UNIQUE INDEX "index_ctgov.users_on_reset_password_token" ON ctgov.users USING btree (reset_password_token); -- --- Name: study_references id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: index_design_group_interventions_on_design_group_id; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.study_references ALTER COLUMN id SET DEFAULT nextval('ctgov.study_references_id_seq'::regclass); +CREATE INDEX index_design_group_interventions_on_design_group_id ON ctgov.design_group_interventions USING btree (design_group_id); -- --- Name: study_searches id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: index_design_group_interventions_on_intervention_id; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.study_searches ALTER COLUMN id SET DEFAULT nextval('ctgov.study_searches_id_seq'::regclass); +CREATE INDEX index_design_group_interventions_on_intervention_id ON ctgov.design_group_interventions USING btree (intervention_id); -- --- Name: active_storage_attachments id; Type: DEFAULT; Schema: support; Owner: - +-- Name: index_design_groups_on_group_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.active_storage_attachments ALTER COLUMN id SET DEFAULT nextval('support.active_storage_attachments_id_seq'::regclass); +CREATE INDEX index_design_groups_on_group_type ON ctgov.design_groups USING btree (group_type); -- --- Name: active_storage_blobs id; Type: DEFAULT; Schema: support; Owner: - +-- Name: index_design_outcomes_on_measure; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.active_storage_blobs ALTER COLUMN id SET DEFAULT nextval('support.active_storage_blobs_id_seq'::regclass); +CREATE INDEX index_design_outcomes_on_measure ON ctgov.design_outcomes USING btree (measure); -- --- Name: background_jobs id; Type: DEFAULT; Schema: support; Owner: - +-- Name: index_design_outcomes_on_outcome_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.background_jobs ALTER COLUMN id SET DEFAULT nextval('support.background_jobs_id_seq'::regclass); +CREATE INDEX index_design_outcomes_on_outcome_type ON ctgov.design_outcomes USING btree (outcome_type); -- --- Name: file_records id; Type: DEFAULT; Schema: support; Owner: - +-- Name: index_designs_on_caregiver_masked; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.file_records ALTER COLUMN id SET DEFAULT nextval('support.file_records_id_seq'::regclass); +CREATE INDEX index_designs_on_caregiver_masked ON ctgov.designs USING btree (caregiver_masked); -- --- Name: load_events id; Type: DEFAULT; Schema: support; Owner: - +-- Name: index_designs_on_investigator_masked; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.load_events ALTER COLUMN id SET DEFAULT nextval('support.load_events_id_seq'::regclass); +CREATE INDEX index_designs_on_investigator_masked ON ctgov.designs USING btree (investigator_masked); + + +-- +-- Name: index_designs_on_masking; Type: INDEX; Schema: ctgov; Owner: - +-- + +CREATE INDEX index_designs_on_masking ON ctgov.designs USING btree (masking); + + +-- +-- Name: index_designs_on_outcomes_assessor_masked; Type: INDEX; Schema: ctgov; Owner: - +-- + +CREATE INDEX index_designs_on_outcomes_assessor_masked ON ctgov.designs USING btree (outcomes_assessor_masked); + + +-- +-- Name: index_designs_on_subject_masked; Type: INDEX; Schema: ctgov; Owner: - +-- + +CREATE INDEX index_designs_on_subject_masked ON ctgov.designs USING btree (subject_masked); -- --- Name: load_issues id; Type: DEFAULT; Schema: support; Owner: - +-- Name: index_documents_on_document_id; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.load_issues ALTER COLUMN id SET DEFAULT nextval('support.load_issues_id_seq'::regclass); +CREATE INDEX index_documents_on_document_id ON ctgov.documents USING btree (document_id); -- --- Name: sanity_checks id; Type: DEFAULT; Schema: support; Owner: - +-- Name: index_documents_on_document_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.sanity_checks ALTER COLUMN id SET DEFAULT nextval('support.sanity_checks_id_seq'::regclass); +CREATE INDEX index_documents_on_document_type ON ctgov.documents USING btree (document_type); -- --- Name: study_json_records id; Type: DEFAULT; Schema: support; Owner: - +-- Name: index_drop_withdrawals_on_period; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.study_json_records ALTER COLUMN id SET DEFAULT nextval('support.study_json_records_id_seq'::regclass); +CREATE INDEX index_drop_withdrawals_on_period ON ctgov.drop_withdrawals USING btree (period); -- --- Name: study_statistics_comparisons id; Type: DEFAULT; Schema: support; Owner: - +-- Name: index_eligibilities_on_gender; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.study_statistics_comparisons ALTER COLUMN id SET DEFAULT nextval('support.study_statistics_comparisons_id_seq'::regclass); +CREATE INDEX index_eligibilities_on_gender ON ctgov.eligibilities USING btree (gender); -- --- Name: study_xml_records id; Type: DEFAULT; Schema: support; Owner: - +-- Name: index_eligibilities_on_healthy_volunteers; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.study_xml_records ALTER COLUMN id SET DEFAULT nextval('support.study_xml_records_id_seq'::regclass); +CREATE INDEX index_eligibilities_on_healthy_volunteers ON ctgov.eligibilities USING btree (healthy_volunteers); -- --- Name: verifiers id; Type: DEFAULT; Schema: support; Owner: - +-- Name: index_eligibilities_on_maximum_age; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.verifiers ALTER COLUMN id SET DEFAULT nextval('support.verifiers_id_seq'::regclass); +CREATE INDEX index_eligibilities_on_maximum_age ON ctgov.eligibilities USING btree (maximum_age); -- --- Name: baseline_counts baseline_counts_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_eligibilities_on_minimum_age; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.baseline_counts - ADD CONSTRAINT baseline_counts_pkey PRIMARY KEY (id); +CREATE INDEX index_eligibilities_on_minimum_age ON ctgov.eligibilities USING btree (minimum_age); -- --- Name: baseline_measurements baseline_measurements_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_facilities_on_city; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.baseline_measurements - ADD CONSTRAINT baseline_measurements_pkey PRIMARY KEY (id); +CREATE INDEX index_facilities_on_city ON ctgov.facilities USING btree (city); -- --- Name: brief_summaries brief_summaries_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_facilities_on_country; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.brief_summaries - ADD CONSTRAINT brief_summaries_pkey PRIMARY KEY (id); +CREATE INDEX index_facilities_on_country ON ctgov.facilities USING btree (country); -- --- Name: browse_conditions browse_conditions_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_facilities_on_name; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.browse_conditions - ADD CONSTRAINT browse_conditions_pkey PRIMARY KEY (id); +CREATE INDEX index_facilities_on_name ON ctgov.facilities USING btree (name); -- --- Name: browse_interventions browse_interventions_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_facilities_on_state; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.browse_interventions - ADD CONSTRAINT browse_interventions_pkey PRIMARY KEY (id); +CREATE INDEX index_facilities_on_state ON ctgov.facilities USING btree (state); -- --- Name: calculated_values calculated_values_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_facilities_on_status; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.calculated_values - ADD CONSTRAINT calculated_values_pkey PRIMARY KEY (id); +CREATE INDEX index_facilities_on_status ON ctgov.facilities USING btree (status); -- --- Name: central_contacts central_contacts_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_facility_contacts_on_contact_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.central_contacts - ADD CONSTRAINT central_contacts_pkey PRIMARY KEY (id); +CREATE INDEX index_facility_contacts_on_contact_type ON ctgov.facility_contacts USING btree (contact_type); -- --- Name: conditions conditions_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_id_information_on_id_source; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.conditions - ADD CONSTRAINT conditions_pkey PRIMARY KEY (id); +CREATE INDEX index_id_information_on_id_source ON ctgov.id_information USING btree (id_source); -- --- Name: countries countries_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_interventions_on_intervention_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.countries - ADD CONSTRAINT countries_pkey PRIMARY KEY (id); +CREATE INDEX index_interventions_on_intervention_type ON ctgov.interventions USING btree (intervention_type); -- --- Name: design_group_interventions design_group_interventions_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_keywords_on_downcase_name; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.design_group_interventions - ADD CONSTRAINT design_group_interventions_pkey PRIMARY KEY (id); +CREATE INDEX index_keywords_on_downcase_name ON ctgov.keywords USING btree (downcase_name); -- --- Name: design_groups design_groups_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_keywords_on_name; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.design_groups - ADD CONSTRAINT design_groups_pkey PRIMARY KEY (id); +CREATE INDEX index_keywords_on_name ON ctgov.keywords USING btree (name); -- --- Name: design_outcomes design_outcomes_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_mesh_headings_on_qualifier; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.design_outcomes - ADD CONSTRAINT design_outcomes_pkey PRIMARY KEY (id); +CREATE INDEX index_mesh_headings_on_qualifier ON ctgov.mesh_headings USING btree (qualifier); -- --- Name: designs designs_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_mesh_terms_on_description; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.designs - ADD CONSTRAINT designs_pkey PRIMARY KEY (id); +CREATE INDEX index_mesh_terms_on_description ON ctgov.mesh_terms USING btree (description); -- --- Name: detailed_descriptions detailed_descriptions_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_mesh_terms_on_downcase_mesh_term; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.detailed_descriptions - ADD CONSTRAINT detailed_descriptions_pkey PRIMARY KEY (id); +CREATE INDEX index_mesh_terms_on_downcase_mesh_term ON ctgov.mesh_terms USING btree (downcase_mesh_term); -- --- Name: documents documents_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_mesh_terms_on_mesh_term; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.documents - ADD CONSTRAINT documents_pkey PRIMARY KEY (id); +CREATE INDEX index_mesh_terms_on_mesh_term ON ctgov.mesh_terms USING btree (mesh_term); -- --- Name: drop_withdrawals drop_withdrawals_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_mesh_terms_on_qualifier; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.drop_withdrawals - ADD CONSTRAINT drop_withdrawals_pkey PRIMARY KEY (id); +CREATE INDEX index_mesh_terms_on_qualifier ON ctgov.mesh_terms USING btree (qualifier); -- --- Name: eligibilities eligibilities_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_milestones_on_period; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.eligibilities - ADD CONSTRAINT eligibilities_pkey PRIMARY KEY (id); +CREATE INDEX index_milestones_on_period ON ctgov.milestones USING btree (period); -- --- Name: facilities facilities_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_outcome_analyses_on_dispersion_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.facilities - ADD CONSTRAINT facilities_pkey PRIMARY KEY (id); +CREATE INDEX index_outcome_analyses_on_dispersion_type ON ctgov.outcome_analyses USING btree (dispersion_type); -- --- Name: facility_contacts facility_contacts_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_outcome_analyses_on_param_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.facility_contacts - ADD CONSTRAINT facility_contacts_pkey PRIMARY KEY (id); +CREATE INDEX index_outcome_analyses_on_param_type ON ctgov.outcome_analyses USING btree (param_type); -- --- Name: facility_investigators facility_investigators_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_outcome_measurements_on_category; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.facility_investigators - ADD CONSTRAINT facility_investigators_pkey PRIMARY KEY (id); +CREATE INDEX index_outcome_measurements_on_category ON ctgov.outcome_measurements USING btree (category); -- --- Name: id_information id_information_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_outcome_measurements_on_classification; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.id_information - ADD CONSTRAINT id_information_pkey PRIMARY KEY (id); +CREATE INDEX index_outcome_measurements_on_classification ON ctgov.outcome_measurements USING btree (classification); -- --- Name: intervention_other_names intervention_other_names_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_outcome_measurements_on_dispersion_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.intervention_other_names - ADD CONSTRAINT intervention_other_names_pkey PRIMARY KEY (id); +CREATE INDEX index_outcome_measurements_on_dispersion_type ON ctgov.outcome_measurements USING btree (dispersion_type); -- --- Name: interventions interventions_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_outcomes_on_dispersion_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.interventions - ADD CONSTRAINT interventions_pkey PRIMARY KEY (id); +CREATE INDEX index_outcomes_on_dispersion_type ON ctgov.outcomes USING btree (dispersion_type); -- --- Name: ipd_information_types ipd_information_types_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_outcomes_on_param_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.ipd_information_types - ADD CONSTRAINT ipd_information_types_pkey PRIMARY KEY (id); +CREATE INDEX index_outcomes_on_param_type ON ctgov.outcomes USING btree (param_type); -- --- Name: keywords keywords_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_overall_officials_on_affiliation; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.keywords - ADD CONSTRAINT keywords_pkey PRIMARY KEY (id); +CREATE INDEX index_overall_officials_on_affiliation ON ctgov.overall_officials USING btree (affiliation); -- --- Name: links links_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_overall_officials_on_nct_id; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.links - ADD CONSTRAINT links_pkey PRIMARY KEY (id); +CREATE INDEX index_overall_officials_on_nct_id ON ctgov.overall_officials USING btree (nct_id); -- --- Name: mesh_headings mesh_headings_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_projects_on_completion_date; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.mesh_headings - ADD CONSTRAINT mesh_headings_pkey PRIMARY KEY (id); +CREATE INDEX index_projects_on_completion_date ON ctgov.projects USING btree (completion_date); -- --- Name: mesh_terms mesh_terms_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_projects_on_data_available; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.mesh_terms - ADD CONSTRAINT mesh_terms_pkey PRIMARY KEY (id); +CREATE INDEX index_projects_on_data_available ON ctgov.projects USING btree (data_available); -- --- Name: milestones milestones_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_projects_on_investigators; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.milestones - ADD CONSTRAINT milestones_pkey PRIMARY KEY (id); +CREATE INDEX index_projects_on_investigators ON ctgov.projects USING btree (investigators); -- --- Name: outcome_analyses outcome_analyses_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_projects_on_organizations; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.outcome_analyses - ADD CONSTRAINT outcome_analyses_pkey PRIMARY KEY (id); +CREATE INDEX index_projects_on_organizations ON ctgov.projects USING btree (organizations); -- --- Name: outcome_analysis_groups outcome_analysis_groups_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_projects_on_start_date; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.outcome_analysis_groups - ADD CONSTRAINT outcome_analysis_groups_pkey PRIMARY KEY (id); +CREATE INDEX index_projects_on_start_date ON ctgov.projects USING btree (start_date); -- --- Name: outcome_counts outcome_counts_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_projects_on_year; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.outcome_counts - ADD CONSTRAINT outcome_counts_pkey PRIMARY KEY (id); +CREATE INDEX index_projects_on_year ON ctgov.projects USING btree (year); -- --- Name: outcome_measurements outcome_measurements_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_reported_events_on_event_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.outcome_measurements - ADD CONSTRAINT outcome_measurements_pkey PRIMARY KEY (id); +CREATE INDEX index_reported_events_on_event_type ON ctgov.reported_events USING btree (event_type); -- --- Name: outcomes outcomes_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_reported_events_on_subjects_affected; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.outcomes - ADD CONSTRAINT outcomes_pkey PRIMARY KEY (id); +CREATE INDEX index_reported_events_on_subjects_affected ON ctgov.reported_events USING btree (subjects_affected); -- --- Name: overall_officials overall_officials_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_responsible_parties_on_nct_id; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.overall_officials - ADD CONSTRAINT overall_officials_pkey PRIMARY KEY (id); +CREATE INDEX index_responsible_parties_on_nct_id ON ctgov.responsible_parties USING btree (nct_id); -- --- Name: participant_flows participant_flows_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_responsible_parties_on_organization; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.participant_flows - ADD CONSTRAINT participant_flows_pkey PRIMARY KEY (id); +CREATE INDEX index_responsible_parties_on_organization ON ctgov.responsible_parties USING btree (organization); -- --- Name: pending_results pending_results_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_responsible_parties_on_responsible_party_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.pending_results - ADD CONSTRAINT pending_results_pkey PRIMARY KEY (id); +CREATE INDEX index_responsible_parties_on_responsible_party_type ON ctgov.responsible_parties USING btree (responsible_party_type); -- --- Name: provided_documents provided_documents_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_result_contacts_on_organization; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.provided_documents - ADD CONSTRAINT provided_documents_pkey PRIMARY KEY (id); +CREATE INDEX index_result_contacts_on_organization ON ctgov.result_contacts USING btree (organization); -- --- Name: reported_event_totals reported_event_totals_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_result_groups_on_result_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.reported_event_totals - ADD CONSTRAINT reported_event_totals_pkey PRIMARY KEY (id); +CREATE INDEX index_result_groups_on_result_type ON ctgov.result_groups USING btree (result_type); -- --- Name: reported_events reported_events_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_saved_queries_on_user_id; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.reported_events - ADD CONSTRAINT reported_events_pkey PRIMARY KEY (id); +CREATE INDEX index_saved_queries_on_user_id ON ctgov.saved_queries USING btree (user_id); -- --- Name: responsible_parties responsible_parties_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_search_results_on_nct_id_and_name; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.responsible_parties - ADD CONSTRAINT responsible_parties_pkey PRIMARY KEY (id); +CREATE UNIQUE INDEX index_search_results_on_nct_id_and_name ON ctgov.search_results USING btree (nct_id, name); -- --- Name: result_agreements result_agreements_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_search_results_on_nct_id_and_name_and_grouping; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.result_agreements - ADD CONSTRAINT result_agreements_pkey PRIMARY KEY (id); +CREATE UNIQUE INDEX index_search_results_on_nct_id_and_name_and_grouping ON ctgov.search_results USING btree (nct_id, name, "grouping"); -- --- Name: result_contacts result_contacts_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_sponsors_on_agency_class; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.result_contacts - ADD CONSTRAINT result_contacts_pkey PRIMARY KEY (id); +CREATE INDEX index_sponsors_on_agency_class ON ctgov.sponsors USING btree (agency_class); -- --- Name: result_groups result_groups_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_sponsors_on_name; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.result_groups - ADD CONSTRAINT result_groups_pkey PRIMARY KEY (id); +CREATE INDEX index_sponsors_on_name ON ctgov.sponsors USING btree (name); -- --- Name: retractions retractions_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_studies_on_completion_date; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.retractions - ADD CONSTRAINT retractions_pkey PRIMARY KEY (id); +CREATE INDEX index_studies_on_completion_date ON ctgov.studies USING btree (completion_date); -- --- Name: search_results search_results_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_studies_on_disposition_first_submitted_date; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.search_results - ADD CONSTRAINT search_results_pkey PRIMARY KEY (id); +CREATE INDEX index_studies_on_disposition_first_submitted_date ON ctgov.studies USING btree (disposition_first_submitted_date); -- --- Name: sponsors sponsors_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_studies_on_enrollment_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.sponsors - ADD CONSTRAINT sponsors_pkey PRIMARY KEY (id); +CREATE INDEX index_studies_on_enrollment_type ON ctgov.studies USING btree (enrollment_type); -- --- Name: study_records study_records_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_studies_on_last_known_status; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.study_records - ADD CONSTRAINT study_records_pkey PRIMARY KEY (id); +CREATE INDEX index_studies_on_last_known_status ON ctgov.studies USING btree (last_known_status); -- --- Name: study_references study_references_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_studies_on_last_update_submitted_date; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.study_references - ADD CONSTRAINT study_references_pkey PRIMARY KEY (id); +CREATE INDEX index_studies_on_last_update_submitted_date ON ctgov.studies USING btree (last_update_submitted_date); -- --- Name: study_searches study_searches_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_studies_on_nct_id; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.study_searches - ADD CONSTRAINT study_searches_pkey PRIMARY KEY (id); +CREATE UNIQUE INDEX index_studies_on_nct_id ON ctgov.studies USING btree (nct_id); -- --- Name: ar_internal_metadata ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: index_studies_on_overall_status; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY public.ar_internal_metadata - ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key); +CREATE INDEX index_studies_on_overall_status ON ctgov.studies USING btree (overall_status); -- --- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: index_studies_on_phase; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY public.schema_migrations - ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version); +CREATE INDEX index_studies_on_phase ON ctgov.studies USING btree (phase); -- --- Name: active_storage_attachments active_storage_attachments_pkey; Type: CONSTRAINT; Schema: support; Owner: - +-- Name: index_studies_on_primary_completion_date; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.active_storage_attachments - ADD CONSTRAINT active_storage_attachments_pkey PRIMARY KEY (id); +CREATE INDEX index_studies_on_primary_completion_date ON ctgov.studies USING btree (primary_completion_date); -- --- Name: active_storage_blobs active_storage_blobs_pkey; Type: CONSTRAINT; Schema: support; Owner: - +-- Name: index_studies_on_primary_completion_date_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.active_storage_blobs - ADD CONSTRAINT active_storage_blobs_pkey PRIMARY KEY (id); +CREATE INDEX index_studies_on_primary_completion_date_type ON ctgov.studies USING btree (primary_completion_date_type); -- --- Name: background_jobs background_jobs_pkey; Type: CONSTRAINT; Schema: support; Owner: - +-- Name: index_studies_on_results_first_submitted_date; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.background_jobs - ADD CONSTRAINT background_jobs_pkey PRIMARY KEY (id); +CREATE INDEX index_studies_on_results_first_submitted_date ON ctgov.studies USING btree (results_first_submitted_date); -- --- Name: file_records file_records_pkey; Type: CONSTRAINT; Schema: support; Owner: - +-- Name: index_studies_on_source; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.file_records - ADD CONSTRAINT file_records_pkey PRIMARY KEY (id); +CREATE INDEX index_studies_on_source ON ctgov.studies USING btree (source); -- --- Name: load_events load_events_pkey; Type: CONSTRAINT; Schema: support; Owner: - +-- Name: index_studies_on_start_date; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.load_events - ADD CONSTRAINT load_events_pkey PRIMARY KEY (id); +CREATE INDEX index_studies_on_start_date ON ctgov.studies USING btree (start_date); -- --- Name: load_issues load_issues_pkey; Type: CONSTRAINT; Schema: support; Owner: - +-- Name: index_studies_on_start_date_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.load_issues - ADD CONSTRAINT load_issues_pkey PRIMARY KEY (id); +CREATE INDEX index_studies_on_start_date_type ON ctgov.studies USING btree (start_date_type); -- --- Name: sanity_checks sanity_checks_pkey; Type: CONSTRAINT; Schema: support; Owner: - +-- Name: index_studies_on_study_first_submitted_date; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.sanity_checks - ADD CONSTRAINT sanity_checks_pkey PRIMARY KEY (id); +CREATE INDEX index_studies_on_study_first_submitted_date ON ctgov.studies USING btree (study_first_submitted_date); -- --- Name: study_json_records study_json_records_pkey; Type: CONSTRAINT; Schema: support; Owner: - +-- Name: index_studies_on_study_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.study_json_records - ADD CONSTRAINT study_json_records_pkey PRIMARY KEY (id); +CREATE INDEX index_studies_on_study_type ON ctgov.studies USING btree (study_type); -- --- Name: study_statistics_comparisons study_statistics_comparisons_pkey; Type: CONSTRAINT; Schema: support; Owner: - +-- Name: index_study_records_on_nct_id_and_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.study_statistics_comparisons - ADD CONSTRAINT study_statistics_comparisons_pkey PRIMARY KEY (id); +CREATE UNIQUE INDEX index_study_records_on_nct_id_and_type ON ctgov.study_records USING btree (nct_id, type); -- --- Name: study_xml_records study_xml_records_pkey; Type: CONSTRAINT; Schema: support; Owner: - +-- Name: index_study_references_on_reference_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.study_xml_records - ADD CONSTRAINT study_xml_records_pkey PRIMARY KEY (id); +CREATE INDEX index_study_references_on_reference_type ON ctgov.study_references USING btree (reference_type); -- --- Name: verifiers verifiers_pkey; Type: CONSTRAINT; Schema: support; Owner: - +-- Name: index_study_searches_on_query_and_grouping; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.verifiers - ADD CONSTRAINT verifiers_pkey PRIMARY KEY (id); +CREATE UNIQUE INDEX index_study_searches_on_query_and_grouping ON ctgov.study_searches USING btree (query, "grouping"); -- --- Name: index_baseline_measurements_on_category; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_baseline_measurements_on_category; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_baseline_measurements_on_category ON ctgov.baseline_measurements USING btree (category); +CREATE INDEX index_baseline_measurements_on_category ON ctgov_v2.baseline_measurements USING btree (category); -- --- Name: index_baseline_measurements_on_classification; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_baseline_measurements_on_classification; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_baseline_measurements_on_classification ON ctgov.baseline_measurements USING btree (classification); +CREATE INDEX index_baseline_measurements_on_classification ON ctgov_v2.baseline_measurements USING btree (classification); -- --- Name: index_baseline_measurements_on_dispersion_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_baseline_measurements_on_dispersion_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_baseline_measurements_on_dispersion_type ON ctgov.baseline_measurements USING btree (dispersion_type); +CREATE INDEX index_baseline_measurements_on_dispersion_type ON ctgov_v2.baseline_measurements USING btree (dispersion_type); -- --- Name: index_baseline_measurements_on_param_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_baseline_measurements_on_param_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_baseline_measurements_on_param_type ON ctgov.baseline_measurements USING btree (param_type); +CREATE INDEX index_baseline_measurements_on_param_type ON ctgov_v2.baseline_measurements USING btree (param_type); -- --- Name: index_browse_conditions_on_downcase_mesh_term; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_browse_conditions_on_downcase_mesh_term; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_browse_conditions_on_downcase_mesh_term ON ctgov.browse_conditions USING btree (downcase_mesh_term); +CREATE INDEX index_browse_conditions_on_downcase_mesh_term ON ctgov_v2.browse_conditions USING btree (downcase_mesh_term); -- --- Name: index_browse_conditions_on_mesh_term; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_browse_conditions_on_mesh_term; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_browse_conditions_on_mesh_term ON ctgov.browse_conditions USING btree (mesh_term); +CREATE INDEX index_browse_conditions_on_mesh_term ON ctgov_v2.browse_conditions USING btree (mesh_term); -- --- Name: index_browse_conditions_on_nct_id; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_browse_conditions_on_nct_id; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_browse_conditions_on_nct_id ON ctgov.browse_conditions USING btree (nct_id); +CREATE INDEX index_browse_conditions_on_nct_id ON ctgov_v2.browse_conditions USING btree (nct_id); -- --- Name: index_browse_interventions_on_downcase_mesh_term; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_browse_interventions_on_downcase_mesh_term; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_browse_interventions_on_downcase_mesh_term ON ctgov.browse_interventions USING btree (downcase_mesh_term); +CREATE INDEX index_browse_interventions_on_downcase_mesh_term ON ctgov_v2.browse_interventions USING btree (downcase_mesh_term); -- --- Name: index_browse_interventions_on_mesh_term; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_browse_interventions_on_mesh_term; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_browse_interventions_on_mesh_term ON ctgov.browse_interventions USING btree (mesh_term); +CREATE INDEX index_browse_interventions_on_mesh_term ON ctgov_v2.browse_interventions USING btree (mesh_term); -- --- Name: index_browse_interventions_on_nct_id; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_browse_interventions_on_nct_id; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_browse_interventions_on_nct_id ON ctgov.browse_interventions USING btree (nct_id); +CREATE INDEX index_browse_interventions_on_nct_id ON ctgov_v2.browse_interventions USING btree (nct_id); -- --- Name: index_calculated_values_on_actual_duration; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_calculated_values_on_actual_duration; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_calculated_values_on_actual_duration ON ctgov.calculated_values USING btree (actual_duration); +CREATE INDEX index_calculated_values_on_actual_duration ON ctgov_v2.calculated_values USING btree (actual_duration); -- --- Name: index_calculated_values_on_months_to_report_results; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_calculated_values_on_months_to_report_results; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_calculated_values_on_months_to_report_results ON ctgov.calculated_values USING btree (months_to_report_results); +CREATE INDEX index_calculated_values_on_months_to_report_results ON ctgov_v2.calculated_values USING btree (months_to_report_results); -- --- Name: index_calculated_values_on_number_of_facilities; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_calculated_values_on_number_of_facilities; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_calculated_values_on_number_of_facilities ON ctgov.calculated_values USING btree (number_of_facilities); +CREATE INDEX index_calculated_values_on_number_of_facilities ON ctgov_v2.calculated_values USING btree (number_of_facilities); -- --- Name: index_central_contacts_on_contact_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_central_contacts_on_contact_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_central_contacts_on_contact_type ON ctgov.central_contacts USING btree (contact_type); +CREATE INDEX index_central_contacts_on_contact_type ON ctgov_v2.central_contacts USING btree (contact_type); -- --- Name: index_conditions_on_downcase_name; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_conditions_on_downcase_name; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_conditions_on_downcase_name ON ctgov.conditions USING btree (downcase_name); +CREATE INDEX index_conditions_on_downcase_name ON ctgov_v2.conditions USING btree (downcase_name); -- --- Name: index_conditions_on_name; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_conditions_on_name; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_conditions_on_name ON ctgov.conditions USING btree (name); +CREATE INDEX index_conditions_on_name ON ctgov_v2.conditions USING btree (name); -- --- Name: index_design_group_interventions_on_design_group_id; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_design_group_interventions_on_design_group_id; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_design_group_interventions_on_design_group_id ON ctgov.design_group_interventions USING btree (design_group_id); +CREATE INDEX index_design_group_interventions_on_design_group_id ON ctgov_v2.design_group_interventions USING btree (design_group_id); -- --- Name: index_design_group_interventions_on_intervention_id; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_design_group_interventions_on_intervention_id; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_design_group_interventions_on_intervention_id ON ctgov.design_group_interventions USING btree (intervention_id); +CREATE INDEX index_design_group_interventions_on_intervention_id ON ctgov_v2.design_group_interventions USING btree (intervention_id); -- --- Name: index_design_groups_on_group_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_design_groups_on_group_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_design_groups_on_group_type ON ctgov.design_groups USING btree (group_type); +CREATE INDEX index_design_groups_on_group_type ON ctgov_v2.design_groups USING btree (group_type); -- --- Name: index_design_outcomes_on_measure; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_design_outcomes_on_measure; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_design_outcomes_on_measure ON ctgov.design_outcomes USING btree (measure); +CREATE INDEX index_design_outcomes_on_measure ON ctgov_v2.design_outcomes USING btree (measure); -- --- Name: index_design_outcomes_on_outcome_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_design_outcomes_on_outcome_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_design_outcomes_on_outcome_type ON ctgov.design_outcomes USING btree (outcome_type); +CREATE INDEX index_design_outcomes_on_outcome_type ON ctgov_v2.design_outcomes USING btree (outcome_type); -- --- Name: index_designs_on_caregiver_masked; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_designs_on_caregiver_masked; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_designs_on_caregiver_masked ON ctgov.designs USING btree (caregiver_masked); +CREATE INDEX index_designs_on_caregiver_masked ON ctgov_v2.designs USING btree (caregiver_masked); -- --- Name: index_designs_on_investigator_masked; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_designs_on_investigator_masked; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_designs_on_investigator_masked ON ctgov.designs USING btree (investigator_masked); +CREATE INDEX index_designs_on_investigator_masked ON ctgov_v2.designs USING btree (investigator_masked); -- --- Name: index_designs_on_masking; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_designs_on_masking; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_designs_on_masking ON ctgov.designs USING btree (masking); +CREATE INDEX index_designs_on_masking ON ctgov_v2.designs USING btree (masking); -- --- Name: index_designs_on_outcomes_assessor_masked; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_designs_on_outcomes_assessor_masked; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_designs_on_outcomes_assessor_masked ON ctgov.designs USING btree (outcomes_assessor_masked); +CREATE INDEX index_designs_on_outcomes_assessor_masked ON ctgov_v2.designs USING btree (outcomes_assessor_masked); -- --- Name: index_designs_on_subject_masked; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_designs_on_subject_masked; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_designs_on_subject_masked ON ctgov.designs USING btree (subject_masked); +CREATE INDEX index_designs_on_subject_masked ON ctgov_v2.designs USING btree (subject_masked); -- --- Name: index_documents_on_document_id; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_documents_on_document_id; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_documents_on_document_id ON ctgov.documents USING btree (document_id); +CREATE INDEX index_documents_on_document_id ON ctgov_v2.documents USING btree (document_id); -- --- Name: index_documents_on_document_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_documents_on_document_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_documents_on_document_type ON ctgov.documents USING btree (document_type); +CREATE INDEX index_documents_on_document_type ON ctgov_v2.documents USING btree (document_type); -- --- Name: index_drop_withdrawals_on_period; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_drop_withdrawals_on_period; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_drop_withdrawals_on_period ON ctgov.drop_withdrawals USING btree (period); +CREATE INDEX index_drop_withdrawals_on_period ON ctgov_v2.drop_withdrawals USING btree (period); -- --- Name: index_eligibilities_on_gender; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_eligibilities_on_gender; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_eligibilities_on_gender ON ctgov.eligibilities USING btree (gender); +CREATE INDEX index_eligibilities_on_gender ON ctgov_v2.eligibilities USING btree (gender); -- --- Name: index_eligibilities_on_healthy_volunteers; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_eligibilities_on_healthy_volunteers; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_eligibilities_on_healthy_volunteers ON ctgov.eligibilities USING btree (healthy_volunteers); +CREATE INDEX index_eligibilities_on_healthy_volunteers ON ctgov_v2.eligibilities USING btree (healthy_volunteers); -- --- Name: index_eligibilities_on_maximum_age; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_eligibilities_on_maximum_age; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_eligibilities_on_maximum_age ON ctgov.eligibilities USING btree (maximum_age); +CREATE INDEX index_eligibilities_on_maximum_age ON ctgov_v2.eligibilities USING btree (maximum_age); -- --- Name: index_eligibilities_on_minimum_age; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_eligibilities_on_minimum_age; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_eligibilities_on_minimum_age ON ctgov.eligibilities USING btree (minimum_age); +CREATE INDEX index_eligibilities_on_minimum_age ON ctgov_v2.eligibilities USING btree (minimum_age); -- --- Name: index_facilities_on_city; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_facilities_on_city; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_facilities_on_city ON ctgov.facilities USING btree (city); +CREATE INDEX index_facilities_on_city ON ctgov_v2.facilities USING btree (city); -- --- Name: index_facilities_on_country; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_facilities_on_country; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_facilities_on_country ON ctgov.facilities USING btree (country); +CREATE INDEX index_facilities_on_country ON ctgov_v2.facilities USING btree (country); -- --- Name: index_facilities_on_name; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_facilities_on_name; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_facilities_on_name ON ctgov.facilities USING btree (name); +CREATE INDEX index_facilities_on_name ON ctgov_v2.facilities USING btree (name); -- --- Name: index_facilities_on_state; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_facilities_on_state; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_facilities_on_state ON ctgov.facilities USING btree (state); +CREATE INDEX index_facilities_on_state ON ctgov_v2.facilities USING btree (state); -- --- Name: index_facilities_on_status; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_facilities_on_status; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_facilities_on_status ON ctgov.facilities USING btree (status); +CREATE INDEX index_facilities_on_status ON ctgov_v2.facilities USING btree (status); -- --- Name: index_facility_contacts_on_contact_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_facility_contacts_on_contact_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_facility_contacts_on_contact_type ON ctgov.facility_contacts USING btree (contact_type); +CREATE INDEX index_facility_contacts_on_contact_type ON ctgov_v2.facility_contacts USING btree (contact_type); -- --- Name: index_id_information_on_id_source; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_id_information_on_id_source; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_id_information_on_id_source ON ctgov.id_information USING btree (id_source); +CREATE INDEX index_id_information_on_id_source ON ctgov_v2.id_information USING btree (id_source); -- --- Name: index_interventions_on_intervention_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_interventions_on_intervention_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_interventions_on_intervention_type ON ctgov.interventions USING btree (intervention_type); +CREATE INDEX index_interventions_on_intervention_type ON ctgov_v2.interventions USING btree (intervention_type); -- --- Name: index_keywords_on_downcase_name; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_keywords_on_downcase_name; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_keywords_on_downcase_name ON ctgov.keywords USING btree (downcase_name); +CREATE INDEX index_keywords_on_downcase_name ON ctgov_v2.keywords USING btree (downcase_name); -- --- Name: index_keywords_on_name; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_keywords_on_name; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_keywords_on_name ON ctgov.keywords USING btree (name); +CREATE INDEX index_keywords_on_name ON ctgov_v2.keywords USING btree (name); -- --- Name: index_mesh_headings_on_qualifier; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_mesh_headings_on_qualifier; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_mesh_headings_on_qualifier ON ctgov.mesh_headings USING btree (qualifier); +CREATE INDEX index_mesh_headings_on_qualifier ON ctgov_v2.mesh_headings USING btree (qualifier); -- --- Name: index_mesh_terms_on_description; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_mesh_terms_on_description; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_mesh_terms_on_description ON ctgov.mesh_terms USING btree (description); +CREATE INDEX index_mesh_terms_on_description ON ctgov_v2.mesh_terms USING btree (description); -- --- Name: index_mesh_terms_on_downcase_mesh_term; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_mesh_terms_on_downcase_mesh_term; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_mesh_terms_on_downcase_mesh_term ON ctgov.mesh_terms USING btree (downcase_mesh_term); +CREATE INDEX index_mesh_terms_on_downcase_mesh_term ON ctgov_v2.mesh_terms USING btree (downcase_mesh_term); -- --- Name: index_mesh_terms_on_mesh_term; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_mesh_terms_on_mesh_term; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_mesh_terms_on_mesh_term ON ctgov.mesh_terms USING btree (mesh_term); +CREATE INDEX index_mesh_terms_on_mesh_term ON ctgov_v2.mesh_terms USING btree (mesh_term); -- --- Name: index_mesh_terms_on_qualifier; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_mesh_terms_on_qualifier; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_mesh_terms_on_qualifier ON ctgov.mesh_terms USING btree (qualifier); +CREATE INDEX index_mesh_terms_on_qualifier ON ctgov_v2.mesh_terms USING btree (qualifier); -- --- Name: index_milestones_on_period; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_milestones_on_period; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_milestones_on_period ON ctgov.milestones USING btree (period); +CREATE INDEX index_milestones_on_period ON ctgov_v2.milestones USING btree (period); -- --- Name: index_outcome_analyses_on_dispersion_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_outcome_analyses_on_dispersion_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_outcome_analyses_on_dispersion_type ON ctgov.outcome_analyses USING btree (dispersion_type); +CREATE INDEX index_outcome_analyses_on_dispersion_type ON ctgov_v2.outcome_analyses USING btree (dispersion_type); -- --- Name: index_outcome_analyses_on_param_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_outcome_analyses_on_param_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_outcome_analyses_on_param_type ON ctgov.outcome_analyses USING btree (param_type); +CREATE INDEX index_outcome_analyses_on_param_type ON ctgov_v2.outcome_analyses USING btree (param_type); -- --- Name: index_outcome_measurements_on_category; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_outcome_measurements_on_category; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_outcome_measurements_on_category ON ctgov.outcome_measurements USING btree (category); +CREATE INDEX index_outcome_measurements_on_category ON ctgov_v2.outcome_measurements USING btree (category); -- --- Name: index_outcome_measurements_on_classification; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_outcome_measurements_on_classification; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_outcome_measurements_on_classification ON ctgov.outcome_measurements USING btree (classification); +CREATE INDEX index_outcome_measurements_on_classification ON ctgov_v2.outcome_measurements USING btree (classification); -- --- Name: index_outcome_measurements_on_dispersion_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_outcome_measurements_on_dispersion_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_outcome_measurements_on_dispersion_type ON ctgov.outcome_measurements USING btree (dispersion_type); +CREATE INDEX index_outcome_measurements_on_dispersion_type ON ctgov_v2.outcome_measurements USING btree (dispersion_type); -- --- Name: index_outcomes_on_dispersion_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_outcomes_on_dispersion_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_outcomes_on_dispersion_type ON ctgov.outcomes USING btree (dispersion_type); +CREATE INDEX index_outcomes_on_dispersion_type ON ctgov_v2.outcomes USING btree (dispersion_type); -- --- Name: index_outcomes_on_param_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_outcomes_on_param_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_outcomes_on_param_type ON ctgov.outcomes USING btree (param_type); +CREATE INDEX index_outcomes_on_param_type ON ctgov_v2.outcomes USING btree (param_type); -- --- Name: index_overall_officials_on_affiliation; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_overall_officials_on_affiliation; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_overall_officials_on_affiliation ON ctgov.overall_officials USING btree (affiliation); +CREATE INDEX index_overall_officials_on_affiliation ON ctgov_v2.overall_officials USING btree (affiliation); -- --- Name: index_overall_officials_on_nct_id; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_overall_officials_on_nct_id; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_overall_officials_on_nct_id ON ctgov.overall_officials USING btree (nct_id); +CREATE INDEX index_overall_officials_on_nct_id ON ctgov_v2.overall_officials USING btree (nct_id); -- --- Name: index_reported_events_on_event_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_reported_events_on_event_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_reported_events_on_event_type ON ctgov.reported_events USING btree (event_type); +CREATE INDEX index_reported_events_on_event_type ON ctgov_v2.reported_events USING btree (event_type); -- --- Name: index_reported_events_on_subjects_affected; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_reported_events_on_subjects_affected; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_reported_events_on_subjects_affected ON ctgov.reported_events USING btree (subjects_affected); +CREATE INDEX index_reported_events_on_subjects_affected ON ctgov_v2.reported_events USING btree (subjects_affected); -- --- Name: index_responsible_parties_on_nct_id; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_responsible_parties_on_nct_id; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_responsible_parties_on_nct_id ON ctgov.responsible_parties USING btree (nct_id); +CREATE INDEX index_responsible_parties_on_nct_id ON ctgov_v2.responsible_parties USING btree (nct_id); -- --- Name: index_responsible_parties_on_organization; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_responsible_parties_on_organization; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_responsible_parties_on_organization ON ctgov.responsible_parties USING btree (organization); +CREATE INDEX index_responsible_parties_on_organization ON ctgov_v2.responsible_parties USING btree (organization); -- --- Name: index_responsible_parties_on_responsible_party_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_responsible_parties_on_responsible_party_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_responsible_parties_on_responsible_party_type ON ctgov.responsible_parties USING btree (responsible_party_type); +CREATE INDEX index_responsible_parties_on_responsible_party_type ON ctgov_v2.responsible_parties USING btree (responsible_party_type); -- --- Name: index_result_contacts_on_organization; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_result_contacts_on_organization; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_result_contacts_on_organization ON ctgov.result_contacts USING btree (organization); +CREATE INDEX index_result_contacts_on_organization ON ctgov_v2.result_contacts USING btree (organization); -- --- Name: index_result_groups_on_result_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_result_groups_on_result_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_result_groups_on_result_type ON ctgov.result_groups USING btree (result_type); +CREATE INDEX index_result_groups_on_result_type ON ctgov_v2.result_groups USING btree (result_type); -- --- Name: index_search_results_on_nct_id_and_name; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_search_results_on_nct_id_and_name; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE UNIQUE INDEX index_search_results_on_nct_id_and_name ON ctgov.search_results USING btree (nct_id, name); +CREATE UNIQUE INDEX index_search_results_on_nct_id_and_name ON ctgov_v2.search_results USING btree (nct_id, name); -- --- Name: index_search_results_on_nct_id_and_name_and_grouping; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_search_results_on_nct_id_and_name_and_grouping; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE UNIQUE INDEX index_search_results_on_nct_id_and_name_and_grouping ON ctgov.search_results USING btree (nct_id, name, "grouping"); +CREATE UNIQUE INDEX index_search_results_on_nct_id_and_name_and_grouping ON ctgov_v2.search_results USING btree (nct_id, name, "grouping"); -- --- Name: index_sponsors_on_agency_class; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_sponsors_on_agency_class; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_sponsors_on_agency_class ON ctgov.sponsors USING btree (agency_class); +CREATE INDEX index_sponsors_on_agency_class ON ctgov_v2.sponsors USING btree (agency_class); -- --- Name: index_sponsors_on_name; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_sponsors_on_name; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_sponsors_on_name ON ctgov.sponsors USING btree (name); +CREATE INDEX index_sponsors_on_name ON ctgov_v2.sponsors USING btree (name); -- --- Name: index_studies_on_completion_date; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_studies_on_completion_date; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_studies_on_completion_date ON ctgov.studies USING btree (completion_date); +CREATE INDEX index_studies_on_completion_date ON ctgov_v2.studies USING btree (completion_date); -- --- Name: index_studies_on_disposition_first_submitted_date; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_studies_on_disposition_first_submitted_date; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_studies_on_disposition_first_submitted_date ON ctgov.studies USING btree (disposition_first_submitted_date); +CREATE INDEX index_studies_on_disposition_first_submitted_date ON ctgov_v2.studies USING btree (disposition_first_submitted_date); -- --- Name: index_studies_on_enrollment_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_studies_on_enrollment_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_studies_on_enrollment_type ON ctgov.studies USING btree (enrollment_type); +CREATE INDEX index_studies_on_enrollment_type ON ctgov_v2.studies USING btree (enrollment_type); -- --- Name: index_studies_on_last_known_status; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_studies_on_last_known_status; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_studies_on_last_known_status ON ctgov.studies USING btree (last_known_status); +CREATE INDEX index_studies_on_last_known_status ON ctgov_v2.studies USING btree (last_known_status); -- --- Name: index_studies_on_last_update_submitted_date; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_studies_on_last_update_submitted_date; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_studies_on_last_update_submitted_date ON ctgov.studies USING btree (last_update_submitted_date); +CREATE INDEX index_studies_on_last_update_submitted_date ON ctgov_v2.studies USING btree (last_update_submitted_date); -- --- Name: index_studies_on_nct_id; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_studies_on_nct_id; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE UNIQUE INDEX index_studies_on_nct_id ON ctgov.studies USING btree (nct_id); +CREATE UNIQUE INDEX index_studies_on_nct_id ON ctgov_v2.studies USING btree (nct_id); -- --- Name: index_studies_on_overall_status; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_studies_on_overall_status; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_studies_on_overall_status ON ctgov.studies USING btree (overall_status); +CREATE INDEX index_studies_on_overall_status ON ctgov_v2.studies USING btree (overall_status); -- --- Name: index_studies_on_phase; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_studies_on_phase; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_studies_on_phase ON ctgov.studies USING btree (phase); +CREATE INDEX index_studies_on_phase ON ctgov_v2.studies USING btree (phase); -- --- Name: index_studies_on_primary_completion_date; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_studies_on_primary_completion_date; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_studies_on_primary_completion_date ON ctgov.studies USING btree (primary_completion_date); +CREATE INDEX index_studies_on_primary_completion_date ON ctgov_v2.studies USING btree (primary_completion_date); -- --- Name: index_studies_on_primary_completion_date_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_studies_on_primary_completion_date_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_studies_on_primary_completion_date_type ON ctgov.studies USING btree (primary_completion_date_type); +CREATE INDEX index_studies_on_primary_completion_date_type ON ctgov_v2.studies USING btree (primary_completion_date_type); -- --- Name: index_studies_on_results_first_submitted_date; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_studies_on_results_first_submitted_date; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_studies_on_results_first_submitted_date ON ctgov.studies USING btree (results_first_submitted_date); +CREATE INDEX index_studies_on_results_first_submitted_date ON ctgov_v2.studies USING btree (results_first_submitted_date); -- --- Name: index_studies_on_source; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_studies_on_source; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_studies_on_source ON ctgov.studies USING btree (source); +CREATE INDEX index_studies_on_source ON ctgov_v2.studies USING btree (source); -- --- Name: index_studies_on_start_date; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_studies_on_start_date; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_studies_on_start_date ON ctgov.studies USING btree (start_date); +CREATE INDEX index_studies_on_start_date ON ctgov_v2.studies USING btree (start_date); -- --- Name: index_studies_on_start_date_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_studies_on_start_date_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_studies_on_start_date_type ON ctgov.studies USING btree (start_date_type); +CREATE INDEX index_studies_on_start_date_type ON ctgov_v2.studies USING btree (start_date_type); -- --- Name: index_studies_on_study_first_submitted_date; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_studies_on_study_first_submitted_date; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_studies_on_study_first_submitted_date ON ctgov.studies USING btree (study_first_submitted_date); +CREATE INDEX index_studies_on_study_first_submitted_date ON ctgov_v2.studies USING btree (study_first_submitted_date); -- --- Name: index_studies_on_study_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_studies_on_study_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_studies_on_study_type ON ctgov.studies USING btree (study_type); +CREATE INDEX index_studies_on_study_type ON ctgov_v2.studies USING btree (study_type); -- --- Name: index_study_records_on_nct_id_and_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_study_records_on_nct_id_and_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE UNIQUE INDEX index_study_records_on_nct_id_and_type ON ctgov.study_records USING btree (nct_id, type); +CREATE UNIQUE INDEX index_study_records_on_nct_id_and_type ON ctgov_v2.study_records USING btree (nct_id, type); -- --- Name: index_study_references_on_reference_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_study_references_on_reference_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_study_references_on_reference_type ON ctgov.study_references USING btree (reference_type); +CREATE INDEX index_study_references_on_reference_type ON ctgov_v2.study_references USING btree (reference_type); -- --- Name: index_study_searches_on_query_and_grouping; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_study_searches_on_query_and_grouping; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE UNIQUE INDEX index_study_searches_on_query_and_grouping ON ctgov.study_searches USING btree (query, "grouping"); +CREATE UNIQUE INDEX index_study_searches_on_query_and_grouping ON ctgov_v2.study_searches USING btree (query, "grouping"); -- @@ -4522,6 +9380,21 @@ CREATE INDEX "index_support.study_xml_records_on_nct_id" ON support.study_xml_re CREATE TRIGGER category_insert_trigger INSTEAD OF INSERT ON ctgov.categories FOR EACH ROW EXECUTE FUNCTION ctgov.category_insert_function(); +-- +-- Name: categories category_insert_trigger; Type: TRIGGER; Schema: ctgov_v2; Owner: - +-- + +CREATE TRIGGER category_insert_trigger INSTEAD OF INSERT ON ctgov_v2.categories FOR EACH ROW EXECUTE FUNCTION ctgov_v2.category_insert_function(); + + +-- +-- Name: saved_queries fk_rails_add691a365; Type: FK CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.saved_queries + ADD CONSTRAINT fk_rails_add691a365 FOREIGN KEY (user_id) REFERENCES ctgov.users(id); + + -- -- Name: active_storage_attachments fk_rails_0276932754; Type: FK CONSTRAINT; Schema: support; Owner: - -- @@ -4558,19 +9431,27 @@ ALTER TABLE ONLY support.file_records -- PostgreSQL database dump complete -- -SET search_path TO ctgov,support,public; +SET search_path TO ctgov, support, public; INSERT INTO "schema_migrations" (version) VALUES +('20160214191640'), ('20160630191037'), ('20160910000000'), ('20160911000000'), +('20160912000000'), ('20161011000000'), ('20161030000000'), ('20170411000122'), +('20180226142044'), +('20180427144951'), +('20180813174540'), +('20181108174440'), +('20181208174440'), ('20181212000000'), ('20190115184850'), ('20190115204850'), ('20190301204850'), +('20190321174440'), ('20191125205210'), ('20200217214455'), ('20200217220919'), @@ -4588,6 +9469,9 @@ INSERT INTO "schema_migrations" (version) VALUES ('20210526192804'), ('20210601063550'), ('20211027133828'), +('20211027220743'), +('20211102194357'), +('20211109190158'), ('20220202152642'), ('20220207182529'), ('20220212033048'), @@ -4607,9 +9491,11 @@ INSERT INTO "schema_migrations" (version) VALUES ('20220928162956'), ('20220928175111'), ('20220930181441'), +('20221018210501'), ('20221122213435'), ('20221219165747'), ('20230102193531'), +('20230131123222'), ('20230214200400'), ('20230216205237'), ('20230416235053'), @@ -4620,6 +9506,8 @@ INSERT INTO "schema_migrations" (version) VALUES ('20240204045613'), ('20240204055613'), ('20240306012711'), -('20240324222521'); +('20240311192314'), +('20240324222521'), +('20240425154619'); diff --git a/db/public_structure.sql b/db/public_structure.sql index fa1688c1..09516d23 100644 --- a/db/public_structure.sql +++ b/db/public_structure.sql @@ -17,17 +17,10 @@ CREATE SCHEMA ctgov; -- --- Name: public; Type: SCHEMA; Schema: -; Owner: - +-- Name: ctgov_v2; Type: SCHEMA; Schema: -; Owner: - -- -CREATE SCHEMA public; - - --- --- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: - --- - -COMMENT ON SCHEMA public IS 'standard public schema'; +CREATE SCHEMA ctgov_v2; -- @@ -264,6 +257,233 @@ CREATE FUNCTION ctgov.study_summaries_for_condition(character varying) RETURNS T $_$; +-- +-- Name: category_insert_function(); Type: FUNCTION; Schema: ctgov_v2; Owner: - +-- + +CREATE FUNCTION ctgov_v2.category_insert_function() RETURNS trigger + LANGUAGE plpgsql + AS $$ + BEGIN + INSERT INTO ctgov_v2.search_results (id, nct_id, name, created_at, updated_at, grouping, study_search_id) + + VALUES (NEW.id, NEW.nct_id, NEW.name, NEW.created_at, NEW.updated_at, NEW.grouping, NEW.study_search_id); + RETURN NEW; + END; + $$; + + +-- +-- Name: ids_for_org(character varying); Type: FUNCTION; Schema: ctgov_v2; Owner: - +-- + +CREATE FUNCTION ctgov_v2.ids_for_org(character varying) RETURNS TABLE(nct_id character varying) + LANGUAGE sql + AS $_$ + SELECT DISTINCT nct_id FROM responsible_parties WHERE lower(affiliation) like lower($1) + UNION + SELECT DISTINCT nct_id FROM facilities WHERE lower(name) like lower($1) or lower(city) like lower($1) or lower(state) like lower($1) or lower(country) like lower($1) + UNION + SELECT DISTINCT nct_id FROM sponsors WHERE lower(name) like lower($1) + UNION + SELECT DISTINCT nct_id FROM result_contacts WHERE lower(organization) like lower($1) + ; + $_$; + + +-- +-- Name: ids_for_term(character varying); Type: FUNCTION; Schema: ctgov_v2; Owner: - +-- + +CREATE FUNCTION ctgov_v2.ids_for_term(character varying) RETURNS TABLE(nct_id character varying) + LANGUAGE sql + AS $_$ + SELECT DISTINCT nct_id FROM browse_conditions WHERE downcase_mesh_term like lower($1) + UNION + SELECT DISTINCT nct_id FROM browse_interventions WHERE downcase_mesh_term like lower($1) + UNION + SELECT DISTINCT nct_id FROM studies WHERE lower(brief_title) like lower($1) + UNION + SELECT DISTINCT nct_id FROM keywords WHERE lower(name) like lower($1) + ; + $_$; + + +-- +-- Name: study_summaries_for_condition(character varying); Type: FUNCTION; Schema: ctgov_v2; Owner: - +-- + +CREATE FUNCTION ctgov_v2.study_summaries_for_condition(character varying) RETURNS TABLE(nct_id character varying, title text, recruitment character varying, were_results_reported boolean, conditions text, interventions text, gender character varying, age text, phase character varying, enrollment integer, study_type character varying, sponsors text, other_ids text, study_first_submitted_date date, start_date date, completion_month_year character varying, last_update_submitted_date date, verification_month_year character varying, results_first_submitted_date date, acronym character varying, primary_completion_month_year character varying, outcome_measures text, disposition_first_submitted_date date, allocation character varying, intervention_model character varying, observational_model character varying, primary_purpose character varying, time_perspective character varying, masking character varying, masking_description text, intervention_model_description text, subject_masked boolean, caregiver_masked boolean, investigator_masked boolean, outcomes_assessor_masked boolean, number_of_facilities integer) + LANGUAGE sql + AS $_$ + SELECT DISTINCT s.nct_id, + s.brief_title, + s.overall_status, + cv.were_results_reported, + bc.mesh_term, + i.names as interventions, + e.gender, + CASE + WHEN e.minimum_age = 'N/A' AND e.maximum_age = 'N/A' THEN 'No age restriction' + WHEN e.minimum_age != 'N/A' AND e.maximum_age = 'N/A' THEN concat(e.minimum_age, ' and older') + WHEN e.minimum_age = 'N/A' AND e.maximum_age != 'N/A' THEN concat('up to ', e.maximum_age) + ELSE concat(e.minimum_age, ' to ', e.maximum_age) + END, + CASE + WHEN s.phase='N/A' THEN NULL + ELSE s.phase + END, + s.enrollment, + s.study_type, + sp.names as sponsors, + id.names as id_values, + s.study_first_submitted_date, + s.start_date, + s.completion_month_year, + s.last_update_submitted_date, + s.verification_month_year, + s.results_first_submitted_date, + s.acronym, + s.primary_completion_month_year, + o.names as design_outcomes, + s.disposition_first_submitted_date, + d.allocation, + d.intervention_model, + d.observational_model, + d.primary_purpose, + d.time_perspective, + d.masking, + d.masking_description, + d.intervention_model_description, + d.subject_masked, + d.caregiver_masked, + d.investigator_masked, + d.outcomes_assessor_masked, + cv.number_of_facilities + FROM studies s + INNER JOIN browse_conditions bc ON s.nct_id = bc.nct_id and bc.downcase_mesh_term like lower($1) + LEFT OUTER JOIN calculated_values cv ON s.nct_id = cv.nct_id + LEFT OUTER JOIN all_conditions c ON s.nct_id = c.nct_id + LEFT OUTER JOIN all_interventions i ON s.nct_id = i.nct_id + LEFT OUTER JOIN all_sponsors sp ON s.nct_id = sp.nct_id + LEFT OUTER JOIN eligibilities e ON s.nct_id = e.nct_id + LEFT OUTER JOIN all_id_information id ON s.nct_id = id.nct_id + LEFT OUTER JOIN all_design_outcomes o ON s.nct_id = o.nct_id + LEFT OUTER JOIN designs d ON s.nct_id = d.nct_id + UNION + SELECT DISTINCT s.nct_id, + s.brief_title, + s.overall_status, + cv.were_results_reported, + bc.name, + i.names as interventions, + e.gender, + CASE + WHEN e.minimum_age = 'N/A' AND e.maximum_age = 'N/A' THEN 'No age restriction' + WHEN e.minimum_age != 'N/A' AND e.maximum_age = 'N/A' THEN concat(e.minimum_age, ' and older') + WHEN e.minimum_age = 'N/A' AND e.maximum_age != 'N/A' THEN concat('up to ', e.maximum_age) + ELSE concat(e.minimum_age, ' to ', e.maximum_age) + END, + CASE + WHEN s.phase='N/A' THEN NULL + ELSE s.phase + END, + s.enrollment, + s.study_type, + sp.names as sponsors, + id.names as id_values, + s.study_first_submitted_date, + s.start_date, + s.completion_month_year, + s.last_update_submitted_date, + s.verification_month_year, + s.results_first_submitted_date, + s.acronym, + s.primary_completion_month_year, + o.names as design_outcomes, + s.disposition_first_submitted_date, + d.allocation, + d.intervention_model, + d.observational_model, + d.primary_purpose, + d.time_perspective, + d.masking, + d.masking_description, + d.intervention_model_description, + d.subject_masked, + d.caregiver_masked, + d.investigator_masked, + d.outcomes_assessor_masked, + cv.number_of_facilities + FROM studies s + INNER JOIN conditions bc ON s.nct_id = bc.nct_id and bc.downcase_name like lower($1) + LEFT OUTER JOIN calculated_values cv ON s.nct_id = cv.nct_id + LEFT OUTER JOIN all_conditions c ON s.nct_id = c.nct_id + LEFT OUTER JOIN all_interventions i ON s.nct_id = i.nct_id + LEFT OUTER JOIN all_sponsors sp ON s.nct_id = sp.nct_id + LEFT OUTER JOIN eligibilities e ON s.nct_id = e.nct_id + LEFT OUTER JOIN all_id_information id ON s.nct_id = id.nct_id + LEFT OUTER JOIN all_design_outcomes o ON s.nct_id = o.nct_id + LEFT OUTER JOIN designs d ON s.nct_id = d.nct_id + UNION + SELECT DISTINCT s.nct_id, + s.brief_title, + s.overall_status, + cv.were_results_reported, + k.name, + i.names as interventions, + e.gender, + CASE + WHEN e.minimum_age = 'N/A' AND e.maximum_age = 'N/A' THEN 'No age restriction' + WHEN e.minimum_age != 'N/A' AND e.maximum_age = 'N/A' THEN concat(e.minimum_age, ' and older') + WHEN e.minimum_age = 'N/A' AND e.maximum_age != 'N/A' THEN concat('up to ', e.maximum_age) + ELSE concat(e.minimum_age, ' to ', e.maximum_age) + END, + CASE + WHEN s.phase='N/A' THEN NULL + ELSE s.phase + END, + s.enrollment, + s.study_type, + sp.names as sponsors, + id.names as id_values, + s.study_first_submitted_date, + s.start_date, + s.completion_month_year, + s.last_update_submitted_date, + s.verification_month_year, + s.results_first_submitted_date, + s.acronym, + s.primary_completion_month_year, + o.names as outcome_measures, + s.disposition_first_submitted_date, + d.allocation, + d.intervention_model, + d.observational_model, + d.primary_purpose, + d.time_perspective, + d.masking, + d.masking_description, + d.intervention_model_description, + d.subject_masked, + d.caregiver_masked, + d.investigator_masked, + d.outcomes_assessor_masked, + cv.number_of_facilities + FROM studies s + INNER JOIN keywords k ON s.nct_id = k.nct_id and k.downcase_name like lower($1) + LEFT OUTER JOIN calculated_values cv ON s.nct_id = cv.nct_id + LEFT OUTER JOIN all_conditions c ON s.nct_id = c.nct_id + LEFT OUTER JOIN all_interventions i ON s.nct_id = i.nct_id + LEFT OUTER JOIN all_sponsors sp ON s.nct_id = sp.nct_id + LEFT OUTER JOIN eligibilities e ON s.nct_id = e.nct_id + LEFT OUTER JOIN all_id_information id ON s.nct_id = id.nct_id + LEFT OUTER JOIN all_design_outcomes o ON s.nct_id = o.nct_id + LEFT OUTER JOIN designs d ON s.nct_id = d.nct_id + ; + $_$; + + -- -- Name: count_estimate(text); Type: FUNCTION; Schema: public; Owner: - -- @@ -1027,41 +1247,120 @@ CREATE TABLE ctgov.eligibilities ( -- --- Name: covid_19_studies; Type: VIEW; Schema: ctgov; Owner: - +-- Name: studies; Type: TABLE; Schema: ctgov_v2; Owner: - -- -CREATE VIEW ctgov.covid_19_studies AS - SELECT s.nct_id, - s.overall_status, - s.study_type, - s.official_title, - s.acronym, - s.phase, - s.why_stopped, - s.has_dmc, - s.enrollment, - s.is_fda_regulated_device, - s.is_fda_regulated_drug, - s.is_unapproved_device, - s.has_expanded_access, - s.study_first_submitted_date, - s.last_update_posted_date, - s.results_first_posted_date, - s.start_date, - s.primary_completion_date, - s.completion_date, - s.study_first_posted_date, - cv.number_of_facilities, - cv.has_single_facility, - cv.nlm_download_date, - s.number_of_arms, - s.number_of_groups, - sp.name AS lead_sponsor, - aid.names AS other_ids, - e.gender, - e.gender_based, - e.gender_description, - e.population, +CREATE TABLE ctgov_v2.studies ( + nct_id character varying, + nlm_download_date_description character varying, + study_first_submitted_date date, + results_first_submitted_date date, + disposition_first_submitted_date date, + last_update_submitted_date date, + study_first_submitted_qc_date date, + study_first_posted_date date, + study_first_posted_date_type character varying, + results_first_submitted_qc_date date, + results_first_posted_date date, + results_first_posted_date_type character varying, + disposition_first_submitted_qc_date date, + disposition_first_posted_date date, + disposition_first_posted_date_type character varying, + last_update_submitted_qc_date date, + last_update_posted_date date, + last_update_posted_date_type character varying, + start_month_year character varying, + start_date_type character varying, + start_date date, + verification_month_year character varying, + verification_date date, + completion_month_year character varying, + completion_date_type character varying, + completion_date date, + primary_completion_month_year character varying, + primary_completion_date_type character varying, + primary_completion_date date, + target_duration character varying, + study_type character varying, + acronym character varying, + baseline_population text, + brief_title text, + official_title text, + overall_status character varying, + last_known_status character varying, + phase character varying, + enrollment integer, + enrollment_type character varying, + source character varying, + limitations_and_caveats character varying, + number_of_arms integer, + number_of_groups integer, + why_stopped character varying, + has_expanded_access boolean, + expanded_access_type_individual boolean, + expanded_access_type_intermediate boolean, + expanded_access_type_treatment boolean, + has_dmc boolean, + is_fda_regulated_drug boolean, + is_fda_regulated_device boolean, + is_unapproved_device boolean, + is_ppsd boolean, + is_us_export boolean, + biospec_retention character varying, + biospec_description text, + ipd_time_frame character varying, + ipd_access_criteria character varying, + ipd_url character varying, + plan_to_share_ipd character varying, + plan_to_share_ipd_description character varying, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL, + source_class character varying, + delayed_posting boolean, + expanded_access_nctid character varying, + expanded_access_status_for_nctid character varying, + fdaaa801_violation boolean, + baseline_type_units_analyzed character varying, + patient_registry boolean +); + + +-- +-- Name: covid_19_studies; Type: VIEW; Schema: ctgov; Owner: - +-- + +CREATE VIEW ctgov.covid_19_studies AS + SELECT s.nct_id, + s.overall_status, + s.study_type, + s.official_title, + s.acronym, + s.phase, + s.why_stopped, + s.has_dmc, + s.enrollment, + s.is_fda_regulated_device, + s.is_fda_regulated_drug, + s.is_unapproved_device, + s.has_expanded_access, + s.study_first_submitted_date, + s.last_update_posted_date, + s.results_first_posted_date, + s.start_date, + s.primary_completion_date, + s.completion_date, + s.study_first_posted_date, + cv.number_of_facilities, + cv.has_single_facility, + cv.nlm_download_date, + s.number_of_arms, + s.number_of_groups, + sp.name AS lead_sponsor, + aid.names AS other_ids, + e.gender, + e.gender_based, + e.gender_description, + e.population, e.minimum_age, e.maximum_age, e.criteria, @@ -1797,7 +2096,10 @@ CREATE TABLE ctgov.outcome_measurements ( dispersion_upper_limit numeric, explanation_of_na text, dispersion_upper_limit_raw character varying, - dispersion_lower_limit_raw character varying + dispersion_lower_limit_raw character varying, + denom_units character varying, + denom_value double precision, + denom_value_raw double precision ); @@ -2461,224 +2763,387 @@ ALTER SEQUENCE ctgov.study_searches_id_seq OWNED BY ctgov.study_searches.id; -- --- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: - +-- Name: browse_conditions; Type: TABLE; Schema: ctgov_v2; Owner: - -- -CREATE TABLE public.ar_internal_metadata ( - key character varying NOT NULL, - value character varying, - created_at timestamp(6) without time zone NOT NULL, - updated_at timestamp(6) without time zone NOT NULL +CREATE TABLE ctgov_v2.browse_conditions ( + id integer NOT NULL, + nct_id character varying, + mesh_term character varying, + downcase_mesh_term character varying, + mesh_type character varying ); -- --- Name: schema_migrations; Type: TABLE; Schema: public; Owner: - +-- Name: all_browse_conditions; Type: VIEW; Schema: ctgov_v2; Owner: - -- -CREATE TABLE public.schema_migrations ( - version character varying NOT NULL -); +CREATE VIEW ctgov_v2.all_browse_conditions AS + SELECT browse_conditions.nct_id, + array_to_string(array_agg(DISTINCT browse_conditions.mesh_term), '|'::text) AS names + FROM ctgov_v2.browse_conditions + GROUP BY browse_conditions.nct_id; -- --- Name: active_storage_attachments; Type: TABLE; Schema: support; Owner: - +-- Name: browse_interventions; Type: TABLE; Schema: ctgov_v2; Owner: - -- -CREATE TABLE support.active_storage_attachments ( - id bigint NOT NULL, - name character varying NOT NULL, - record_type character varying NOT NULL, - record_id bigint NOT NULL, - blob_id bigint NOT NULL, - created_at timestamp without time zone NOT NULL +CREATE TABLE ctgov_v2.browse_interventions ( + id integer NOT NULL, + nct_id character varying, + mesh_term character varying, + downcase_mesh_term character varying, + mesh_type character varying ); -- --- Name: active_storage_attachments_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- Name: all_browse_interventions; Type: VIEW; Schema: ctgov_v2; Owner: - -- -CREATE SEQUENCE support.active_storage_attachments_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; +CREATE VIEW ctgov_v2.all_browse_interventions AS + SELECT browse_interventions.nct_id, + array_to_string(array_agg(browse_interventions.mesh_term), '|'::text) AS names + FROM ctgov_v2.browse_interventions + GROUP BY browse_interventions.nct_id; -- --- Name: active_storage_attachments_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- Name: facilities; Type: TABLE; Schema: ctgov_v2; Owner: - -- -ALTER SEQUENCE support.active_storage_attachments_id_seq OWNED BY support.active_storage_attachments.id; +CREATE TABLE ctgov_v2.facilities ( + id integer NOT NULL, + nct_id character varying, + status character varying, + name character varying, + city character varying, + state character varying, + zip character varying, + country character varying +); -- --- Name: active_storage_blobs; Type: TABLE; Schema: support; Owner: - +-- Name: all_cities; Type: VIEW; Schema: ctgov_v2; Owner: - -- -CREATE TABLE support.active_storage_blobs ( - id bigint NOT NULL, - key character varying NOT NULL, - filename character varying NOT NULL, - content_type character varying, - metadata text, - byte_size bigint NOT NULL, - checksum character varying NOT NULL, - created_at timestamp without time zone NOT NULL -); +CREATE VIEW ctgov_v2.all_cities AS + SELECT facilities.nct_id, + array_to_string(array_agg(DISTINCT facilities.city), '|'::text) AS names + FROM ctgov_v2.facilities + GROUP BY facilities.nct_id; -- --- Name: active_storage_blobs_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- Name: conditions; Type: TABLE; Schema: ctgov_v2; Owner: - -- -CREATE SEQUENCE support.active_storage_blobs_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; +CREATE TABLE ctgov_v2.conditions ( + id integer NOT NULL, + nct_id character varying, + name character varying, + downcase_name character varying +); -- --- Name: active_storage_blobs_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- Name: all_conditions; Type: VIEW; Schema: ctgov_v2; Owner: - -- -ALTER SEQUENCE support.active_storage_blobs_id_seq OWNED BY support.active_storage_blobs.id; +CREATE VIEW ctgov_v2.all_conditions AS + SELECT conditions.nct_id, + array_to_string(array_agg(DISTINCT conditions.name), '|'::text) AS names + FROM ctgov_v2.conditions + GROUP BY conditions.nct_id; -- --- Name: background_jobs; Type: TABLE; Schema: support; Owner: - +-- Name: countries; Type: TABLE; Schema: ctgov_v2; Owner: - -- -CREATE TABLE support.background_jobs ( - id bigint NOT NULL, - user_id integer, - status character varying, - completed_at timestamp without time zone, - logs character varying, - type character varying, - data json, - url character varying, - created_at timestamp(6) without time zone NOT NULL, - updated_at timestamp(6) without time zone NOT NULL, - user_error_message character varying +CREATE TABLE ctgov_v2.countries ( + id integer NOT NULL, + nct_id character varying, + name character varying, + removed boolean ); -- --- Name: background_jobs_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- Name: all_countries; Type: VIEW; Schema: ctgov_v2; Owner: - -- -CREATE SEQUENCE support.background_jobs_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; +CREATE VIEW ctgov_v2.all_countries AS + SELECT countries.nct_id, + array_to_string(array_agg(DISTINCT countries.name), '|'::text) AS names + FROM ctgov_v2.countries + WHERE (countries.removed IS NOT TRUE) + GROUP BY countries.nct_id; -- --- Name: background_jobs_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- Name: design_outcomes; Type: TABLE; Schema: ctgov_v2; Owner: - -- -ALTER SEQUENCE support.background_jobs_id_seq OWNED BY support.background_jobs.id; +CREATE TABLE ctgov_v2.design_outcomes ( + id integer NOT NULL, + nct_id character varying, + outcome_type character varying, + measure text, + time_frame text, + population character varying, + description text +); -- --- Name: file_records; Type: TABLE; Schema: support; Owner: - +-- Name: all_design_outcomes; Type: VIEW; Schema: ctgov_v2; Owner: - -- -CREATE TABLE support.file_records ( - id bigint NOT NULL, - filename character varying, - file_size bigint, - file_type character varying, - created_at timestamp(6) without time zone NOT NULL, - updated_at timestamp(6) without time zone NOT NULL, - url character varying, - load_event_id bigint -); +CREATE VIEW ctgov_v2.all_design_outcomes AS + SELECT design_outcomes.nct_id, + array_to_string(array_agg(DISTINCT design_outcomes.measure), '|'::text) AS names + FROM ctgov_v2.design_outcomes + GROUP BY design_outcomes.nct_id; -- --- Name: file_records_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- Name: all_facilities; Type: VIEW; Schema: ctgov_v2; Owner: - -- -CREATE SEQUENCE support.file_records_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; +CREATE VIEW ctgov_v2.all_facilities AS + SELECT facilities.nct_id, + array_to_string(array_agg(facilities.name), '|'::text) AS names + FROM ctgov_v2.facilities + GROUP BY facilities.nct_id; -- --- Name: file_records_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- Name: design_groups; Type: TABLE; Schema: ctgov_v2; Owner: - -- -ALTER SEQUENCE support.file_records_id_seq OWNED BY support.file_records.id; - +CREATE TABLE ctgov_v2.design_groups ( + id integer NOT NULL, + nct_id character varying, + group_type character varying, + title character varying, + description text +); + -- --- Name: load_events; Type: TABLE; Schema: support; Owner: - +-- Name: all_group_types; Type: VIEW; Schema: ctgov_v2; Owner: - -- -CREATE TABLE support.load_events ( +CREATE VIEW ctgov_v2.all_group_types AS + SELECT design_groups.nct_id, + array_to_string(array_agg(DISTINCT design_groups.group_type), '|'::text) AS names + FROM ctgov_v2.design_groups + GROUP BY design_groups.nct_id; + + +-- +-- Name: id_information; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.id_information ( id integer NOT NULL, - event_type character varying, - status character varying, - description text, - problems text, - should_add integer, - should_change integer, - processed integer, - load_time character varying, - completed_at timestamp without time zone, - created_at timestamp without time zone NOT NULL, - updated_at timestamp without time zone NOT NULL + nct_id character varying, + id_source character varying, + id_value character varying, + id_type character varying, + id_type_description character varying, + id_link character varying ); -- --- Name: load_events_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- Name: all_id_information; Type: VIEW; Schema: ctgov_v2; Owner: - -- -CREATE SEQUENCE support.load_events_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; +CREATE VIEW ctgov_v2.all_id_information AS + SELECT id_information.nct_id, + array_to_string(array_agg(DISTINCT id_information.id_value), '|'::text) AS names + FROM ctgov_v2.id_information + GROUP BY id_information.nct_id; -- --- Name: load_events_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- Name: interventions; Type: TABLE; Schema: ctgov_v2; Owner: - -- -ALTER SEQUENCE support.load_events_id_seq OWNED BY support.load_events.id; +CREATE TABLE ctgov_v2.interventions ( + id integer NOT NULL, + nct_id character varying, + intervention_type character varying, + name character varying, + description text +); -- --- Name: load_issues; Type: TABLE; Schema: support; Owner: - +-- Name: all_intervention_types; Type: VIEW; Schema: ctgov_v2; Owner: - -- -CREATE TABLE support.load_issues ( - id bigint NOT NULL, - load_event_id bigint, +CREATE VIEW ctgov_v2.all_intervention_types AS + SELECT interventions.nct_id, + array_to_string(array_agg(interventions.intervention_type), '|'::text) AS names + FROM ctgov_v2.interventions + GROUP BY interventions.nct_id; + + +-- +-- Name: all_interventions; Type: VIEW; Schema: ctgov_v2; Owner: - +-- + +CREATE VIEW ctgov_v2.all_interventions AS + SELECT interventions.nct_id, + array_to_string(array_agg(interventions.name), '|'::text) AS names + FROM ctgov_v2.interventions + GROUP BY interventions.nct_id; + + +-- +-- Name: keywords; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.keywords ( + id integer NOT NULL, nct_id character varying, - message character varying + name character varying, + downcase_name character varying ); -- --- Name: load_issues_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- Name: all_keywords; Type: VIEW; Schema: ctgov_v2; Owner: - -- -CREATE SEQUENCE support.load_issues_id_seq +CREATE VIEW ctgov_v2.all_keywords AS + SELECT keywords.nct_id, + array_to_string(array_agg(DISTINCT keywords.name), '|'::text) AS names + FROM ctgov_v2.keywords + GROUP BY keywords.nct_id; + + +-- +-- Name: overall_officials; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.overall_officials ( + id integer NOT NULL, + nct_id character varying, + role character varying, + name character varying, + affiliation character varying +); + + +-- +-- Name: all_overall_official_affiliations; Type: VIEW; Schema: ctgov_v2; Owner: - +-- + +CREATE VIEW ctgov_v2.all_overall_official_affiliations AS + SELECT overall_officials.nct_id, + array_to_string(array_agg(overall_officials.affiliation), '|'::text) AS names + FROM ctgov_v2.overall_officials + GROUP BY overall_officials.nct_id; + + +-- +-- Name: all_overall_officials; Type: VIEW; Schema: ctgov_v2; Owner: - +-- + +CREATE VIEW ctgov_v2.all_overall_officials AS + SELECT overall_officials.nct_id, + array_to_string(array_agg(overall_officials.name), '|'::text) AS names + FROM ctgov_v2.overall_officials + GROUP BY overall_officials.nct_id; + + +-- +-- Name: all_primary_outcome_measures; Type: VIEW; Schema: ctgov_v2; Owner: - +-- + +CREATE VIEW ctgov_v2.all_primary_outcome_measures AS + SELECT design_outcomes.nct_id, + array_to_string(array_agg(DISTINCT design_outcomes.measure), '|'::text) AS names + FROM ctgov_v2.design_outcomes + WHERE ((design_outcomes.outcome_type)::text = 'primary'::text) + GROUP BY design_outcomes.nct_id; + + +-- +-- Name: all_secondary_outcome_measures; Type: VIEW; Schema: ctgov_v2; Owner: - +-- + +CREATE VIEW ctgov_v2.all_secondary_outcome_measures AS + SELECT design_outcomes.nct_id, + array_to_string(array_agg(DISTINCT design_outcomes.measure), '|'::text) AS names + FROM ctgov_v2.design_outcomes + WHERE ((design_outcomes.outcome_type)::text = 'secondary'::text) + GROUP BY design_outcomes.nct_id; + + +-- +-- Name: sponsors; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.sponsors ( + id integer NOT NULL, + nct_id character varying, + agency_class character varying, + lead_or_collaborator character varying, + name character varying +); + + +-- +-- Name: all_sponsors; Type: VIEW; Schema: ctgov_v2; Owner: - +-- + +CREATE VIEW ctgov_v2.all_sponsors AS + SELECT sponsors.nct_id, + array_to_string(array_agg(DISTINCT sponsors.name), '|'::text) AS names + FROM ctgov_v2.sponsors + GROUP BY sponsors.nct_id; + + +-- +-- Name: all_states; Type: VIEW; Schema: ctgov_v2; Owner: - +-- + +CREATE VIEW ctgov_v2.all_states AS + SELECT facilities.nct_id, + array_to_string(array_agg(DISTINCT facilities.state), '|'::text) AS names + FROM ctgov_v2.facilities + GROUP BY facilities.nct_id; + + +-- +-- Name: baseline_counts; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.baseline_counts ( + id integer NOT NULL, + nct_id character varying, + result_group_id integer, + ctgov_v2_group_code character varying, + units character varying, + scope character varying, + count integer +); + + +-- +-- Name: baseline_counts_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.baseline_counts_id_seq + AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -2687,36 +3152,47 @@ CREATE SEQUENCE support.load_issues_id_seq -- --- Name: load_issues_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- Name: baseline_counts_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - -- -ALTER SEQUENCE support.load_issues_id_seq OWNED BY support.load_issues.id; +ALTER SEQUENCE ctgov_v2.baseline_counts_id_seq OWNED BY ctgov_v2.baseline_counts.id; -- --- Name: sanity_checks; Type: TABLE; Schema: support; Owner: - +-- Name: baseline_measurements; Type: TABLE; Schema: ctgov_v2; Owner: - -- -CREATE TABLE support.sanity_checks ( +CREATE TABLE ctgov_v2.baseline_measurements ( id integer NOT NULL, - table_name character varying, nct_id character varying, - column_name character varying, - check_type character varying, - row_count integer, + result_group_id integer, + ctgov_v2_group_code character varying, + classification character varying, + category character varying, + title character varying, description text, - most_current boolean, - created_at timestamp without time zone NOT NULL, - updated_at timestamp without time zone NOT NULL, - load_event_id bigint + units character varying, + param_type character varying, + param_value character varying, + param_value_num numeric, + dispersion_type character varying, + dispersion_value character varying, + dispersion_value_num numeric, + dispersion_lower_limit numeric, + dispersion_upper_limit numeric, + explanation_of_na character varying, + number_analyzed integer, + number_analyzed_units character varying, + population_description character varying, + calculate_percentage character varying ); -- --- Name: sanity_checks_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- Name: baseline_measurements_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - -- -CREATE SEQUENCE support.sanity_checks_id_seq +CREATE SEQUENCE ctgov_v2.baseline_measurements_id_seq AS integer START WITH 1 INCREMENT BY 1 @@ -2726,33 +3202,28 @@ CREATE SEQUENCE support.sanity_checks_id_seq -- --- Name: sanity_checks_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- Name: baseline_measurements_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - -- -ALTER SEQUENCE support.sanity_checks_id_seq OWNED BY support.sanity_checks.id; +ALTER SEQUENCE ctgov_v2.baseline_measurements_id_seq OWNED BY ctgov_v2.baseline_measurements.id; -- --- Name: study_json_records; Type: TABLE; Schema: support; Owner: - +-- Name: brief_summaries; Type: TABLE; Schema: ctgov_v2; Owner: - -- -CREATE TABLE support.study_json_records ( +CREATE TABLE ctgov_v2.brief_summaries ( id integer NOT NULL, - nct_id character varying NOT NULL, - content jsonb NOT NULL, - saved_study_at timestamp without time zone, - created_at timestamp without time zone NOT NULL, - updated_at timestamp without time zone NOT NULL, - download_date character varying, - version character varying DEFAULT '1'::character varying + nct_id character varying, + description text ); -- --- Name: study_json_records_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- Name: brief_summaries_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - -- -CREATE SEQUENCE support.study_json_records_id_seq +CREATE SEQUENCE ctgov_v2.brief_summaries_id_seq AS integer START WITH 1 INCREMENT BY 1 @@ -2762,32 +3233,38 @@ CREATE SEQUENCE support.study_json_records_id_seq -- --- Name: study_json_records_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- Name: brief_summaries_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - -- -ALTER SEQUENCE support.study_json_records_id_seq OWNED BY support.study_json_records.id; +ALTER SEQUENCE ctgov_v2.brief_summaries_id_seq OWNED BY ctgov_v2.brief_summaries.id; -- --- Name: study_statistics_comparisons; Type: TABLE; Schema: support; Owner: - +-- Name: browse_conditions_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - -- -CREATE TABLE support.study_statistics_comparisons ( - id bigint NOT NULL, - ctgov_selector character varying, - "table" character varying, - "column" character varying, - condition character varying, - instances_query character varying, - unique_query character varying -); +CREATE SEQUENCE ctgov_v2.browse_conditions_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; -- --- Name: study_statistics_comparisons_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- Name: browse_conditions_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - -- -CREATE SEQUENCE support.study_statistics_comparisons_id_seq +ALTER SEQUENCE ctgov_v2.browse_conditions_id_seq OWNED BY ctgov_v2.browse_conditions.id; + + +-- +-- Name: browse_interventions_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.browse_interventions_id_seq + AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -2796,1625 +3273,4837 @@ CREATE SEQUENCE support.study_statistics_comparisons_id_seq -- --- Name: study_statistics_comparisons_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- Name: browse_interventions_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - -- -ALTER SEQUENCE support.study_statistics_comparisons_id_seq OWNED BY support.study_statistics_comparisons.id; +ALTER SEQUENCE ctgov_v2.browse_interventions_id_seq OWNED BY ctgov_v2.browse_interventions.id; -- --- Name: study_xml_records; Type: TABLE; Schema: support; Owner: - +-- Name: calculated_values; Type: TABLE; Schema: ctgov_v2; Owner: - -- -CREATE TABLE support.study_xml_records ( +CREATE TABLE ctgov_v2.calculated_values ( id integer NOT NULL, nct_id character varying, - content xml, - created_study_at timestamp without time zone, - created_at timestamp without time zone NOT NULL, - updated_at timestamp without time zone NOT NULL -); + number_of_facilities integer, + number_of_nsae_subjects integer, + number_of_sae_subjects integer, + registered_in_calendar_year integer, + nlm_download_date date, + actual_duration integer, + were_results_reported boolean DEFAULT false, + months_to_report_results integer, + has_us_facility boolean, + has_single_facility boolean DEFAULT false, + minimum_age_num integer, + maximum_age_num integer, + minimum_age_unit character varying, + maximum_age_unit character varying, + number_of_primary_outcomes_to_measure integer, + number_of_secondary_outcomes_to_measure integer, + number_of_other_outcomes_to_measure integer +); + + +-- +-- Name: calculated_values_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.calculated_values_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: calculated_values_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.calculated_values_id_seq OWNED BY ctgov_v2.calculated_values.id; + + +-- +-- Name: search_results; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.search_results ( + id integer NOT NULL, + nct_id character varying NOT NULL, + name character varying NOT NULL, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL, + "grouping" character varying DEFAULT ''::character varying NOT NULL, + study_search_id integer +); + + +-- +-- Name: categories; Type: VIEW; Schema: ctgov_v2; Owner: - +-- + +CREATE VIEW ctgov_v2.categories AS + SELECT search_results.id, + search_results.nct_id, + search_results.name, + search_results.created_at, + search_results.updated_at, + search_results."grouping", + search_results.study_search_id + FROM ctgov_v2.search_results; + + +-- +-- Name: categories_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.categories_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: central_contacts; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.central_contacts ( + id integer NOT NULL, + nct_id character varying, + contact_type character varying, + name character varying, + phone character varying, + email character varying, + phone_extension character varying, + role character varying +); + + +-- +-- Name: central_contacts_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.central_contacts_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: central_contacts_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.central_contacts_id_seq OWNED BY ctgov_v2.central_contacts.id; + + +-- +-- Name: conditions_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.conditions_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: conditions_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.conditions_id_seq OWNED BY ctgov_v2.conditions.id; + + +-- +-- Name: countries_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.countries_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: countries_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.countries_id_seq OWNED BY ctgov_v2.countries.id; + + +-- +-- Name: design_group_interventions; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.design_group_interventions ( + id integer NOT NULL, + nct_id character varying, + design_group_id integer, + intervention_id integer +); + + +-- +-- Name: design_group_interventions_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.design_group_interventions_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: design_group_interventions_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.design_group_interventions_id_seq OWNED BY ctgov_v2.design_group_interventions.id; + + +-- +-- Name: design_groups_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.design_groups_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: design_groups_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.design_groups_id_seq OWNED BY ctgov_v2.design_groups.id; + + +-- +-- Name: design_outcomes_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.design_outcomes_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: design_outcomes_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.design_outcomes_id_seq OWNED BY ctgov_v2.design_outcomes.id; + + +-- +-- Name: designs; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.designs ( + id integer NOT NULL, + nct_id character varying, + allocation character varying, + intervention_model character varying, + observational_model character varying, + primary_purpose character varying, + time_perspective character varying, + masking character varying, + masking_description text, + intervention_model_description text, + subject_masked boolean, + caregiver_masked boolean, + investigator_masked boolean, + outcomes_assessor_masked boolean +); + + +-- +-- Name: designs_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.designs_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: designs_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.designs_id_seq OWNED BY ctgov_v2.designs.id; + + +-- +-- Name: detailed_descriptions; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.detailed_descriptions ( + id integer NOT NULL, + nct_id character varying, + description text +); + + +-- +-- Name: detailed_descriptions_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.detailed_descriptions_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: detailed_descriptions_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.detailed_descriptions_id_seq OWNED BY ctgov_v2.detailed_descriptions.id; + + +-- +-- Name: documents; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.documents ( + id integer NOT NULL, + nct_id character varying, + document_id character varying, + document_type character varying, + url character varying, + comment text +); + + +-- +-- Name: documents_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.documents_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: documents_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.documents_id_seq OWNED BY ctgov_v2.documents.id; + + +-- +-- Name: drop_withdrawals; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.drop_withdrawals ( + id integer NOT NULL, + nct_id character varying, + result_group_id integer, + ctgov_v2_group_code character varying, + period character varying, + reason character varying, + count integer, + drop_withdraw_comment character varying, + reason_comment character varying, + count_units integer +); + + +-- +-- Name: drop_withdrawals_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.drop_withdrawals_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: drop_withdrawals_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.drop_withdrawals_id_seq OWNED BY ctgov_v2.drop_withdrawals.id; + + +-- +-- Name: eligibilities; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.eligibilities ( + id integer NOT NULL, + nct_id character varying, + sampling_method character varying, + gender character varying, + minimum_age character varying, + maximum_age character varying, + healthy_volunteers boolean, + population text, + criteria text, + gender_description text, + gender_based boolean, + adult boolean, + child boolean, + older_adult boolean +); + + +-- +-- Name: eligibilities_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.eligibilities_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: eligibilities_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.eligibilities_id_seq OWNED BY ctgov_v2.eligibilities.id; + + +-- +-- Name: facilities_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.facilities_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: facilities_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.facilities_id_seq OWNED BY ctgov_v2.facilities.id; + + +-- +-- Name: facility_contacts; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.facility_contacts ( + id integer NOT NULL, + nct_id character varying, + facility_id integer, + contact_type character varying, + name character varying, + email character varying, + phone character varying, + phone_extension character varying +); + + +-- +-- Name: facility_contacts_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.facility_contacts_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: facility_contacts_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.facility_contacts_id_seq OWNED BY ctgov_v2.facility_contacts.id; + + +-- +-- Name: facility_investigators; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.facility_investigators ( + id integer NOT NULL, + nct_id character varying, + facility_id integer, + role character varying, + name character varying +); + + +-- +-- Name: facility_investigators_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.facility_investigators_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: facility_investigators_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.facility_investigators_id_seq OWNED BY ctgov_v2.facility_investigators.id; + + +-- +-- Name: id_information_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.id_information_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: id_information_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.id_information_id_seq OWNED BY ctgov_v2.id_information.id; + + +-- +-- Name: intervention_other_names; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.intervention_other_names ( + id integer NOT NULL, + nct_id character varying, + intervention_id integer, + name character varying +); + + +-- +-- Name: intervention_other_names_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.intervention_other_names_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: intervention_other_names_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.intervention_other_names_id_seq OWNED BY ctgov_v2.intervention_other_names.id; + + +-- +-- Name: interventions_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.interventions_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: interventions_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.interventions_id_seq OWNED BY ctgov_v2.interventions.id; + + +-- +-- Name: ipd_information_types; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.ipd_information_types ( + id integer NOT NULL, + nct_id character varying, + name character varying +); + + +-- +-- Name: ipd_information_types_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.ipd_information_types_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: ipd_information_types_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.ipd_information_types_id_seq OWNED BY ctgov_v2.ipd_information_types.id; + + +-- +-- Name: keywords_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.keywords_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: keywords_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.keywords_id_seq OWNED BY ctgov_v2.keywords.id; + + +-- +-- Name: links; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.links ( + id integer NOT NULL, + nct_id character varying, + url character varying, + description text +); + + +-- +-- Name: links_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.links_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: links_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.links_id_seq OWNED BY ctgov_v2.links.id; + + +-- +-- Name: mesh_headings; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.mesh_headings ( + id integer NOT NULL, + qualifier character varying, + heading character varying, + subcategory character varying +); + + +-- +-- Name: mesh_headings_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.mesh_headings_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: mesh_headings_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.mesh_headings_id_seq OWNED BY ctgov_v2.mesh_headings.id; + + +-- +-- Name: mesh_terms; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.mesh_terms ( + id integer NOT NULL, + qualifier character varying, + tree_number character varying, + description character varying, + mesh_term character varying, + downcase_mesh_term character varying +); + + +-- +-- Name: mesh_terms_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.mesh_terms_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: mesh_terms_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.mesh_terms_id_seq OWNED BY ctgov_v2.mesh_terms.id; + + +-- +-- Name: milestones; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.milestones ( + id integer NOT NULL, + nct_id character varying, + result_group_id integer, + ctgov_v2_group_code character varying, + title character varying, + period character varying, + description text, + count integer, + milestone_description character varying, + count_units character varying +); + + +-- +-- Name: milestones_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.milestones_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: milestones_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.milestones_id_seq OWNED BY ctgov_v2.milestones.id; + + +-- +-- Name: outcome_analyses; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.outcome_analyses ( + id integer NOT NULL, + nct_id character varying, + outcome_id integer, + non_inferiority_type character varying, + non_inferiority_description text, + param_type character varying, + param_value numeric, + dispersion_type character varying, + dispersion_value numeric, + p_value_modifier character varying, + p_value double precision, + ci_n_sides character varying, + ci_percent numeric, + ci_lower_limit numeric, + ci_upper_limit numeric, + ci_upper_limit_na_comment character varying, + p_value_description character varying, + method character varying, + method_description text, + estimate_description text, + groups_description text, + other_analysis_description text, + ci_upper_limit_raw character varying, + ci_lower_limit_raw character varying, + p_value_raw character varying +); + + +-- +-- Name: outcome_analyses_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.outcome_analyses_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: outcome_analyses_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.outcome_analyses_id_seq OWNED BY ctgov_v2.outcome_analyses.id; + + +-- +-- Name: outcome_analysis_groups; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.outcome_analysis_groups ( + id integer NOT NULL, + nct_id character varying, + outcome_analysis_id integer, + result_group_id integer, + ctgov_v2_group_code character varying +); + + +-- +-- Name: outcome_analysis_groups_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.outcome_analysis_groups_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: outcome_analysis_groups_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.outcome_analysis_groups_id_seq OWNED BY ctgov_v2.outcome_analysis_groups.id; + + +-- +-- Name: outcome_counts; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.outcome_counts ( + id integer NOT NULL, + nct_id character varying, + outcome_id integer, + result_group_id integer, + ctgov_v2_group_code character varying, + scope character varying, + units character varying, + count integer +); + + +-- +-- Name: outcome_counts_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.outcome_counts_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: outcome_counts_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.outcome_counts_id_seq OWNED BY ctgov_v2.outcome_counts.id; + + +-- +-- Name: outcome_measurements; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.outcome_measurements ( + id integer NOT NULL, + nct_id character varying, + outcome_id integer, + result_group_id integer, + ctgov_v2_group_code character varying, + classification character varying, + category character varying, + title character varying, + description text, + units character varying, + param_type character varying, + param_value character varying, + param_value_num numeric, + dispersion_type character varying, + dispersion_value character varying, + dispersion_value_num numeric, + dispersion_lower_limit numeric, + dispersion_upper_limit numeric, + explanation_of_na text, + dispersion_upper_limit_raw character varying, + dispersion_lower_limit_raw character varying +); + + +-- +-- Name: outcome_measurements_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.outcome_measurements_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: outcome_measurements_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.outcome_measurements_id_seq OWNED BY ctgov_v2.outcome_measurements.id; + + +-- +-- Name: outcomes; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.outcomes ( + id integer NOT NULL, + nct_id character varying, + outcome_type character varying, + title text, + description text, + time_frame text, + population text, + anticipated_posting_date date, + anticipated_posting_month_year character varying, + units character varying, + units_analyzed character varying, + dispersion_type character varying, + param_type character varying +); + + +-- +-- Name: outcomes_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.outcomes_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: outcomes_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.outcomes_id_seq OWNED BY ctgov_v2.outcomes.id; + + +-- +-- Name: overall_officials_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.overall_officials_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: overall_officials_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.overall_officials_id_seq OWNED BY ctgov_v2.overall_officials.id; + + +-- +-- Name: participant_flows; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.participant_flows ( + id integer NOT NULL, + nct_id character varying, + recruitment_details text, + pre_assignment_details text, + units_analyzed character varying +); + + +-- +-- Name: participant_flows_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.participant_flows_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: participant_flows_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.participant_flows_id_seq OWNED BY ctgov_v2.participant_flows.id; + + +-- +-- Name: pending_results; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.pending_results ( + id integer NOT NULL, + nct_id character varying, + event character varying, + event_date_description character varying, + event_date date +); + + +-- +-- Name: pending_results_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.pending_results_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: pending_results_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.pending_results_id_seq OWNED BY ctgov_v2.pending_results.id; + + +-- +-- Name: provided_documents; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.provided_documents ( + id integer NOT NULL, + nct_id character varying, + document_type character varying, + has_protocol boolean, + has_icf boolean, + has_sap boolean, + document_date date, + url character varying +); + + +-- +-- Name: provided_documents_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.provided_documents_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: provided_documents_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.provided_documents_id_seq OWNED BY ctgov_v2.provided_documents.id; + + +-- +-- Name: reported_event_totals; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.reported_event_totals ( + id integer NOT NULL, + nct_id character varying NOT NULL, + ctgov_v2_group_code character varying NOT NULL, + event_type character varying, + classification character varying NOT NULL, + subjects_affected integer, + subjects_at_risk integer, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL +); + + +-- +-- Name: reported_event_totals_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.reported_event_totals_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: reported_event_totals_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.reported_event_totals_id_seq OWNED BY ctgov_v2.reported_event_totals.id; + + +-- +-- Name: reported_events; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.reported_events ( + id integer NOT NULL, + nct_id character varying, + result_group_id integer, + ctgov_v2_group_code character varying, + time_frame text, + event_type character varying, + default_vocab character varying, + default_assessment character varying, + subjects_affected integer, + subjects_at_risk integer, + description text, + event_count integer, + organ_system character varying, + adverse_event_term character varying, + frequency_threshold integer, + vocab character varying, + assessment character varying +); + + +-- +-- Name: reported_events_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.reported_events_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: reported_events_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.reported_events_id_seq OWNED BY ctgov_v2.reported_events.id; + + +-- +-- Name: responsible_parties; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.responsible_parties ( + id integer NOT NULL, + nct_id character varying, + responsible_party_type character varying, + name character varying, + title character varying, + organization character varying, + affiliation text, + old_name_title character varying +); + + +-- +-- Name: responsible_parties_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.responsible_parties_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: responsible_parties_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.responsible_parties_id_seq OWNED BY ctgov_v2.responsible_parties.id; + + +-- +-- Name: result_agreements; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.result_agreements ( + id integer NOT NULL, + nct_id character varying, + pi_employee boolean, + agreement text, + restriction_type character varying, + other_details text, + restrictive_agreement boolean +); + + +-- +-- Name: result_agreements_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.result_agreements_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: result_agreements_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.result_agreements_id_seq OWNED BY ctgov_v2.result_agreements.id; + + +-- +-- Name: result_contacts; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.result_contacts ( + id integer NOT NULL, + nct_id character varying, + organization character varying, + name character varying, + phone character varying, + email character varying, + extension character varying +); + + +-- +-- Name: result_contacts_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.result_contacts_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: result_contacts_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.result_contacts_id_seq OWNED BY ctgov_v2.result_contacts.id; + + +-- +-- Name: result_groups; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.result_groups ( + id integer NOT NULL, + nct_id character varying, + ctgov_v2_group_code character varying, + result_type character varying, + title character varying, + description text +); + + +-- +-- Name: result_groups_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.result_groups_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: result_groups_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.result_groups_id_seq OWNED BY ctgov_v2.result_groups.id; + + +-- +-- Name: retractions; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.retractions ( + id bigint NOT NULL, + reference_id integer, + pmid character varying, + source character varying, + nct_id character varying +); + + +-- +-- Name: retractions_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.retractions_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: retractions_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.retractions_id_seq OWNED BY ctgov_v2.retractions.id; + + +-- +-- Name: search_results_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.search_results_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: search_results_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.search_results_id_seq OWNED BY ctgov_v2.search_results.id; + + +-- +-- Name: sponsors_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.sponsors_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: sponsors_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.sponsors_id_seq OWNED BY ctgov_v2.sponsors.id; + + +-- +-- Name: study_records; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.study_records ( + id bigint NOT NULL, + nct_id character varying, + type character varying, + content json, + sha character varying, + created_at timestamp(6) without time zone NOT NULL, + updated_at timestamp(6) without time zone NOT NULL +); + + +-- +-- Name: study_records_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.study_records_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: study_records_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.study_records_id_seq OWNED BY ctgov_v2.study_records.id; + + +-- +-- Name: study_references; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.study_references ( + id integer NOT NULL, + nct_id character varying, + pmid character varying, + reference_type character varying, + citation text +); + + +-- +-- Name: study_references_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.study_references_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: study_references_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.study_references_id_seq OWNED BY ctgov_v2.study_references.id; + + +-- +-- Name: study_searches; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.study_searches ( + id integer NOT NULL, + save_tsv boolean DEFAULT false NOT NULL, + query character varying NOT NULL, + "grouping" character varying DEFAULT ''::character varying NOT NULL, + name character varying DEFAULT ''::character varying NOT NULL, + beta_api boolean DEFAULT false NOT NULL, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL, + active boolean +); + + +-- +-- Name: study_searches_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.study_searches_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: study_searches_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.study_searches_id_seq OWNED BY ctgov_v2.study_searches.id; + + +-- +-- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.ar_internal_metadata ( + key character varying NOT NULL, + value character varying, + created_at timestamp(6) without time zone NOT NULL, + updated_at timestamp(6) without time zone NOT NULL +); + + +-- +-- Name: schema_migrations; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.schema_migrations ( + version character varying NOT NULL +); + + +-- +-- Name: active_storage_attachments; Type: TABLE; Schema: support; Owner: - +-- + +CREATE TABLE support.active_storage_attachments ( + id bigint NOT NULL, + name character varying NOT NULL, + record_type character varying NOT NULL, + record_id bigint NOT NULL, + blob_id bigint NOT NULL, + created_at timestamp without time zone NOT NULL +); + + +-- +-- Name: active_storage_attachments_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- + +CREATE SEQUENCE support.active_storage_attachments_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: active_storage_attachments_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- + +ALTER SEQUENCE support.active_storage_attachments_id_seq OWNED BY support.active_storage_attachments.id; + + +-- +-- Name: active_storage_blobs; Type: TABLE; Schema: support; Owner: - +-- + +CREATE TABLE support.active_storage_blobs ( + id bigint NOT NULL, + key character varying NOT NULL, + filename character varying NOT NULL, + content_type character varying, + metadata text, + byte_size bigint NOT NULL, + checksum character varying NOT NULL, + created_at timestamp without time zone NOT NULL +); + + +-- +-- Name: active_storage_blobs_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- + +CREATE SEQUENCE support.active_storage_blobs_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: active_storage_blobs_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- + +ALTER SEQUENCE support.active_storage_blobs_id_seq OWNED BY support.active_storage_blobs.id; + + +-- +-- Name: background_jobs; Type: TABLE; Schema: support; Owner: - +-- + +CREATE TABLE support.background_jobs ( + id bigint NOT NULL, + user_id integer, + status character varying, + completed_at timestamp without time zone, + logs character varying, + type character varying, + data json, + url character varying, + created_at timestamp(6) without time zone NOT NULL, + updated_at timestamp(6) without time zone NOT NULL, + user_error_message character varying +); + + +-- +-- Name: background_jobs_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- + +CREATE SEQUENCE support.background_jobs_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: background_jobs_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- + +ALTER SEQUENCE support.background_jobs_id_seq OWNED BY support.background_jobs.id; + + +-- +-- Name: file_records; Type: TABLE; Schema: support; Owner: - +-- + +CREATE TABLE support.file_records ( + id bigint NOT NULL, + filename character varying, + file_size bigint, + file_type character varying, + created_at timestamp(6) without time zone NOT NULL, + updated_at timestamp(6) without time zone NOT NULL, + url character varying, + load_event_id bigint +); + + +-- +-- Name: file_records_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- + +CREATE SEQUENCE support.file_records_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: file_records_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- + +ALTER SEQUENCE support.file_records_id_seq OWNED BY support.file_records.id; + + +-- +-- Name: load_events; Type: TABLE; Schema: support; Owner: - +-- + +CREATE TABLE support.load_events ( + id integer NOT NULL, + event_type character varying, + status character varying, + description text, + problems text, + should_add integer, + should_change integer, + processed integer, + load_time character varying, + completed_at timestamp without time zone, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL +); + + +-- +-- Name: load_events_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- + +CREATE SEQUENCE support.load_events_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: load_events_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- + +ALTER SEQUENCE support.load_events_id_seq OWNED BY support.load_events.id; + + +-- +-- Name: load_issues; Type: TABLE; Schema: support; Owner: - +-- + +CREATE TABLE support.load_issues ( + id bigint NOT NULL, + load_event_id bigint, + nct_id character varying, + message character varying +); + + +-- +-- Name: load_issues_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- + +CREATE SEQUENCE support.load_issues_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: load_issues_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- + +ALTER SEQUENCE support.load_issues_id_seq OWNED BY support.load_issues.id; + + +-- +-- Name: sanity_checks; Type: TABLE; Schema: support; Owner: - +-- + +CREATE TABLE support.sanity_checks ( + id integer NOT NULL, + table_name character varying, + nct_id character varying, + column_name character varying, + check_type character varying, + row_count integer, + description text, + most_current boolean, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL, + load_event_id bigint +); + + +-- +-- Name: sanity_checks_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- + +CREATE SEQUENCE support.sanity_checks_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: sanity_checks_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- + +ALTER SEQUENCE support.sanity_checks_id_seq OWNED BY support.sanity_checks.id; + + +-- +-- Name: study_json_records; Type: TABLE; Schema: support; Owner: - +-- + +CREATE TABLE support.study_json_records ( + id integer NOT NULL, + nct_id character varying NOT NULL, + content jsonb NOT NULL, + saved_study_at timestamp without time zone, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL, + download_date character varying, + version character varying DEFAULT '1'::character varying +); + + +-- +-- Name: study_json_records_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- + +CREATE SEQUENCE support.study_json_records_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: study_json_records_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- + +ALTER SEQUENCE support.study_json_records_id_seq OWNED BY support.study_json_records.id; + + +-- +-- Name: study_statistics_comparisons; Type: TABLE; Schema: support; Owner: - +-- + +CREATE TABLE support.study_statistics_comparisons ( + id bigint NOT NULL, + ctgov_selector character varying, + "table" character varying, + "column" character varying, + condition character varying, + instances_query character varying, + unique_query character varying +); + + +-- +-- Name: study_statistics_comparisons_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- + +CREATE SEQUENCE support.study_statistics_comparisons_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: study_statistics_comparisons_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- + +ALTER SEQUENCE support.study_statistics_comparisons_id_seq OWNED BY support.study_statistics_comparisons.id; + + +-- +-- Name: study_xml_records; Type: TABLE; Schema: support; Owner: - +-- + +CREATE TABLE support.study_xml_records ( + id integer NOT NULL, + nct_id character varying, + content xml, + created_study_at timestamp without time zone, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL +); + + +-- +-- Name: study_xml_records_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- + +CREATE SEQUENCE support.study_xml_records_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: study_xml_records_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- + +ALTER SEQUENCE support.study_xml_records_id_seq OWNED BY support.study_xml_records.id; + + +-- +-- Name: verifiers; Type: TABLE; Schema: support; Owner: - +-- + +CREATE TABLE support.verifiers ( + id bigint NOT NULL, + differences json DEFAULT '[]'::json NOT NULL, + last_run timestamp without time zone, + source json, + created_at timestamp(6) without time zone NOT NULL, + updated_at timestamp(6) without time zone NOT NULL, + load_event_id integer +); + + +-- +-- Name: verifiers_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- + +CREATE SEQUENCE support.verifiers_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: verifiers_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- + +ALTER SEQUENCE support.verifiers_id_seq OWNED BY support.verifiers.id; + + +-- +-- Name: baseline_counts id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.baseline_counts ALTER COLUMN id SET DEFAULT nextval('ctgov.baseline_counts_id_seq'::regclass); + + +-- +-- Name: baseline_measurements id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.baseline_measurements ALTER COLUMN id SET DEFAULT nextval('ctgov.baseline_measurements_id_seq'::regclass); + + +-- +-- Name: brief_summaries id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.brief_summaries ALTER COLUMN id SET DEFAULT nextval('ctgov.brief_summaries_id_seq'::regclass); + + +-- +-- Name: browse_conditions id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.browse_conditions ALTER COLUMN id SET DEFAULT nextval('ctgov.browse_conditions_id_seq'::regclass); + + +-- +-- Name: browse_interventions id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.browse_interventions ALTER COLUMN id SET DEFAULT nextval('ctgov.browse_interventions_id_seq'::regclass); + + +-- +-- Name: calculated_values id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.calculated_values ALTER COLUMN id SET DEFAULT nextval('ctgov.calculated_values_id_seq'::regclass); + + +-- +-- Name: central_contacts id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.central_contacts ALTER COLUMN id SET DEFAULT nextval('ctgov.central_contacts_id_seq'::regclass); + + +-- +-- Name: conditions id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.conditions ALTER COLUMN id SET DEFAULT nextval('ctgov.conditions_id_seq'::regclass); + + +-- +-- Name: countries id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.countries ALTER COLUMN id SET DEFAULT nextval('ctgov.countries_id_seq'::regclass); + + +-- +-- Name: design_group_interventions id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.design_group_interventions ALTER COLUMN id SET DEFAULT nextval('ctgov.design_group_interventions_id_seq'::regclass); + + +-- +-- Name: design_groups id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.design_groups ALTER COLUMN id SET DEFAULT nextval('ctgov.design_groups_id_seq'::regclass); + + +-- +-- Name: design_outcomes id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.design_outcomes ALTER COLUMN id SET DEFAULT nextval('ctgov.design_outcomes_id_seq'::regclass); + + +-- +-- Name: designs id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.designs ALTER COLUMN id SET DEFAULT nextval('ctgov.designs_id_seq'::regclass); + + +-- +-- Name: detailed_descriptions id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.detailed_descriptions ALTER COLUMN id SET DEFAULT nextval('ctgov.detailed_descriptions_id_seq'::regclass); + + +-- +-- Name: documents id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.documents ALTER COLUMN id SET DEFAULT nextval('ctgov.documents_id_seq'::regclass); + + +-- +-- Name: drop_withdrawals id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.drop_withdrawals ALTER COLUMN id SET DEFAULT nextval('ctgov.drop_withdrawals_id_seq'::regclass); + + +-- +-- Name: eligibilities id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.eligibilities ALTER COLUMN id SET DEFAULT nextval('ctgov.eligibilities_id_seq'::regclass); + + +-- +-- Name: facilities id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.facilities ALTER COLUMN id SET DEFAULT nextval('ctgov.facilities_id_seq'::regclass); + + +-- +-- Name: facility_contacts id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.facility_contacts ALTER COLUMN id SET DEFAULT nextval('ctgov.facility_contacts_id_seq'::regclass); + + +-- +-- Name: facility_investigators id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.facility_investigators ALTER COLUMN id SET DEFAULT nextval('ctgov.facility_investigators_id_seq'::regclass); + + +-- +-- Name: id_information id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.id_information ALTER COLUMN id SET DEFAULT nextval('ctgov.id_information_id_seq'::regclass); + + +-- +-- Name: intervention_other_names id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.intervention_other_names ALTER COLUMN id SET DEFAULT nextval('ctgov.intervention_other_names_id_seq'::regclass); + + +-- +-- Name: interventions id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.interventions ALTER COLUMN id SET DEFAULT nextval('ctgov.interventions_id_seq'::regclass); + + +-- +-- Name: ipd_information_types id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.ipd_information_types ALTER COLUMN id SET DEFAULT nextval('ctgov.ipd_information_types_id_seq'::regclass); + + +-- +-- Name: keywords id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.keywords ALTER COLUMN id SET DEFAULT nextval('ctgov.keywords_id_seq'::regclass); + + +-- +-- Name: links id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.links ALTER COLUMN id SET DEFAULT nextval('ctgov.links_id_seq'::regclass); + + +-- +-- Name: mesh_headings id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.mesh_headings ALTER COLUMN id SET DEFAULT nextval('ctgov.mesh_headings_id_seq'::regclass); + + +-- +-- Name: mesh_terms id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.mesh_terms ALTER COLUMN id SET DEFAULT nextval('ctgov.mesh_terms_id_seq'::regclass); + + +-- +-- Name: milestones id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.milestones ALTER COLUMN id SET DEFAULT nextval('ctgov.milestones_id_seq'::regclass); + + +-- +-- Name: outcome_analyses id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.outcome_analyses ALTER COLUMN id SET DEFAULT nextval('ctgov.outcome_analyses_id_seq'::regclass); + + +-- +-- Name: outcome_analysis_groups id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.outcome_analysis_groups ALTER COLUMN id SET DEFAULT nextval('ctgov.outcome_analysis_groups_id_seq'::regclass); + + +-- +-- Name: outcome_counts id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.outcome_counts ALTER COLUMN id SET DEFAULT nextval('ctgov.outcome_counts_id_seq'::regclass); + + +-- +-- Name: outcome_measurements id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.outcome_measurements ALTER COLUMN id SET DEFAULT nextval('ctgov.outcome_measurements_id_seq'::regclass); + + +-- +-- Name: outcomes id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.outcomes ALTER COLUMN id SET DEFAULT nextval('ctgov.outcomes_id_seq'::regclass); + + +-- +-- Name: overall_officials id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.overall_officials ALTER COLUMN id SET DEFAULT nextval('ctgov.overall_officials_id_seq'::regclass); + + +-- +-- Name: participant_flows id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.participant_flows ALTER COLUMN id SET DEFAULT nextval('ctgov.participant_flows_id_seq'::regclass); + + +-- +-- Name: pending_results id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.pending_results ALTER COLUMN id SET DEFAULT nextval('ctgov.pending_results_id_seq'::regclass); + + +-- +-- Name: provided_documents id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.provided_documents ALTER COLUMN id SET DEFAULT nextval('ctgov.provided_documents_id_seq'::regclass); + + +-- +-- Name: reported_event_totals id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.reported_event_totals ALTER COLUMN id SET DEFAULT nextval('ctgov.reported_event_totals_id_seq'::regclass); + + +-- +-- Name: reported_events id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.reported_events ALTER COLUMN id SET DEFAULT nextval('ctgov.reported_events_id_seq'::regclass); + + +-- +-- Name: responsible_parties id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.responsible_parties ALTER COLUMN id SET DEFAULT nextval('ctgov.responsible_parties_id_seq'::regclass); + + +-- +-- Name: result_agreements id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.result_agreements ALTER COLUMN id SET DEFAULT nextval('ctgov.result_agreements_id_seq'::regclass); + + +-- +-- Name: result_contacts id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.result_contacts ALTER COLUMN id SET DEFAULT nextval('ctgov.result_contacts_id_seq'::regclass); + + +-- +-- Name: result_groups id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.result_groups ALTER COLUMN id SET DEFAULT nextval('ctgov.result_groups_id_seq'::regclass); + + +-- +-- Name: retractions id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.retractions ALTER COLUMN id SET DEFAULT nextval('ctgov.retractions_id_seq'::regclass); + + +-- +-- Name: search_results id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.search_results ALTER COLUMN id SET DEFAULT nextval('ctgov.search_results_id_seq'::regclass); + + +-- +-- Name: sponsors id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.sponsors ALTER COLUMN id SET DEFAULT nextval('ctgov.sponsors_id_seq'::regclass); + + +-- +-- Name: study_records id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.study_records ALTER COLUMN id SET DEFAULT nextval('ctgov.study_records_id_seq'::regclass); + + +-- +-- Name: study_references id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.study_references ALTER COLUMN id SET DEFAULT nextval('ctgov.study_references_id_seq'::regclass); + + +-- +-- Name: study_searches id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.study_searches ALTER COLUMN id SET DEFAULT nextval('ctgov.study_searches_id_seq'::regclass); + + +-- +-- Name: baseline_counts id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.baseline_counts ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.baseline_counts_id_seq'::regclass); + + +-- +-- Name: baseline_measurements id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.baseline_measurements ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.baseline_measurements_id_seq'::regclass); + + +-- +-- Name: brief_summaries id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.brief_summaries ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.brief_summaries_id_seq'::regclass); + + +-- +-- Name: browse_conditions id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.browse_conditions ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.browse_conditions_id_seq'::regclass); + + +-- +-- Name: browse_interventions id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.browse_interventions ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.browse_interventions_id_seq'::regclass); + + +-- +-- Name: calculated_values id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.calculated_values ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.calculated_values_id_seq'::regclass); + + +-- +-- Name: central_contacts id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.central_contacts ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.central_contacts_id_seq'::regclass); + + +-- +-- Name: conditions id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.conditions ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.conditions_id_seq'::regclass); + + +-- +-- Name: countries id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.countries ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.countries_id_seq'::regclass); + + +-- +-- Name: design_group_interventions id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.design_group_interventions ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.design_group_interventions_id_seq'::regclass); + + +-- +-- Name: design_groups id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.design_groups ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.design_groups_id_seq'::regclass); + + +-- +-- Name: design_outcomes id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.design_outcomes ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.design_outcomes_id_seq'::regclass); + + +-- +-- Name: designs id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.designs ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.designs_id_seq'::regclass); + + +-- +-- Name: detailed_descriptions id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.detailed_descriptions ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.detailed_descriptions_id_seq'::regclass); + + +-- +-- Name: documents id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.documents ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.documents_id_seq'::regclass); + + +-- +-- Name: drop_withdrawals id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.drop_withdrawals ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.drop_withdrawals_id_seq'::regclass); + + +-- +-- Name: eligibilities id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.eligibilities ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.eligibilities_id_seq'::regclass); + + +-- +-- Name: facilities id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.facilities ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.facilities_id_seq'::regclass); + + +-- +-- Name: facility_contacts id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.facility_contacts ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.facility_contacts_id_seq'::regclass); + + +-- +-- Name: facility_investigators id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.facility_investigators ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.facility_investigators_id_seq'::regclass); + + +-- +-- Name: id_information id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.id_information ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.id_information_id_seq'::regclass); + + +-- +-- Name: intervention_other_names id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.intervention_other_names ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.intervention_other_names_id_seq'::regclass); + + +-- +-- Name: interventions id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.interventions ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.interventions_id_seq'::regclass); + + +-- +-- Name: ipd_information_types id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.ipd_information_types ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.ipd_information_types_id_seq'::regclass); + + +-- +-- Name: keywords id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.keywords ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.keywords_id_seq'::regclass); + + +-- +-- Name: links id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.links ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.links_id_seq'::regclass); + + +-- +-- Name: mesh_headings id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.mesh_headings ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.mesh_headings_id_seq'::regclass); + + +-- +-- Name: mesh_terms id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.mesh_terms ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.mesh_terms_id_seq'::regclass); + + +-- +-- Name: milestones id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.milestones ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.milestones_id_seq'::regclass); + + +-- +-- Name: outcome_analyses id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.outcome_analyses ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.outcome_analyses_id_seq'::regclass); + + +-- +-- Name: outcome_analysis_groups id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.outcome_analysis_groups ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.outcome_analysis_groups_id_seq'::regclass); + + +-- +-- Name: outcome_counts id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.outcome_counts ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.outcome_counts_id_seq'::regclass); + + +-- +-- Name: outcome_measurements id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.outcome_measurements ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.outcome_measurements_id_seq'::regclass); + + +-- +-- Name: outcomes id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.outcomes ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.outcomes_id_seq'::regclass); + + +-- +-- Name: overall_officials id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.overall_officials ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.overall_officials_id_seq'::regclass); + + +-- +-- Name: participant_flows id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.participant_flows ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.participant_flows_id_seq'::regclass); + + +-- +-- Name: pending_results id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.pending_results ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.pending_results_id_seq'::regclass); + + +-- +-- Name: provided_documents id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.provided_documents ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.provided_documents_id_seq'::regclass); + + +-- +-- Name: reported_event_totals id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.reported_event_totals ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.reported_event_totals_id_seq'::regclass); + + +-- +-- Name: reported_events id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.reported_events ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.reported_events_id_seq'::regclass); + + +-- +-- Name: responsible_parties id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.responsible_parties ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.responsible_parties_id_seq'::regclass); + + +-- +-- Name: result_agreements id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.result_agreements ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.result_agreements_id_seq'::regclass); + + +-- +-- Name: result_contacts id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.result_contacts ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.result_contacts_id_seq'::regclass); + + +-- +-- Name: result_groups id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.result_groups ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.result_groups_id_seq'::regclass); + + +-- +-- Name: retractions id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.retractions ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.retractions_id_seq'::regclass); + + +-- +-- Name: search_results id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.search_results ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.search_results_id_seq'::regclass); + + +-- +-- Name: sponsors id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.sponsors ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.sponsors_id_seq'::regclass); + + +-- +-- Name: study_records id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.study_records ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.study_records_id_seq'::regclass); + + +-- +-- Name: study_references id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.study_references ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.study_references_id_seq'::regclass); + + +-- +-- Name: study_searches id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.study_searches ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.study_searches_id_seq'::regclass); + + +-- +-- Name: active_storage_attachments id; Type: DEFAULT; Schema: support; Owner: - +-- + +ALTER TABLE ONLY support.active_storage_attachments ALTER COLUMN id SET DEFAULT nextval('support.active_storage_attachments_id_seq'::regclass); + + +-- +-- Name: active_storage_blobs id; Type: DEFAULT; Schema: support; Owner: - +-- + +ALTER TABLE ONLY support.active_storage_blobs ALTER COLUMN id SET DEFAULT nextval('support.active_storage_blobs_id_seq'::regclass); + + +-- +-- Name: background_jobs id; Type: DEFAULT; Schema: support; Owner: - +-- + +ALTER TABLE ONLY support.background_jobs ALTER COLUMN id SET DEFAULT nextval('support.background_jobs_id_seq'::regclass); + + +-- +-- Name: file_records id; Type: DEFAULT; Schema: support; Owner: - +-- + +ALTER TABLE ONLY support.file_records ALTER COLUMN id SET DEFAULT nextval('support.file_records_id_seq'::regclass); + + +-- +-- Name: load_events id; Type: DEFAULT; Schema: support; Owner: - +-- + +ALTER TABLE ONLY support.load_events ALTER COLUMN id SET DEFAULT nextval('support.load_events_id_seq'::regclass); + + +-- +-- Name: load_issues id; Type: DEFAULT; Schema: support; Owner: - +-- + +ALTER TABLE ONLY support.load_issues ALTER COLUMN id SET DEFAULT nextval('support.load_issues_id_seq'::regclass); + + +-- +-- Name: sanity_checks id; Type: DEFAULT; Schema: support; Owner: - +-- + +ALTER TABLE ONLY support.sanity_checks ALTER COLUMN id SET DEFAULT nextval('support.sanity_checks_id_seq'::regclass); + + +-- +-- Name: study_json_records id; Type: DEFAULT; Schema: support; Owner: - +-- + +ALTER TABLE ONLY support.study_json_records ALTER COLUMN id SET DEFAULT nextval('support.study_json_records_id_seq'::regclass); + + +-- +-- Name: study_statistics_comparisons id; Type: DEFAULT; Schema: support; Owner: - +-- + +ALTER TABLE ONLY support.study_statistics_comparisons ALTER COLUMN id SET DEFAULT nextval('support.study_statistics_comparisons_id_seq'::regclass); + + +-- +-- Name: study_xml_records id; Type: DEFAULT; Schema: support; Owner: - +-- + +ALTER TABLE ONLY support.study_xml_records ALTER COLUMN id SET DEFAULT nextval('support.study_xml_records_id_seq'::regclass); + + +-- +-- Name: verifiers id; Type: DEFAULT; Schema: support; Owner: - +-- + +ALTER TABLE ONLY support.verifiers ALTER COLUMN id SET DEFAULT nextval('support.verifiers_id_seq'::regclass); + + +-- +-- Name: baseline_counts baseline_counts_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.baseline_counts + ADD CONSTRAINT baseline_counts_pkey PRIMARY KEY (id); + + +-- +-- Name: baseline_measurements baseline_measurements_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.baseline_measurements + ADD CONSTRAINT baseline_measurements_pkey PRIMARY KEY (id); + + +-- +-- Name: brief_summaries brief_summaries_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.brief_summaries + ADD CONSTRAINT brief_summaries_pkey PRIMARY KEY (id); + + +-- +-- Name: browse_conditions browse_conditions_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.browse_conditions + ADD CONSTRAINT browse_conditions_pkey PRIMARY KEY (id); + + +-- +-- Name: browse_interventions browse_interventions_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.browse_interventions + ADD CONSTRAINT browse_interventions_pkey PRIMARY KEY (id); + + +-- +-- Name: calculated_values calculated_values_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.calculated_values + ADD CONSTRAINT calculated_values_pkey PRIMARY KEY (id); + + +-- +-- Name: central_contacts central_contacts_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.central_contacts + ADD CONSTRAINT central_contacts_pkey PRIMARY KEY (id); + + +-- +-- Name: conditions conditions_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.conditions + ADD CONSTRAINT conditions_pkey PRIMARY KEY (id); + + +-- +-- Name: countries countries_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.countries + ADD CONSTRAINT countries_pkey PRIMARY KEY (id); + + +-- +-- Name: design_group_interventions design_group_interventions_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.design_group_interventions + ADD CONSTRAINT design_group_interventions_pkey PRIMARY KEY (id); + + +-- +-- Name: design_groups design_groups_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.design_groups + ADD CONSTRAINT design_groups_pkey PRIMARY KEY (id); + + +-- +-- Name: design_outcomes design_outcomes_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.design_outcomes + ADD CONSTRAINT design_outcomes_pkey PRIMARY KEY (id); + + +-- +-- Name: designs designs_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.designs + ADD CONSTRAINT designs_pkey PRIMARY KEY (id); + + +-- +-- Name: detailed_descriptions detailed_descriptions_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.detailed_descriptions + ADD CONSTRAINT detailed_descriptions_pkey PRIMARY KEY (id); + + +-- +-- Name: documents documents_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.documents + ADD CONSTRAINT documents_pkey PRIMARY KEY (id); + + +-- +-- Name: drop_withdrawals drop_withdrawals_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.drop_withdrawals + ADD CONSTRAINT drop_withdrawals_pkey PRIMARY KEY (id); + + +-- +-- Name: eligibilities eligibilities_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.eligibilities + ADD CONSTRAINT eligibilities_pkey PRIMARY KEY (id); + + +-- +-- Name: facilities facilities_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.facilities + ADD CONSTRAINT facilities_pkey PRIMARY KEY (id); + + +-- +-- Name: facility_contacts facility_contacts_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.facility_contacts + ADD CONSTRAINT facility_contacts_pkey PRIMARY KEY (id); + + +-- +-- Name: facility_investigators facility_investigators_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.facility_investigators + ADD CONSTRAINT facility_investigators_pkey PRIMARY KEY (id); + + +-- +-- Name: id_information id_information_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.id_information + ADD CONSTRAINT id_information_pkey PRIMARY KEY (id); + + +-- +-- Name: intervention_other_names intervention_other_names_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.intervention_other_names + ADD CONSTRAINT intervention_other_names_pkey PRIMARY KEY (id); + + +-- +-- Name: interventions interventions_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.interventions + ADD CONSTRAINT interventions_pkey PRIMARY KEY (id); + + +-- +-- Name: ipd_information_types ipd_information_types_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.ipd_information_types + ADD CONSTRAINT ipd_information_types_pkey PRIMARY KEY (id); + + +-- +-- Name: keywords keywords_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.keywords + ADD CONSTRAINT keywords_pkey PRIMARY KEY (id); + + +-- +-- Name: links links_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.links + ADD CONSTRAINT links_pkey PRIMARY KEY (id); + + +-- +-- Name: mesh_headings mesh_headings_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.mesh_headings + ADD CONSTRAINT mesh_headings_pkey PRIMARY KEY (id); + + +-- +-- Name: mesh_terms mesh_terms_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.mesh_terms + ADD CONSTRAINT mesh_terms_pkey PRIMARY KEY (id); + + +-- +-- Name: milestones milestones_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.milestones + ADD CONSTRAINT milestones_pkey PRIMARY KEY (id); + + +-- +-- Name: outcome_analyses outcome_analyses_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.outcome_analyses + ADD CONSTRAINT outcome_analyses_pkey PRIMARY KEY (id); + + +-- +-- Name: outcome_analysis_groups outcome_analysis_groups_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.outcome_analysis_groups + ADD CONSTRAINT outcome_analysis_groups_pkey PRIMARY KEY (id); + + +-- +-- Name: outcome_counts outcome_counts_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.outcome_counts + ADD CONSTRAINT outcome_counts_pkey PRIMARY KEY (id); + + +-- +-- Name: outcome_measurements outcome_measurements_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.outcome_measurements + ADD CONSTRAINT outcome_measurements_pkey PRIMARY KEY (id); + + +-- +-- Name: outcomes outcomes_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.outcomes + ADD CONSTRAINT outcomes_pkey PRIMARY KEY (id); + + +-- +-- Name: overall_officials overall_officials_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.overall_officials + ADD CONSTRAINT overall_officials_pkey PRIMARY KEY (id); + + +-- +-- Name: participant_flows participant_flows_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.participant_flows + ADD CONSTRAINT participant_flows_pkey PRIMARY KEY (id); + + +-- +-- Name: pending_results pending_results_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.pending_results + ADD CONSTRAINT pending_results_pkey PRIMARY KEY (id); + + +-- +-- Name: provided_documents provided_documents_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.provided_documents + ADD CONSTRAINT provided_documents_pkey PRIMARY KEY (id); + + +-- +-- Name: reported_event_totals reported_event_totals_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.reported_event_totals + ADD CONSTRAINT reported_event_totals_pkey PRIMARY KEY (id); + + +-- +-- Name: reported_events reported_events_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.reported_events + ADD CONSTRAINT reported_events_pkey PRIMARY KEY (id); + + +-- +-- Name: responsible_parties responsible_parties_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.responsible_parties + ADD CONSTRAINT responsible_parties_pkey PRIMARY KEY (id); + + +-- +-- Name: result_agreements result_agreements_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.result_agreements + ADD CONSTRAINT result_agreements_pkey PRIMARY KEY (id); + + +-- +-- Name: result_contacts result_contacts_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.result_contacts + ADD CONSTRAINT result_contacts_pkey PRIMARY KEY (id); + + +-- +-- Name: result_groups result_groups_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.result_groups + ADD CONSTRAINT result_groups_pkey PRIMARY KEY (id); + + +-- +-- Name: retractions retractions_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.retractions + ADD CONSTRAINT retractions_pkey PRIMARY KEY (id); + + +-- +-- Name: search_results search_results_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.search_results + ADD CONSTRAINT search_results_pkey PRIMARY KEY (id); + + +-- +-- Name: sponsors sponsors_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.sponsors + ADD CONSTRAINT sponsors_pkey PRIMARY KEY (id); + + +-- +-- Name: study_records study_records_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.study_records + ADD CONSTRAINT study_records_pkey PRIMARY KEY (id); + + +-- +-- Name: study_references study_references_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.study_references + ADD CONSTRAINT study_references_pkey PRIMARY KEY (id); + + +-- +-- Name: study_searches study_searches_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.study_searches + ADD CONSTRAINT study_searches_pkey PRIMARY KEY (id); + + +-- +-- Name: baseline_counts baseline_counts_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.baseline_counts + ADD CONSTRAINT baseline_counts_pkey PRIMARY KEY (id); + + +-- +-- Name: baseline_measurements baseline_measurements_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.baseline_measurements + ADD CONSTRAINT baseline_measurements_pkey PRIMARY KEY (id); + + +-- +-- Name: brief_summaries brief_summaries_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.brief_summaries + ADD CONSTRAINT brief_summaries_pkey PRIMARY KEY (id); + + +-- +-- Name: browse_conditions browse_conditions_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.browse_conditions + ADD CONSTRAINT browse_conditions_pkey PRIMARY KEY (id); + + +-- +-- Name: browse_interventions browse_interventions_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.browse_interventions + ADD CONSTRAINT browse_interventions_pkey PRIMARY KEY (id); + + +-- +-- Name: calculated_values calculated_values_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.calculated_values + ADD CONSTRAINT calculated_values_pkey PRIMARY KEY (id); + + +-- +-- Name: central_contacts central_contacts_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.central_contacts + ADD CONSTRAINT central_contacts_pkey PRIMARY KEY (id); + + +-- +-- Name: conditions conditions_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.conditions + ADD CONSTRAINT conditions_pkey PRIMARY KEY (id); + + +-- +-- Name: countries countries_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.countries + ADD CONSTRAINT countries_pkey PRIMARY KEY (id); + + +-- +-- Name: design_group_interventions design_group_interventions_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.design_group_interventions + ADD CONSTRAINT design_group_interventions_pkey PRIMARY KEY (id); + + +-- +-- Name: design_groups design_groups_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.design_groups + ADD CONSTRAINT design_groups_pkey PRIMARY KEY (id); + + +-- +-- Name: design_outcomes design_outcomes_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.design_outcomes + ADD CONSTRAINT design_outcomes_pkey PRIMARY KEY (id); + + +-- +-- Name: designs designs_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.designs + ADD CONSTRAINT designs_pkey PRIMARY KEY (id); + + +-- +-- Name: detailed_descriptions detailed_descriptions_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.detailed_descriptions + ADD CONSTRAINT detailed_descriptions_pkey PRIMARY KEY (id); + + +-- +-- Name: documents documents_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.documents + ADD CONSTRAINT documents_pkey PRIMARY KEY (id); + + +-- +-- Name: drop_withdrawals drop_withdrawals_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.drop_withdrawals + ADD CONSTRAINT drop_withdrawals_pkey PRIMARY KEY (id); + + +-- +-- Name: eligibilities eligibilities_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.eligibilities + ADD CONSTRAINT eligibilities_pkey PRIMARY KEY (id); + + +-- +-- Name: facilities facilities_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.facilities + ADD CONSTRAINT facilities_pkey PRIMARY KEY (id); + + +-- +-- Name: facility_contacts facility_contacts_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.facility_contacts + ADD CONSTRAINT facility_contacts_pkey PRIMARY KEY (id); + + +-- +-- Name: facility_investigators facility_investigators_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.facility_investigators + ADD CONSTRAINT facility_investigators_pkey PRIMARY KEY (id); + + +-- +-- Name: id_information id_information_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.id_information + ADD CONSTRAINT id_information_pkey PRIMARY KEY (id); + + +-- +-- Name: intervention_other_names intervention_other_names_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.intervention_other_names + ADD CONSTRAINT intervention_other_names_pkey PRIMARY KEY (id); -- --- Name: study_xml_records_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- Name: interventions interventions_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -CREATE SEQUENCE support.study_xml_records_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; +ALTER TABLE ONLY ctgov_v2.interventions + ADD CONSTRAINT interventions_pkey PRIMARY KEY (id); -- --- Name: study_xml_records_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- Name: ipd_information_types ipd_information_types_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER SEQUENCE support.study_xml_records_id_seq OWNED BY support.study_xml_records.id; +ALTER TABLE ONLY ctgov_v2.ipd_information_types + ADD CONSTRAINT ipd_information_types_pkey PRIMARY KEY (id); -- --- Name: verifiers; Type: TABLE; Schema: support; Owner: - +-- Name: keywords keywords_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -CREATE TABLE support.verifiers ( - id bigint NOT NULL, - differences json DEFAULT '[]'::json NOT NULL, - last_run timestamp without time zone, - source json, - created_at timestamp(6) without time zone NOT NULL, - updated_at timestamp(6) without time zone NOT NULL, - load_event_id integer -); +ALTER TABLE ONLY ctgov_v2.keywords + ADD CONSTRAINT keywords_pkey PRIMARY KEY (id); -- --- Name: verifiers_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- Name: links links_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -CREATE SEQUENCE support.verifiers_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; +ALTER TABLE ONLY ctgov_v2.links + ADD CONSTRAINT links_pkey PRIMARY KEY (id); -- --- Name: verifiers_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- Name: mesh_headings mesh_headings_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER SEQUENCE support.verifiers_id_seq OWNED BY support.verifiers.id; +ALTER TABLE ONLY ctgov_v2.mesh_headings + ADD CONSTRAINT mesh_headings_pkey PRIMARY KEY (id); -- --- Name: baseline_counts id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: mesh_terms mesh_terms_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER TABLE ONLY ctgov.baseline_counts ALTER COLUMN id SET DEFAULT nextval('ctgov.baseline_counts_id_seq'::regclass); +ALTER TABLE ONLY ctgov_v2.mesh_terms + ADD CONSTRAINT mesh_terms_pkey PRIMARY KEY (id); -- --- Name: baseline_measurements id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: milestones milestones_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER TABLE ONLY ctgov.baseline_measurements ALTER COLUMN id SET DEFAULT nextval('ctgov.baseline_measurements_id_seq'::regclass); +ALTER TABLE ONLY ctgov_v2.milestones + ADD CONSTRAINT milestones_pkey PRIMARY KEY (id); -- --- Name: brief_summaries id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: outcome_analyses outcome_analyses_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER TABLE ONLY ctgov.brief_summaries ALTER COLUMN id SET DEFAULT nextval('ctgov.brief_summaries_id_seq'::regclass); +ALTER TABLE ONLY ctgov_v2.outcome_analyses + ADD CONSTRAINT outcome_analyses_pkey PRIMARY KEY (id); -- --- Name: browse_conditions id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: outcome_analysis_groups outcome_analysis_groups_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER TABLE ONLY ctgov.browse_conditions ALTER COLUMN id SET DEFAULT nextval('ctgov.browse_conditions_id_seq'::regclass); +ALTER TABLE ONLY ctgov_v2.outcome_analysis_groups + ADD CONSTRAINT outcome_analysis_groups_pkey PRIMARY KEY (id); -- --- Name: browse_interventions id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: outcome_counts outcome_counts_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER TABLE ONLY ctgov.browse_interventions ALTER COLUMN id SET DEFAULT nextval('ctgov.browse_interventions_id_seq'::regclass); +ALTER TABLE ONLY ctgov_v2.outcome_counts + ADD CONSTRAINT outcome_counts_pkey PRIMARY KEY (id); -- --- Name: calculated_values id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: outcome_measurements outcome_measurements_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER TABLE ONLY ctgov.calculated_values ALTER COLUMN id SET DEFAULT nextval('ctgov.calculated_values_id_seq'::regclass); +ALTER TABLE ONLY ctgov_v2.outcome_measurements + ADD CONSTRAINT outcome_measurements_pkey PRIMARY KEY (id); -- --- Name: central_contacts id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: outcomes outcomes_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER TABLE ONLY ctgov.central_contacts ALTER COLUMN id SET DEFAULT nextval('ctgov.central_contacts_id_seq'::regclass); +ALTER TABLE ONLY ctgov_v2.outcomes + ADD CONSTRAINT outcomes_pkey PRIMARY KEY (id); -- --- Name: conditions id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: overall_officials overall_officials_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER TABLE ONLY ctgov.conditions ALTER COLUMN id SET DEFAULT nextval('ctgov.conditions_id_seq'::regclass); +ALTER TABLE ONLY ctgov_v2.overall_officials + ADD CONSTRAINT overall_officials_pkey PRIMARY KEY (id); -- --- Name: countries id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: participant_flows participant_flows_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER TABLE ONLY ctgov.countries ALTER COLUMN id SET DEFAULT nextval('ctgov.countries_id_seq'::regclass); +ALTER TABLE ONLY ctgov_v2.participant_flows + ADD CONSTRAINT participant_flows_pkey PRIMARY KEY (id); -- --- Name: design_group_interventions id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: pending_results pending_results_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER TABLE ONLY ctgov.design_group_interventions ALTER COLUMN id SET DEFAULT nextval('ctgov.design_group_interventions_id_seq'::regclass); +ALTER TABLE ONLY ctgov_v2.pending_results + ADD CONSTRAINT pending_results_pkey PRIMARY KEY (id); -- --- Name: design_groups id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: provided_documents provided_documents_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER TABLE ONLY ctgov.design_groups ALTER COLUMN id SET DEFAULT nextval('ctgov.design_groups_id_seq'::regclass); +ALTER TABLE ONLY ctgov_v2.provided_documents + ADD CONSTRAINT provided_documents_pkey PRIMARY KEY (id); -- --- Name: design_outcomes id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: reported_event_totals reported_event_totals_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER TABLE ONLY ctgov.design_outcomes ALTER COLUMN id SET DEFAULT nextval('ctgov.design_outcomes_id_seq'::regclass); +ALTER TABLE ONLY ctgov_v2.reported_event_totals + ADD CONSTRAINT reported_event_totals_pkey PRIMARY KEY (id); -- --- Name: designs id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: reported_events reported_events_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER TABLE ONLY ctgov.designs ALTER COLUMN id SET DEFAULT nextval('ctgov.designs_id_seq'::regclass); +ALTER TABLE ONLY ctgov_v2.reported_events + ADD CONSTRAINT reported_events_pkey PRIMARY KEY (id); -- --- Name: detailed_descriptions id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: responsible_parties responsible_parties_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER TABLE ONLY ctgov.detailed_descriptions ALTER COLUMN id SET DEFAULT nextval('ctgov.detailed_descriptions_id_seq'::regclass); +ALTER TABLE ONLY ctgov_v2.responsible_parties + ADD CONSTRAINT responsible_parties_pkey PRIMARY KEY (id); -- --- Name: documents id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: result_agreements result_agreements_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER TABLE ONLY ctgov.documents ALTER COLUMN id SET DEFAULT nextval('ctgov.documents_id_seq'::regclass); +ALTER TABLE ONLY ctgov_v2.result_agreements + ADD CONSTRAINT result_agreements_pkey PRIMARY KEY (id); -- --- Name: drop_withdrawals id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: result_contacts result_contacts_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER TABLE ONLY ctgov.drop_withdrawals ALTER COLUMN id SET DEFAULT nextval('ctgov.drop_withdrawals_id_seq'::regclass); +ALTER TABLE ONLY ctgov_v2.result_contacts + ADD CONSTRAINT result_contacts_pkey PRIMARY KEY (id); -- --- Name: eligibilities id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: result_groups result_groups_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER TABLE ONLY ctgov.eligibilities ALTER COLUMN id SET DEFAULT nextval('ctgov.eligibilities_id_seq'::regclass); +ALTER TABLE ONLY ctgov_v2.result_groups + ADD CONSTRAINT result_groups_pkey PRIMARY KEY (id); -- --- Name: facilities id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: retractions retractions_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER TABLE ONLY ctgov.facilities ALTER COLUMN id SET DEFAULT nextval('ctgov.facilities_id_seq'::regclass); +ALTER TABLE ONLY ctgov_v2.retractions + ADD CONSTRAINT retractions_pkey PRIMARY KEY (id); -- --- Name: facility_contacts id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: search_results search_results_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER TABLE ONLY ctgov.facility_contacts ALTER COLUMN id SET DEFAULT nextval('ctgov.facility_contacts_id_seq'::regclass); +ALTER TABLE ONLY ctgov_v2.search_results + ADD CONSTRAINT search_results_pkey PRIMARY KEY (id); -- --- Name: facility_investigators id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: sponsors sponsors_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER TABLE ONLY ctgov.facility_investigators ALTER COLUMN id SET DEFAULT nextval('ctgov.facility_investigators_id_seq'::regclass); +ALTER TABLE ONLY ctgov_v2.sponsors + ADD CONSTRAINT sponsors_pkey PRIMARY KEY (id); -- --- Name: id_information id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: study_records study_records_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER TABLE ONLY ctgov.id_information ALTER COLUMN id SET DEFAULT nextval('ctgov.id_information_id_seq'::regclass); +ALTER TABLE ONLY ctgov_v2.study_records + ADD CONSTRAINT study_records_pkey PRIMARY KEY (id); -- --- Name: intervention_other_names id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: study_references study_references_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER TABLE ONLY ctgov.intervention_other_names ALTER COLUMN id SET DEFAULT nextval('ctgov.intervention_other_names_id_seq'::regclass); +ALTER TABLE ONLY ctgov_v2.study_references + ADD CONSTRAINT study_references_pkey PRIMARY KEY (id); -- --- Name: interventions id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: study_searches study_searches_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER TABLE ONLY ctgov.interventions ALTER COLUMN id SET DEFAULT nextval('ctgov.interventions_id_seq'::regclass); +ALTER TABLE ONLY ctgov_v2.study_searches + ADD CONSTRAINT study_searches_pkey PRIMARY KEY (id); -- --- Name: ipd_information_types id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: ar_internal_metadata ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY ctgov.ipd_information_types ALTER COLUMN id SET DEFAULT nextval('ctgov.ipd_information_types_id_seq'::regclass); +ALTER TABLE ONLY public.ar_internal_metadata + ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key); -- --- Name: keywords id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY ctgov.keywords ALTER COLUMN id SET DEFAULT nextval('ctgov.keywords_id_seq'::regclass); +ALTER TABLE ONLY public.schema_migrations + ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version); -- --- Name: links id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: active_storage_attachments active_storage_attachments_pkey; Type: CONSTRAINT; Schema: support; Owner: - -- -ALTER TABLE ONLY ctgov.links ALTER COLUMN id SET DEFAULT nextval('ctgov.links_id_seq'::regclass); +ALTER TABLE ONLY support.active_storage_attachments + ADD CONSTRAINT active_storage_attachments_pkey PRIMARY KEY (id); -- --- Name: mesh_headings id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: active_storage_blobs active_storage_blobs_pkey; Type: CONSTRAINT; Schema: support; Owner: - -- -ALTER TABLE ONLY ctgov.mesh_headings ALTER COLUMN id SET DEFAULT nextval('ctgov.mesh_headings_id_seq'::regclass); +ALTER TABLE ONLY support.active_storage_blobs + ADD CONSTRAINT active_storage_blobs_pkey PRIMARY KEY (id); -- --- Name: mesh_terms id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: background_jobs background_jobs_pkey; Type: CONSTRAINT; Schema: support; Owner: - -- -ALTER TABLE ONLY ctgov.mesh_terms ALTER COLUMN id SET DEFAULT nextval('ctgov.mesh_terms_id_seq'::regclass); +ALTER TABLE ONLY support.background_jobs + ADD CONSTRAINT background_jobs_pkey PRIMARY KEY (id); -- --- Name: milestones id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: file_records file_records_pkey; Type: CONSTRAINT; Schema: support; Owner: - -- -ALTER TABLE ONLY ctgov.milestones ALTER COLUMN id SET DEFAULT nextval('ctgov.milestones_id_seq'::regclass); +ALTER TABLE ONLY support.file_records + ADD CONSTRAINT file_records_pkey PRIMARY KEY (id); -- --- Name: outcome_analyses id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: load_events load_events_pkey; Type: CONSTRAINT; Schema: support; Owner: - -- -ALTER TABLE ONLY ctgov.outcome_analyses ALTER COLUMN id SET DEFAULT nextval('ctgov.outcome_analyses_id_seq'::regclass); +ALTER TABLE ONLY support.load_events + ADD CONSTRAINT load_events_pkey PRIMARY KEY (id); -- --- Name: outcome_analysis_groups id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: load_issues load_issues_pkey; Type: CONSTRAINT; Schema: support; Owner: - -- -ALTER TABLE ONLY ctgov.outcome_analysis_groups ALTER COLUMN id SET DEFAULT nextval('ctgov.outcome_analysis_groups_id_seq'::regclass); +ALTER TABLE ONLY support.load_issues + ADD CONSTRAINT load_issues_pkey PRIMARY KEY (id); -- --- Name: outcome_counts id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: sanity_checks sanity_checks_pkey; Type: CONSTRAINT; Schema: support; Owner: - -- -ALTER TABLE ONLY ctgov.outcome_counts ALTER COLUMN id SET DEFAULT nextval('ctgov.outcome_counts_id_seq'::regclass); +ALTER TABLE ONLY support.sanity_checks + ADD CONSTRAINT sanity_checks_pkey PRIMARY KEY (id); -- --- Name: outcome_measurements id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: study_json_records study_json_records_pkey; Type: CONSTRAINT; Schema: support; Owner: - -- -ALTER TABLE ONLY ctgov.outcome_measurements ALTER COLUMN id SET DEFAULT nextval('ctgov.outcome_measurements_id_seq'::regclass); +ALTER TABLE ONLY support.study_json_records + ADD CONSTRAINT study_json_records_pkey PRIMARY KEY (id); -- --- Name: outcomes id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: study_statistics_comparisons study_statistics_comparisons_pkey; Type: CONSTRAINT; Schema: support; Owner: - -- -ALTER TABLE ONLY ctgov.outcomes ALTER COLUMN id SET DEFAULT nextval('ctgov.outcomes_id_seq'::regclass); +ALTER TABLE ONLY support.study_statistics_comparisons + ADD CONSTRAINT study_statistics_comparisons_pkey PRIMARY KEY (id); -- --- Name: overall_officials id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: study_xml_records study_xml_records_pkey; Type: CONSTRAINT; Schema: support; Owner: - -- -ALTER TABLE ONLY ctgov.overall_officials ALTER COLUMN id SET DEFAULT nextval('ctgov.overall_officials_id_seq'::regclass); +ALTER TABLE ONLY support.study_xml_records + ADD CONSTRAINT study_xml_records_pkey PRIMARY KEY (id); -- --- Name: participant_flows id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: verifiers verifiers_pkey; Type: CONSTRAINT; Schema: support; Owner: - -- -ALTER TABLE ONLY ctgov.participant_flows ALTER COLUMN id SET DEFAULT nextval('ctgov.participant_flows_id_seq'::regclass); +ALTER TABLE ONLY support.verifiers + ADD CONSTRAINT verifiers_pkey PRIMARY KEY (id); -- --- Name: pending_results id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: index_baseline_measurements_on_category; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.pending_results ALTER COLUMN id SET DEFAULT nextval('ctgov.pending_results_id_seq'::regclass); +CREATE INDEX index_baseline_measurements_on_category ON ctgov.baseline_measurements USING btree (category); -- --- Name: provided_documents id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: index_baseline_measurements_on_classification; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.provided_documents ALTER COLUMN id SET DEFAULT nextval('ctgov.provided_documents_id_seq'::regclass); +CREATE INDEX index_baseline_measurements_on_classification ON ctgov.baseline_measurements USING btree (classification); -- --- Name: reported_event_totals id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: index_baseline_measurements_on_dispersion_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.reported_event_totals ALTER COLUMN id SET DEFAULT nextval('ctgov.reported_event_totals_id_seq'::regclass); +CREATE INDEX index_baseline_measurements_on_dispersion_type ON ctgov.baseline_measurements USING btree (dispersion_type); -- --- Name: reported_events id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: index_baseline_measurements_on_param_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.reported_events ALTER COLUMN id SET DEFAULT nextval('ctgov.reported_events_id_seq'::regclass); +CREATE INDEX index_baseline_measurements_on_param_type ON ctgov.baseline_measurements USING btree (param_type); -- --- Name: responsible_parties id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: index_browse_conditions_on_downcase_mesh_term; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.responsible_parties ALTER COLUMN id SET DEFAULT nextval('ctgov.responsible_parties_id_seq'::regclass); +CREATE INDEX index_browse_conditions_on_downcase_mesh_term ON ctgov.browse_conditions USING btree (downcase_mesh_term); -- --- Name: result_agreements id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: index_browse_conditions_on_mesh_term; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.result_agreements ALTER COLUMN id SET DEFAULT nextval('ctgov.result_agreements_id_seq'::regclass); +CREATE INDEX index_browse_conditions_on_mesh_term ON ctgov.browse_conditions USING btree (mesh_term); -- --- Name: result_contacts id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: index_browse_conditions_on_nct_id; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.result_contacts ALTER COLUMN id SET DEFAULT nextval('ctgov.result_contacts_id_seq'::regclass); +CREATE INDEX index_browse_conditions_on_nct_id ON ctgov.browse_conditions USING btree (nct_id); -- --- Name: result_groups id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: index_browse_interventions_on_downcase_mesh_term; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.result_groups ALTER COLUMN id SET DEFAULT nextval('ctgov.result_groups_id_seq'::regclass); +CREATE INDEX index_browse_interventions_on_downcase_mesh_term ON ctgov.browse_interventions USING btree (downcase_mesh_term); -- --- Name: retractions id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: index_browse_interventions_on_mesh_term; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.retractions ALTER COLUMN id SET DEFAULT nextval('ctgov.retractions_id_seq'::regclass); +CREATE INDEX index_browse_interventions_on_mesh_term ON ctgov.browse_interventions USING btree (mesh_term); -- --- Name: search_results id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: index_browse_interventions_on_nct_id; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.search_results ALTER COLUMN id SET DEFAULT nextval('ctgov.search_results_id_seq'::regclass); +CREATE INDEX index_browse_interventions_on_nct_id ON ctgov.browse_interventions USING btree (nct_id); -- --- Name: sponsors id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: index_calculated_values_on_actual_duration; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.sponsors ALTER COLUMN id SET DEFAULT nextval('ctgov.sponsors_id_seq'::regclass); +CREATE INDEX index_calculated_values_on_actual_duration ON ctgov.calculated_values USING btree (actual_duration); -- --- Name: study_records id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: index_calculated_values_on_months_to_report_results; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.study_records ALTER COLUMN id SET DEFAULT nextval('ctgov.study_records_id_seq'::regclass); +CREATE INDEX index_calculated_values_on_months_to_report_results ON ctgov.calculated_values USING btree (months_to_report_results); -- --- Name: study_references id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: index_calculated_values_on_number_of_facilities; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.study_references ALTER COLUMN id SET DEFAULT nextval('ctgov.study_references_id_seq'::regclass); +CREATE INDEX index_calculated_values_on_number_of_facilities ON ctgov.calculated_values USING btree (number_of_facilities); -- --- Name: study_searches id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: index_central_contacts_on_contact_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.study_searches ALTER COLUMN id SET DEFAULT nextval('ctgov.study_searches_id_seq'::regclass); +CREATE INDEX index_central_contacts_on_contact_type ON ctgov.central_contacts USING btree (contact_type); -- --- Name: active_storage_attachments id; Type: DEFAULT; Schema: support; Owner: - +-- Name: index_conditions_on_downcase_name; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.active_storage_attachments ALTER COLUMN id SET DEFAULT nextval('support.active_storage_attachments_id_seq'::regclass); +CREATE INDEX index_conditions_on_downcase_name ON ctgov.conditions USING btree (downcase_name); -- --- Name: active_storage_blobs id; Type: DEFAULT; Schema: support; Owner: - +-- Name: index_conditions_on_name; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.active_storage_blobs ALTER COLUMN id SET DEFAULT nextval('support.active_storage_blobs_id_seq'::regclass); +CREATE INDEX index_conditions_on_name ON ctgov.conditions USING btree (name); -- --- Name: background_jobs id; Type: DEFAULT; Schema: support; Owner: - +-- Name: index_design_group_interventions_on_design_group_id; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.background_jobs ALTER COLUMN id SET DEFAULT nextval('support.background_jobs_id_seq'::regclass); +CREATE INDEX index_design_group_interventions_on_design_group_id ON ctgov.design_group_interventions USING btree (design_group_id); -- --- Name: file_records id; Type: DEFAULT; Schema: support; Owner: - +-- Name: index_design_group_interventions_on_intervention_id; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.file_records ALTER COLUMN id SET DEFAULT nextval('support.file_records_id_seq'::regclass); +CREATE INDEX index_design_group_interventions_on_intervention_id ON ctgov.design_group_interventions USING btree (intervention_id); -- --- Name: load_events id; Type: DEFAULT; Schema: support; Owner: - +-- Name: index_design_groups_on_group_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.load_events ALTER COLUMN id SET DEFAULT nextval('support.load_events_id_seq'::regclass); +CREATE INDEX index_design_groups_on_group_type ON ctgov.design_groups USING btree (group_type); -- --- Name: load_issues id; Type: DEFAULT; Schema: support; Owner: - +-- Name: index_design_outcomes_on_measure; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.load_issues ALTER COLUMN id SET DEFAULT nextval('support.load_issues_id_seq'::regclass); +CREATE INDEX index_design_outcomes_on_measure ON ctgov.design_outcomes USING btree (measure); -- --- Name: sanity_checks id; Type: DEFAULT; Schema: support; Owner: - +-- Name: index_design_outcomes_on_outcome_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.sanity_checks ALTER COLUMN id SET DEFAULT nextval('support.sanity_checks_id_seq'::regclass); +CREATE INDEX index_design_outcomes_on_outcome_type ON ctgov.design_outcomes USING btree (outcome_type); -- --- Name: study_json_records id; Type: DEFAULT; Schema: support; Owner: - +-- Name: index_designs_on_caregiver_masked; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.study_json_records ALTER COLUMN id SET DEFAULT nextval('support.study_json_records_id_seq'::regclass); +CREATE INDEX index_designs_on_caregiver_masked ON ctgov.designs USING btree (caregiver_masked); -- --- Name: study_statistics_comparisons id; Type: DEFAULT; Schema: support; Owner: - +-- Name: index_designs_on_investigator_masked; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.study_statistics_comparisons ALTER COLUMN id SET DEFAULT nextval('support.study_statistics_comparisons_id_seq'::regclass); +CREATE INDEX index_designs_on_investigator_masked ON ctgov.designs USING btree (investigator_masked); -- --- Name: study_xml_records id; Type: DEFAULT; Schema: support; Owner: - +-- Name: index_designs_on_masking; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.study_xml_records ALTER COLUMN id SET DEFAULT nextval('support.study_xml_records_id_seq'::regclass); +CREATE INDEX index_designs_on_masking ON ctgov.designs USING btree (masking); -- --- Name: verifiers id; Type: DEFAULT; Schema: support; Owner: - +-- Name: index_designs_on_outcomes_assessor_masked; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.verifiers ALTER COLUMN id SET DEFAULT nextval('support.verifiers_id_seq'::regclass); +CREATE INDEX index_designs_on_outcomes_assessor_masked ON ctgov.designs USING btree (outcomes_assessor_masked); -- --- Name: baseline_counts baseline_counts_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_designs_on_subject_masked; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.baseline_counts - ADD CONSTRAINT baseline_counts_pkey PRIMARY KEY (id); +CREATE INDEX index_designs_on_subject_masked ON ctgov.designs USING btree (subject_masked); -- --- Name: baseline_measurements baseline_measurements_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_documents_on_document_id; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.baseline_measurements - ADD CONSTRAINT baseline_measurements_pkey PRIMARY KEY (id); +CREATE INDEX index_documents_on_document_id ON ctgov.documents USING btree (document_id); -- --- Name: brief_summaries brief_summaries_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_documents_on_document_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.brief_summaries - ADD CONSTRAINT brief_summaries_pkey PRIMARY KEY (id); +CREATE INDEX index_documents_on_document_type ON ctgov.documents USING btree (document_type); -- --- Name: browse_conditions browse_conditions_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_drop_withdrawals_on_period; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.browse_conditions - ADD CONSTRAINT browse_conditions_pkey PRIMARY KEY (id); +CREATE INDEX index_drop_withdrawals_on_period ON ctgov.drop_withdrawals USING btree (period); -- --- Name: browse_interventions browse_interventions_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_eligibilities_on_gender; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.browse_interventions - ADD CONSTRAINT browse_interventions_pkey PRIMARY KEY (id); +CREATE INDEX index_eligibilities_on_gender ON ctgov.eligibilities USING btree (gender); -- --- Name: calculated_values calculated_values_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_eligibilities_on_healthy_volunteers; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.calculated_values - ADD CONSTRAINT calculated_values_pkey PRIMARY KEY (id); +CREATE INDEX index_eligibilities_on_healthy_volunteers ON ctgov.eligibilities USING btree (healthy_volunteers); -- --- Name: central_contacts central_contacts_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_eligibilities_on_maximum_age; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.central_contacts - ADD CONSTRAINT central_contacts_pkey PRIMARY KEY (id); +CREATE INDEX index_eligibilities_on_maximum_age ON ctgov.eligibilities USING btree (maximum_age); -- --- Name: conditions conditions_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_eligibilities_on_minimum_age; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.conditions - ADD CONSTRAINT conditions_pkey PRIMARY KEY (id); +CREATE INDEX index_eligibilities_on_minimum_age ON ctgov.eligibilities USING btree (minimum_age); -- --- Name: countries countries_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_facilities_on_city; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.countries - ADD CONSTRAINT countries_pkey PRIMARY KEY (id); +CREATE INDEX index_facilities_on_city ON ctgov.facilities USING btree (city); -- --- Name: design_group_interventions design_group_interventions_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_facilities_on_country; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.design_group_interventions - ADD CONSTRAINT design_group_interventions_pkey PRIMARY KEY (id); +CREATE INDEX index_facilities_on_country ON ctgov.facilities USING btree (country); -- --- Name: design_groups design_groups_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_facilities_on_name; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.design_groups - ADD CONSTRAINT design_groups_pkey PRIMARY KEY (id); +CREATE INDEX index_facilities_on_name ON ctgov.facilities USING btree (name); -- --- Name: design_outcomes design_outcomes_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_facilities_on_state; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.design_outcomes - ADD CONSTRAINT design_outcomes_pkey PRIMARY KEY (id); +CREATE INDEX index_facilities_on_state ON ctgov.facilities USING btree (state); -- --- Name: designs designs_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_facilities_on_status; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.designs - ADD CONSTRAINT designs_pkey PRIMARY KEY (id); +CREATE INDEX index_facilities_on_status ON ctgov.facilities USING btree (status); -- --- Name: detailed_descriptions detailed_descriptions_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_facility_contacts_on_contact_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.detailed_descriptions - ADD CONSTRAINT detailed_descriptions_pkey PRIMARY KEY (id); +CREATE INDEX index_facility_contacts_on_contact_type ON ctgov.facility_contacts USING btree (contact_type); -- --- Name: documents documents_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_id_information_on_id_source; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.documents - ADD CONSTRAINT documents_pkey PRIMARY KEY (id); +CREATE INDEX index_id_information_on_id_source ON ctgov.id_information USING btree (id_source); -- --- Name: drop_withdrawals drop_withdrawals_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_interventions_on_intervention_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.drop_withdrawals - ADD CONSTRAINT drop_withdrawals_pkey PRIMARY KEY (id); +CREATE INDEX index_interventions_on_intervention_type ON ctgov.interventions USING btree (intervention_type); -- --- Name: eligibilities eligibilities_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_keywords_on_downcase_name; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.eligibilities - ADD CONSTRAINT eligibilities_pkey PRIMARY KEY (id); +CREATE INDEX index_keywords_on_downcase_name ON ctgov.keywords USING btree (downcase_name); -- --- Name: facilities facilities_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_keywords_on_name; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.facilities - ADD CONSTRAINT facilities_pkey PRIMARY KEY (id); +CREATE INDEX index_keywords_on_name ON ctgov.keywords USING btree (name); -- --- Name: facility_contacts facility_contacts_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_mesh_headings_on_qualifier; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.facility_contacts - ADD CONSTRAINT facility_contacts_pkey PRIMARY KEY (id); +CREATE INDEX index_mesh_headings_on_qualifier ON ctgov.mesh_headings USING btree (qualifier); -- --- Name: facility_investigators facility_investigators_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_mesh_terms_on_description; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.facility_investigators - ADD CONSTRAINT facility_investigators_pkey PRIMARY KEY (id); +CREATE INDEX index_mesh_terms_on_description ON ctgov.mesh_terms USING btree (description); -- --- Name: id_information id_information_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_mesh_terms_on_downcase_mesh_term; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.id_information - ADD CONSTRAINT id_information_pkey PRIMARY KEY (id); +CREATE INDEX index_mesh_terms_on_downcase_mesh_term ON ctgov.mesh_terms USING btree (downcase_mesh_term); -- --- Name: intervention_other_names intervention_other_names_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_mesh_terms_on_mesh_term; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.intervention_other_names - ADD CONSTRAINT intervention_other_names_pkey PRIMARY KEY (id); +CREATE INDEX index_mesh_terms_on_mesh_term ON ctgov.mesh_terms USING btree (mesh_term); -- --- Name: interventions interventions_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_mesh_terms_on_qualifier; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.interventions - ADD CONSTRAINT interventions_pkey PRIMARY KEY (id); +CREATE INDEX index_mesh_terms_on_qualifier ON ctgov.mesh_terms USING btree (qualifier); -- --- Name: ipd_information_types ipd_information_types_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_milestones_on_period; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.ipd_information_types - ADD CONSTRAINT ipd_information_types_pkey PRIMARY KEY (id); +CREATE INDEX index_milestones_on_period ON ctgov.milestones USING btree (period); -- --- Name: keywords keywords_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_outcome_analyses_on_dispersion_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.keywords - ADD CONSTRAINT keywords_pkey PRIMARY KEY (id); +CREATE INDEX index_outcome_analyses_on_dispersion_type ON ctgov.outcome_analyses USING btree (dispersion_type); -- --- Name: links links_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_outcome_analyses_on_param_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.links - ADD CONSTRAINT links_pkey PRIMARY KEY (id); +CREATE INDEX index_outcome_analyses_on_param_type ON ctgov.outcome_analyses USING btree (param_type); -- --- Name: mesh_headings mesh_headings_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_outcome_measurements_on_category; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.mesh_headings - ADD CONSTRAINT mesh_headings_pkey PRIMARY KEY (id); +CREATE INDEX index_outcome_measurements_on_category ON ctgov.outcome_measurements USING btree (category); -- --- Name: mesh_terms mesh_terms_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_outcome_measurements_on_classification; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.mesh_terms - ADD CONSTRAINT mesh_terms_pkey PRIMARY KEY (id); +CREATE INDEX index_outcome_measurements_on_classification ON ctgov.outcome_measurements USING btree (classification); -- --- Name: milestones milestones_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_outcome_measurements_on_dispersion_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.milestones - ADD CONSTRAINT milestones_pkey PRIMARY KEY (id); +CREATE INDEX index_outcome_measurements_on_dispersion_type ON ctgov.outcome_measurements USING btree (dispersion_type); -- --- Name: outcome_analyses outcome_analyses_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_outcomes_on_dispersion_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.outcome_analyses - ADD CONSTRAINT outcome_analyses_pkey PRIMARY KEY (id); +CREATE INDEX index_outcomes_on_dispersion_type ON ctgov.outcomes USING btree (dispersion_type); -- --- Name: outcome_analysis_groups outcome_analysis_groups_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_outcomes_on_param_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.outcome_analysis_groups - ADD CONSTRAINT outcome_analysis_groups_pkey PRIMARY KEY (id); +CREATE INDEX index_outcomes_on_param_type ON ctgov.outcomes USING btree (param_type); -- --- Name: outcome_counts outcome_counts_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_overall_officials_on_affiliation; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.outcome_counts - ADD CONSTRAINT outcome_counts_pkey PRIMARY KEY (id); +CREATE INDEX index_overall_officials_on_affiliation ON ctgov.overall_officials USING btree (affiliation); -- --- Name: outcome_measurements outcome_measurements_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_overall_officials_on_nct_id; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.outcome_measurements - ADD CONSTRAINT outcome_measurements_pkey PRIMARY KEY (id); +CREATE INDEX index_overall_officials_on_nct_id ON ctgov.overall_officials USING btree (nct_id); -- --- Name: outcomes outcomes_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_reported_events_on_event_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.outcomes - ADD CONSTRAINT outcomes_pkey PRIMARY KEY (id); +CREATE INDEX index_reported_events_on_event_type ON ctgov.reported_events USING btree (event_type); -- --- Name: overall_officials overall_officials_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_reported_events_on_subjects_affected; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.overall_officials - ADD CONSTRAINT overall_officials_pkey PRIMARY KEY (id); +CREATE INDEX index_reported_events_on_subjects_affected ON ctgov.reported_events USING btree (subjects_affected); -- --- Name: participant_flows participant_flows_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_responsible_parties_on_nct_id; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.participant_flows - ADD CONSTRAINT participant_flows_pkey PRIMARY KEY (id); +CREATE INDEX index_responsible_parties_on_nct_id ON ctgov.responsible_parties USING btree (nct_id); -- --- Name: pending_results pending_results_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_responsible_parties_on_organization; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.pending_results - ADD CONSTRAINT pending_results_pkey PRIMARY KEY (id); +CREATE INDEX index_responsible_parties_on_organization ON ctgov.responsible_parties USING btree (organization); -- --- Name: provided_documents provided_documents_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_responsible_parties_on_responsible_party_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.provided_documents - ADD CONSTRAINT provided_documents_pkey PRIMARY KEY (id); +CREATE INDEX index_responsible_parties_on_responsible_party_type ON ctgov.responsible_parties USING btree (responsible_party_type); -- --- Name: reported_event_totals reported_event_totals_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_result_contacts_on_organization; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.reported_event_totals - ADD CONSTRAINT reported_event_totals_pkey PRIMARY KEY (id); +CREATE INDEX index_result_contacts_on_organization ON ctgov.result_contacts USING btree (organization); -- --- Name: reported_events reported_events_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_result_groups_on_result_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.reported_events - ADD CONSTRAINT reported_events_pkey PRIMARY KEY (id); +CREATE INDEX index_result_groups_on_result_type ON ctgov.result_groups USING btree (result_type); -- --- Name: responsible_parties responsible_parties_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_search_results_on_nct_id_and_name; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.responsible_parties - ADD CONSTRAINT responsible_parties_pkey PRIMARY KEY (id); +CREATE UNIQUE INDEX index_search_results_on_nct_id_and_name ON ctgov.search_results USING btree (nct_id, name); -- --- Name: result_agreements result_agreements_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_search_results_on_nct_id_and_name_and_grouping; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.result_agreements - ADD CONSTRAINT result_agreements_pkey PRIMARY KEY (id); +CREATE UNIQUE INDEX index_search_results_on_nct_id_and_name_and_grouping ON ctgov.search_results USING btree (nct_id, name, "grouping"); -- --- Name: result_contacts result_contacts_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_sponsors_on_agency_class; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.result_contacts - ADD CONSTRAINT result_contacts_pkey PRIMARY KEY (id); +CREATE INDEX index_sponsors_on_agency_class ON ctgov.sponsors USING btree (agency_class); -- --- Name: result_groups result_groups_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_sponsors_on_name; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.result_groups - ADD CONSTRAINT result_groups_pkey PRIMARY KEY (id); +CREATE INDEX index_sponsors_on_name ON ctgov.sponsors USING btree (name); -- --- Name: retractions retractions_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_studies_on_completion_date; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.retractions - ADD CONSTRAINT retractions_pkey PRIMARY KEY (id); +CREATE INDEX index_studies_on_completion_date ON ctgov.studies USING btree (completion_date); -- --- Name: search_results search_results_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_studies_on_disposition_first_submitted_date; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.search_results - ADD CONSTRAINT search_results_pkey PRIMARY KEY (id); +CREATE INDEX index_studies_on_disposition_first_submitted_date ON ctgov.studies USING btree (disposition_first_submitted_date); -- --- Name: sponsors sponsors_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_studies_on_enrollment_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.sponsors - ADD CONSTRAINT sponsors_pkey PRIMARY KEY (id); +CREATE INDEX index_studies_on_enrollment_type ON ctgov.studies USING btree (enrollment_type); -- --- Name: study_records study_records_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_studies_on_last_known_status; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.study_records - ADD CONSTRAINT study_records_pkey PRIMARY KEY (id); +CREATE INDEX index_studies_on_last_known_status ON ctgov.studies USING btree (last_known_status); -- --- Name: study_references study_references_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_studies_on_last_update_submitted_date; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.study_references - ADD CONSTRAINT study_references_pkey PRIMARY KEY (id); +CREATE INDEX index_studies_on_last_update_submitted_date ON ctgov.studies USING btree (last_update_submitted_date); -- --- Name: study_searches study_searches_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_studies_on_nct_id; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.study_searches - ADD CONSTRAINT study_searches_pkey PRIMARY KEY (id); +CREATE UNIQUE INDEX index_studies_on_nct_id ON ctgov.studies USING btree (nct_id); -- --- Name: ar_internal_metadata ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: index_studies_on_overall_status; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY public.ar_internal_metadata - ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key); +CREATE INDEX index_studies_on_overall_status ON ctgov.studies USING btree (overall_status); -- --- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: index_studies_on_phase; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY public.schema_migrations - ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version); +CREATE INDEX index_studies_on_phase ON ctgov.studies USING btree (phase); -- --- Name: active_storage_attachments active_storage_attachments_pkey; Type: CONSTRAINT; Schema: support; Owner: - +-- Name: index_studies_on_primary_completion_date; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.active_storage_attachments - ADD CONSTRAINT active_storage_attachments_pkey PRIMARY KEY (id); +CREATE INDEX index_studies_on_primary_completion_date ON ctgov.studies USING btree (primary_completion_date); -- --- Name: active_storage_blobs active_storage_blobs_pkey; Type: CONSTRAINT; Schema: support; Owner: - +-- Name: index_studies_on_primary_completion_date_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.active_storage_blobs - ADD CONSTRAINT active_storage_blobs_pkey PRIMARY KEY (id); +CREATE INDEX index_studies_on_primary_completion_date_type ON ctgov.studies USING btree (primary_completion_date_type); -- --- Name: background_jobs background_jobs_pkey; Type: CONSTRAINT; Schema: support; Owner: - +-- Name: index_studies_on_results_first_submitted_date; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.background_jobs - ADD CONSTRAINT background_jobs_pkey PRIMARY KEY (id); +CREATE INDEX index_studies_on_results_first_submitted_date ON ctgov.studies USING btree (results_first_submitted_date); -- --- Name: file_records file_records_pkey; Type: CONSTRAINT; Schema: support; Owner: - +-- Name: index_studies_on_source; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.file_records - ADD CONSTRAINT file_records_pkey PRIMARY KEY (id); +CREATE INDEX index_studies_on_source ON ctgov.studies USING btree (source); -- --- Name: load_events load_events_pkey; Type: CONSTRAINT; Schema: support; Owner: - +-- Name: index_studies_on_start_date; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.load_events - ADD CONSTRAINT load_events_pkey PRIMARY KEY (id); +CREATE INDEX index_studies_on_start_date ON ctgov.studies USING btree (start_date); -- --- Name: load_issues load_issues_pkey; Type: CONSTRAINT; Schema: support; Owner: - +-- Name: index_studies_on_start_date_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.load_issues - ADD CONSTRAINT load_issues_pkey PRIMARY KEY (id); +CREATE INDEX index_studies_on_start_date_type ON ctgov.studies USING btree (start_date_type); -- --- Name: sanity_checks sanity_checks_pkey; Type: CONSTRAINT; Schema: support; Owner: - +-- Name: index_studies_on_study_first_submitted_date; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.sanity_checks - ADD CONSTRAINT sanity_checks_pkey PRIMARY KEY (id); +CREATE INDEX index_studies_on_study_first_submitted_date ON ctgov.studies USING btree (study_first_submitted_date); -- --- Name: study_json_records study_json_records_pkey; Type: CONSTRAINT; Schema: support; Owner: - +-- Name: index_studies_on_study_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.study_json_records - ADD CONSTRAINT study_json_records_pkey PRIMARY KEY (id); +CREATE INDEX index_studies_on_study_type ON ctgov.studies USING btree (study_type); -- --- Name: study_statistics_comparisons study_statistics_comparisons_pkey; Type: CONSTRAINT; Schema: support; Owner: - +-- Name: index_study_records_on_nct_id_and_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.study_statistics_comparisons - ADD CONSTRAINT study_statistics_comparisons_pkey PRIMARY KEY (id); +CREATE UNIQUE INDEX index_study_records_on_nct_id_and_type ON ctgov.study_records USING btree (nct_id, type); -- --- Name: study_xml_records study_xml_records_pkey; Type: CONSTRAINT; Schema: support; Owner: - +-- Name: index_study_references_on_reference_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.study_xml_records - ADD CONSTRAINT study_xml_records_pkey PRIMARY KEY (id); +CREATE INDEX index_study_references_on_reference_type ON ctgov.study_references USING btree (reference_type); -- --- Name: verifiers verifiers_pkey; Type: CONSTRAINT; Schema: support; Owner: - +-- Name: index_study_searches_on_query_and_grouping; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.verifiers - ADD CONSTRAINT verifiers_pkey PRIMARY KEY (id); +CREATE UNIQUE INDEX index_study_searches_on_query_and_grouping ON ctgov.study_searches USING btree (query, "grouping"); -- --- Name: index_baseline_measurements_on_category; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_baseline_measurements_on_category; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_baseline_measurements_on_category ON ctgov.baseline_measurements USING btree (category); +CREATE INDEX index_baseline_measurements_on_category ON ctgov_v2.baseline_measurements USING btree (category); -- --- Name: index_baseline_measurements_on_classification; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_baseline_measurements_on_classification; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_baseline_measurements_on_classification ON ctgov.baseline_measurements USING btree (classification); +CREATE INDEX index_baseline_measurements_on_classification ON ctgov_v2.baseline_measurements USING btree (classification); -- --- Name: index_baseline_measurements_on_dispersion_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_baseline_measurements_on_dispersion_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_baseline_measurements_on_dispersion_type ON ctgov.baseline_measurements USING btree (dispersion_type); +CREATE INDEX index_baseline_measurements_on_dispersion_type ON ctgov_v2.baseline_measurements USING btree (dispersion_type); -- --- Name: index_baseline_measurements_on_param_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_baseline_measurements_on_param_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_baseline_measurements_on_param_type ON ctgov.baseline_measurements USING btree (param_type); +CREATE INDEX index_baseline_measurements_on_param_type ON ctgov_v2.baseline_measurements USING btree (param_type); -- --- Name: index_browse_conditions_on_downcase_mesh_term; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_browse_conditions_on_downcase_mesh_term; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_browse_conditions_on_downcase_mesh_term ON ctgov.browse_conditions USING btree (downcase_mesh_term); +CREATE INDEX index_browse_conditions_on_downcase_mesh_term ON ctgov_v2.browse_conditions USING btree (downcase_mesh_term); -- --- Name: index_browse_conditions_on_mesh_term; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_browse_conditions_on_mesh_term; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_browse_conditions_on_mesh_term ON ctgov.browse_conditions USING btree (mesh_term); +CREATE INDEX index_browse_conditions_on_mesh_term ON ctgov_v2.browse_conditions USING btree (mesh_term); -- --- Name: index_browse_conditions_on_nct_id; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_browse_conditions_on_nct_id; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_browse_conditions_on_nct_id ON ctgov.browse_conditions USING btree (nct_id); +CREATE INDEX index_browse_conditions_on_nct_id ON ctgov_v2.browse_conditions USING btree (nct_id); -- --- Name: index_browse_interventions_on_downcase_mesh_term; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_browse_interventions_on_downcase_mesh_term; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_browse_interventions_on_downcase_mesh_term ON ctgov.browse_interventions USING btree (downcase_mesh_term); +CREATE INDEX index_browse_interventions_on_downcase_mesh_term ON ctgov_v2.browse_interventions USING btree (downcase_mesh_term); -- --- Name: index_browse_interventions_on_mesh_term; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_browse_interventions_on_mesh_term; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_browse_interventions_on_mesh_term ON ctgov.browse_interventions USING btree (mesh_term); +CREATE INDEX index_browse_interventions_on_mesh_term ON ctgov_v2.browse_interventions USING btree (mesh_term); -- --- Name: index_browse_interventions_on_nct_id; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_browse_interventions_on_nct_id; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_browse_interventions_on_nct_id ON ctgov.browse_interventions USING btree (nct_id); +CREATE INDEX index_browse_interventions_on_nct_id ON ctgov_v2.browse_interventions USING btree (nct_id); -- --- Name: index_calculated_values_on_actual_duration; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_calculated_values_on_actual_duration; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_calculated_values_on_actual_duration ON ctgov.calculated_values USING btree (actual_duration); +CREATE INDEX index_calculated_values_on_actual_duration ON ctgov_v2.calculated_values USING btree (actual_duration); -- --- Name: index_calculated_values_on_months_to_report_results; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_calculated_values_on_months_to_report_results; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_calculated_values_on_months_to_report_results ON ctgov.calculated_values USING btree (months_to_report_results); +CREATE INDEX index_calculated_values_on_months_to_report_results ON ctgov_v2.calculated_values USING btree (months_to_report_results); -- --- Name: index_calculated_values_on_number_of_facilities; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_calculated_values_on_number_of_facilities; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_calculated_values_on_number_of_facilities ON ctgov.calculated_values USING btree (number_of_facilities); +CREATE INDEX index_calculated_values_on_number_of_facilities ON ctgov_v2.calculated_values USING btree (number_of_facilities); -- --- Name: index_central_contacts_on_contact_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_central_contacts_on_contact_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_central_contacts_on_contact_type ON ctgov.central_contacts USING btree (contact_type); +CREATE INDEX index_central_contacts_on_contact_type ON ctgov_v2.central_contacts USING btree (contact_type); -- --- Name: index_conditions_on_downcase_name; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_conditions_on_downcase_name; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_conditions_on_downcase_name ON ctgov.conditions USING btree (downcase_name); +CREATE INDEX index_conditions_on_downcase_name ON ctgov_v2.conditions USING btree (downcase_name); -- --- Name: index_conditions_on_name; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_conditions_on_name; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_conditions_on_name ON ctgov.conditions USING btree (name); +CREATE INDEX index_conditions_on_name ON ctgov_v2.conditions USING btree (name); -- --- Name: index_design_group_interventions_on_design_group_id; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_design_group_interventions_on_design_group_id; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_design_group_interventions_on_design_group_id ON ctgov.design_group_interventions USING btree (design_group_id); +CREATE INDEX index_design_group_interventions_on_design_group_id ON ctgov_v2.design_group_interventions USING btree (design_group_id); -- --- Name: index_design_group_interventions_on_intervention_id; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_design_group_interventions_on_intervention_id; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_design_group_interventions_on_intervention_id ON ctgov.design_group_interventions USING btree (intervention_id); +CREATE INDEX index_design_group_interventions_on_intervention_id ON ctgov_v2.design_group_interventions USING btree (intervention_id); -- --- Name: index_design_groups_on_group_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_design_groups_on_group_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_design_groups_on_group_type ON ctgov.design_groups USING btree (group_type); +CREATE INDEX index_design_groups_on_group_type ON ctgov_v2.design_groups USING btree (group_type); -- --- Name: index_design_outcomes_on_measure; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_design_outcomes_on_measure; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_design_outcomes_on_measure ON ctgov.design_outcomes USING btree (measure); +CREATE INDEX index_design_outcomes_on_measure ON ctgov_v2.design_outcomes USING btree (measure); -- --- Name: index_design_outcomes_on_outcome_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_design_outcomes_on_outcome_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_design_outcomes_on_outcome_type ON ctgov.design_outcomes USING btree (outcome_type); +CREATE INDEX index_design_outcomes_on_outcome_type ON ctgov_v2.design_outcomes USING btree (outcome_type); -- --- Name: index_designs_on_caregiver_masked; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_designs_on_caregiver_masked; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_designs_on_caregiver_masked ON ctgov.designs USING btree (caregiver_masked); +CREATE INDEX index_designs_on_caregiver_masked ON ctgov_v2.designs USING btree (caregiver_masked); -- --- Name: index_designs_on_investigator_masked; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_designs_on_investigator_masked; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_designs_on_investigator_masked ON ctgov.designs USING btree (investigator_masked); +CREATE INDEX index_designs_on_investigator_masked ON ctgov_v2.designs USING btree (investigator_masked); -- --- Name: index_designs_on_masking; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_designs_on_masking; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_designs_on_masking ON ctgov.designs USING btree (masking); +CREATE INDEX index_designs_on_masking ON ctgov_v2.designs USING btree (masking); -- --- Name: index_designs_on_outcomes_assessor_masked; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_designs_on_outcomes_assessor_masked; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_designs_on_outcomes_assessor_masked ON ctgov.designs USING btree (outcomes_assessor_masked); +CREATE INDEX index_designs_on_outcomes_assessor_masked ON ctgov_v2.designs USING btree (outcomes_assessor_masked); -- --- Name: index_designs_on_subject_masked; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_designs_on_subject_masked; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_designs_on_subject_masked ON ctgov.designs USING btree (subject_masked); +CREATE INDEX index_designs_on_subject_masked ON ctgov_v2.designs USING btree (subject_masked); -- --- Name: index_documents_on_document_id; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_documents_on_document_id; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_documents_on_document_id ON ctgov.documents USING btree (document_id); +CREATE INDEX index_documents_on_document_id ON ctgov_v2.documents USING btree (document_id); -- --- Name: index_documents_on_document_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_documents_on_document_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_documents_on_document_type ON ctgov.documents USING btree (document_type); +CREATE INDEX index_documents_on_document_type ON ctgov_v2.documents USING btree (document_type); -- --- Name: index_drop_withdrawals_on_period; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_drop_withdrawals_on_period; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_drop_withdrawals_on_period ON ctgov.drop_withdrawals USING btree (period); +CREATE INDEX index_drop_withdrawals_on_period ON ctgov_v2.drop_withdrawals USING btree (period); -- --- Name: index_eligibilities_on_gender; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_eligibilities_on_gender; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_eligibilities_on_gender ON ctgov.eligibilities USING btree (gender); +CREATE INDEX index_eligibilities_on_gender ON ctgov_v2.eligibilities USING btree (gender); -- --- Name: index_eligibilities_on_healthy_volunteers; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_eligibilities_on_healthy_volunteers; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_eligibilities_on_healthy_volunteers ON ctgov.eligibilities USING btree (healthy_volunteers); +CREATE INDEX index_eligibilities_on_healthy_volunteers ON ctgov_v2.eligibilities USING btree (healthy_volunteers); -- --- Name: index_eligibilities_on_maximum_age; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_eligibilities_on_maximum_age; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_eligibilities_on_maximum_age ON ctgov.eligibilities USING btree (maximum_age); +CREATE INDEX index_eligibilities_on_maximum_age ON ctgov_v2.eligibilities USING btree (maximum_age); -- --- Name: index_eligibilities_on_minimum_age; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_eligibilities_on_minimum_age; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_eligibilities_on_minimum_age ON ctgov.eligibilities USING btree (minimum_age); +CREATE INDEX index_eligibilities_on_minimum_age ON ctgov_v2.eligibilities USING btree (minimum_age); -- --- Name: index_facilities_on_city; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_facilities_on_city; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_facilities_on_city ON ctgov.facilities USING btree (city); +CREATE INDEX index_facilities_on_city ON ctgov_v2.facilities USING btree (city); -- --- Name: index_facilities_on_country; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_facilities_on_country; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_facilities_on_country ON ctgov.facilities USING btree (country); +CREATE INDEX index_facilities_on_country ON ctgov_v2.facilities USING btree (country); -- --- Name: index_facilities_on_name; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_facilities_on_name; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_facilities_on_name ON ctgov.facilities USING btree (name); +CREATE INDEX index_facilities_on_name ON ctgov_v2.facilities USING btree (name); -- --- Name: index_facilities_on_state; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_facilities_on_state; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_facilities_on_state ON ctgov.facilities USING btree (state); +CREATE INDEX index_facilities_on_state ON ctgov_v2.facilities USING btree (state); -- --- Name: index_facilities_on_status; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_facilities_on_status; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_facilities_on_status ON ctgov.facilities USING btree (status); +CREATE INDEX index_facilities_on_status ON ctgov_v2.facilities USING btree (status); -- --- Name: index_facility_contacts_on_contact_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_facility_contacts_on_contact_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_facility_contacts_on_contact_type ON ctgov.facility_contacts USING btree (contact_type); +CREATE INDEX index_facility_contacts_on_contact_type ON ctgov_v2.facility_contacts USING btree (contact_type); -- --- Name: index_id_information_on_id_source; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_id_information_on_id_source; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_id_information_on_id_source ON ctgov.id_information USING btree (id_source); +CREATE INDEX index_id_information_on_id_source ON ctgov_v2.id_information USING btree (id_source); -- --- Name: index_interventions_on_intervention_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_interventions_on_intervention_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_interventions_on_intervention_type ON ctgov.interventions USING btree (intervention_type); +CREATE INDEX index_interventions_on_intervention_type ON ctgov_v2.interventions USING btree (intervention_type); -- --- Name: index_keywords_on_downcase_name; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_keywords_on_downcase_name; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_keywords_on_downcase_name ON ctgov.keywords USING btree (downcase_name); +CREATE INDEX index_keywords_on_downcase_name ON ctgov_v2.keywords USING btree (downcase_name); -- --- Name: index_keywords_on_name; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_keywords_on_name; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_keywords_on_name ON ctgov.keywords USING btree (name); +CREATE INDEX index_keywords_on_name ON ctgov_v2.keywords USING btree (name); -- --- Name: index_mesh_headings_on_qualifier; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_mesh_headings_on_qualifier; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_mesh_headings_on_qualifier ON ctgov.mesh_headings USING btree (qualifier); +CREATE INDEX index_mesh_headings_on_qualifier ON ctgov_v2.mesh_headings USING btree (qualifier); -- --- Name: index_mesh_terms_on_description; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_mesh_terms_on_description; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_mesh_terms_on_description ON ctgov.mesh_terms USING btree (description); +CREATE INDEX index_mesh_terms_on_description ON ctgov_v2.mesh_terms USING btree (description); -- --- Name: index_mesh_terms_on_downcase_mesh_term; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_mesh_terms_on_downcase_mesh_term; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_mesh_terms_on_downcase_mesh_term ON ctgov.mesh_terms USING btree (downcase_mesh_term); +CREATE INDEX index_mesh_terms_on_downcase_mesh_term ON ctgov_v2.mesh_terms USING btree (downcase_mesh_term); -- --- Name: index_mesh_terms_on_mesh_term; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_mesh_terms_on_mesh_term; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_mesh_terms_on_mesh_term ON ctgov.mesh_terms USING btree (mesh_term); +CREATE INDEX index_mesh_terms_on_mesh_term ON ctgov_v2.mesh_terms USING btree (mesh_term); -- --- Name: index_mesh_terms_on_qualifier; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_mesh_terms_on_qualifier; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_mesh_terms_on_qualifier ON ctgov.mesh_terms USING btree (qualifier); +CREATE INDEX index_mesh_terms_on_qualifier ON ctgov_v2.mesh_terms USING btree (qualifier); -- --- Name: index_milestones_on_period; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_milestones_on_period; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_milestones_on_period ON ctgov.milestones USING btree (period); +CREATE INDEX index_milestones_on_period ON ctgov_v2.milestones USING btree (period); -- --- Name: index_outcome_analyses_on_dispersion_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_outcome_analyses_on_dispersion_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_outcome_analyses_on_dispersion_type ON ctgov.outcome_analyses USING btree (dispersion_type); +CREATE INDEX index_outcome_analyses_on_dispersion_type ON ctgov_v2.outcome_analyses USING btree (dispersion_type); -- --- Name: index_outcome_analyses_on_param_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_outcome_analyses_on_param_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_outcome_analyses_on_param_type ON ctgov.outcome_analyses USING btree (param_type); +CREATE INDEX index_outcome_analyses_on_param_type ON ctgov_v2.outcome_analyses USING btree (param_type); -- --- Name: index_outcome_measurements_on_category; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_outcome_measurements_on_category; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_outcome_measurements_on_category ON ctgov.outcome_measurements USING btree (category); +CREATE INDEX index_outcome_measurements_on_category ON ctgov_v2.outcome_measurements USING btree (category); -- --- Name: index_outcome_measurements_on_classification; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_outcome_measurements_on_classification; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_outcome_measurements_on_classification ON ctgov.outcome_measurements USING btree (classification); +CREATE INDEX index_outcome_measurements_on_classification ON ctgov_v2.outcome_measurements USING btree (classification); -- --- Name: index_outcome_measurements_on_dispersion_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_outcome_measurements_on_dispersion_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_outcome_measurements_on_dispersion_type ON ctgov.outcome_measurements USING btree (dispersion_type); +CREATE INDEX index_outcome_measurements_on_dispersion_type ON ctgov_v2.outcome_measurements USING btree (dispersion_type); -- --- Name: index_outcomes_on_dispersion_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_outcomes_on_dispersion_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_outcomes_on_dispersion_type ON ctgov.outcomes USING btree (dispersion_type); +CREATE INDEX index_outcomes_on_dispersion_type ON ctgov_v2.outcomes USING btree (dispersion_type); -- --- Name: index_outcomes_on_param_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_outcomes_on_param_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_outcomes_on_param_type ON ctgov.outcomes USING btree (param_type); +CREATE INDEX index_outcomes_on_param_type ON ctgov_v2.outcomes USING btree (param_type); -- --- Name: index_overall_officials_on_affiliation; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_overall_officials_on_affiliation; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_overall_officials_on_affiliation ON ctgov.overall_officials USING btree (affiliation); +CREATE INDEX index_overall_officials_on_affiliation ON ctgov_v2.overall_officials USING btree (affiliation); -- --- Name: index_overall_officials_on_nct_id; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_overall_officials_on_nct_id; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_overall_officials_on_nct_id ON ctgov.overall_officials USING btree (nct_id); +CREATE INDEX index_overall_officials_on_nct_id ON ctgov_v2.overall_officials USING btree (nct_id); -- --- Name: index_reported_events_on_event_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_reported_events_on_event_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_reported_events_on_event_type ON ctgov.reported_events USING btree (event_type); +CREATE INDEX index_reported_events_on_event_type ON ctgov_v2.reported_events USING btree (event_type); -- --- Name: index_reported_events_on_subjects_affected; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_reported_events_on_subjects_affected; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_reported_events_on_subjects_affected ON ctgov.reported_events USING btree (subjects_affected); +CREATE INDEX index_reported_events_on_subjects_affected ON ctgov_v2.reported_events USING btree (subjects_affected); -- --- Name: index_responsible_parties_on_nct_id; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_responsible_parties_on_nct_id; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_responsible_parties_on_nct_id ON ctgov.responsible_parties USING btree (nct_id); +CREATE INDEX index_responsible_parties_on_nct_id ON ctgov_v2.responsible_parties USING btree (nct_id); -- --- Name: index_responsible_parties_on_organization; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_responsible_parties_on_organization; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_responsible_parties_on_organization ON ctgov.responsible_parties USING btree (organization); +CREATE INDEX index_responsible_parties_on_organization ON ctgov_v2.responsible_parties USING btree (organization); -- --- Name: index_responsible_parties_on_responsible_party_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_responsible_parties_on_responsible_party_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_responsible_parties_on_responsible_party_type ON ctgov.responsible_parties USING btree (responsible_party_type); +CREATE INDEX index_responsible_parties_on_responsible_party_type ON ctgov_v2.responsible_parties USING btree (responsible_party_type); -- --- Name: index_result_contacts_on_organization; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_result_contacts_on_organization; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_result_contacts_on_organization ON ctgov.result_contacts USING btree (organization); +CREATE INDEX index_result_contacts_on_organization ON ctgov_v2.result_contacts USING btree (organization); -- --- Name: index_result_groups_on_result_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_result_groups_on_result_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_result_groups_on_result_type ON ctgov.result_groups USING btree (result_type); +CREATE INDEX index_result_groups_on_result_type ON ctgov_v2.result_groups USING btree (result_type); -- --- Name: index_search_results_on_nct_id_and_name; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_search_results_on_nct_id_and_name; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE UNIQUE INDEX index_search_results_on_nct_id_and_name ON ctgov.search_results USING btree (nct_id, name); +CREATE UNIQUE INDEX index_search_results_on_nct_id_and_name ON ctgov_v2.search_results USING btree (nct_id, name); -- --- Name: index_search_results_on_nct_id_and_name_and_grouping; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_search_results_on_nct_id_and_name_and_grouping; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE UNIQUE INDEX index_search_results_on_nct_id_and_name_and_grouping ON ctgov.search_results USING btree (nct_id, name, "grouping"); +CREATE UNIQUE INDEX index_search_results_on_nct_id_and_name_and_grouping ON ctgov_v2.search_results USING btree (nct_id, name, "grouping"); -- --- Name: index_sponsors_on_agency_class; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_sponsors_on_agency_class; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_sponsors_on_agency_class ON ctgov.sponsors USING btree (agency_class); +CREATE INDEX index_sponsors_on_agency_class ON ctgov_v2.sponsors USING btree (agency_class); -- --- Name: index_sponsors_on_name; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_sponsors_on_name; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_sponsors_on_name ON ctgov.sponsors USING btree (name); +CREATE INDEX index_sponsors_on_name ON ctgov_v2.sponsors USING btree (name); -- --- Name: index_studies_on_completion_date; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_studies_on_completion_date; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_studies_on_completion_date ON ctgov.studies USING btree (completion_date); +CREATE INDEX index_studies_on_completion_date ON ctgov_v2.studies USING btree (completion_date); -- --- Name: index_studies_on_disposition_first_submitted_date; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_studies_on_disposition_first_submitted_date; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_studies_on_disposition_first_submitted_date ON ctgov.studies USING btree (disposition_first_submitted_date); +CREATE INDEX index_studies_on_disposition_first_submitted_date ON ctgov_v2.studies USING btree (disposition_first_submitted_date); -- --- Name: index_studies_on_enrollment_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_studies_on_enrollment_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_studies_on_enrollment_type ON ctgov.studies USING btree (enrollment_type); +CREATE INDEX index_studies_on_enrollment_type ON ctgov_v2.studies USING btree (enrollment_type); -- --- Name: index_studies_on_last_known_status; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_studies_on_last_known_status; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_studies_on_last_known_status ON ctgov.studies USING btree (last_known_status); +CREATE INDEX index_studies_on_last_known_status ON ctgov_v2.studies USING btree (last_known_status); -- --- Name: index_studies_on_last_update_submitted_date; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_studies_on_last_update_submitted_date; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_studies_on_last_update_submitted_date ON ctgov.studies USING btree (last_update_submitted_date); +CREATE INDEX index_studies_on_last_update_submitted_date ON ctgov_v2.studies USING btree (last_update_submitted_date); -- --- Name: index_studies_on_nct_id; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_studies_on_nct_id; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE UNIQUE INDEX index_studies_on_nct_id ON ctgov.studies USING btree (nct_id); +CREATE UNIQUE INDEX index_studies_on_nct_id ON ctgov_v2.studies USING btree (nct_id); -- --- Name: index_studies_on_overall_status; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_studies_on_overall_status; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_studies_on_overall_status ON ctgov.studies USING btree (overall_status); +CREATE INDEX index_studies_on_overall_status ON ctgov_v2.studies USING btree (overall_status); -- --- Name: index_studies_on_phase; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_studies_on_phase; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_studies_on_phase ON ctgov.studies USING btree (phase); +CREATE INDEX index_studies_on_phase ON ctgov_v2.studies USING btree (phase); -- --- Name: index_studies_on_primary_completion_date; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_studies_on_primary_completion_date; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_studies_on_primary_completion_date ON ctgov.studies USING btree (primary_completion_date); +CREATE INDEX index_studies_on_primary_completion_date ON ctgov_v2.studies USING btree (primary_completion_date); -- --- Name: index_studies_on_primary_completion_date_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_studies_on_primary_completion_date_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_studies_on_primary_completion_date_type ON ctgov.studies USING btree (primary_completion_date_type); +CREATE INDEX index_studies_on_primary_completion_date_type ON ctgov_v2.studies USING btree (primary_completion_date_type); -- --- Name: index_studies_on_results_first_submitted_date; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_studies_on_results_first_submitted_date; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_studies_on_results_first_submitted_date ON ctgov.studies USING btree (results_first_submitted_date); +CREATE INDEX index_studies_on_results_first_submitted_date ON ctgov_v2.studies USING btree (results_first_submitted_date); -- --- Name: index_studies_on_source; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_studies_on_source; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_studies_on_source ON ctgov.studies USING btree (source); +CREATE INDEX index_studies_on_source ON ctgov_v2.studies USING btree (source); -- --- Name: index_studies_on_start_date; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_studies_on_start_date; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_studies_on_start_date ON ctgov.studies USING btree (start_date); +CREATE INDEX index_studies_on_start_date ON ctgov_v2.studies USING btree (start_date); -- --- Name: index_studies_on_start_date_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_studies_on_start_date_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_studies_on_start_date_type ON ctgov.studies USING btree (start_date_type); +CREATE INDEX index_studies_on_start_date_type ON ctgov_v2.studies USING btree (start_date_type); -- --- Name: index_studies_on_study_first_submitted_date; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_studies_on_study_first_submitted_date; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_studies_on_study_first_submitted_date ON ctgov.studies USING btree (study_first_submitted_date); +CREATE INDEX index_studies_on_study_first_submitted_date ON ctgov_v2.studies USING btree (study_first_submitted_date); -- --- Name: index_studies_on_study_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_studies_on_study_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_studies_on_study_type ON ctgov.studies USING btree (study_type); +CREATE INDEX index_studies_on_study_type ON ctgov_v2.studies USING btree (study_type); -- --- Name: index_study_records_on_nct_id_and_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_study_records_on_nct_id_and_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE UNIQUE INDEX index_study_records_on_nct_id_and_type ON ctgov.study_records USING btree (nct_id, type); +CREATE UNIQUE INDEX index_study_records_on_nct_id_and_type ON ctgov_v2.study_records USING btree (nct_id, type); -- --- Name: index_study_references_on_reference_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_study_references_on_reference_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_study_references_on_reference_type ON ctgov.study_references USING btree (reference_type); +CREATE INDEX index_study_references_on_reference_type ON ctgov_v2.study_references USING btree (reference_type); -- --- Name: index_study_searches_on_query_and_grouping; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_study_searches_on_query_and_grouping; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE UNIQUE INDEX index_study_searches_on_query_and_grouping ON ctgov.study_searches USING btree (query, "grouping"); +CREATE UNIQUE INDEX index_study_searches_on_query_and_grouping ON ctgov_v2.study_searches USING btree (query, "grouping"); -- @@ -4522,6 +8211,13 @@ CREATE INDEX "index_support.study_xml_records_on_nct_id" ON support.study_xml_re CREATE TRIGGER category_insert_trigger INSTEAD OF INSERT ON ctgov.categories FOR EACH ROW EXECUTE FUNCTION ctgov.category_insert_function(); +-- +-- Name: categories category_insert_trigger; Type: TRIGGER; Schema: ctgov_v2; Owner: - +-- + +CREATE TRIGGER category_insert_trigger INSTEAD OF INSERT ON ctgov_v2.categories FOR EACH ROW EXECUTE FUNCTION ctgov_v2.category_insert_function(); + + -- -- Name: active_storage_attachments fk_rails_0276932754; Type: FK CONSTRAINT; Schema: support; Owner: - -- @@ -4558,7 +8254,7 @@ ALTER TABLE ONLY support.file_records -- PostgreSQL database dump complete -- -SET search_path TO ctgov,support,public; +SET search_path TO ctgov, support, public; INSERT INTO "schema_migrations" (version) VALUES ('20160630191037'), @@ -4620,6 +8316,7 @@ INSERT INTO "schema_migrations" (version) VALUES ('20240204045613'), ('20240204055613'), ('20240306012711'), -('20240324222521'); +('20240324222521'), +('20240425154619'); diff --git a/db/staging_structure.sql b/db/staging_structure.sql index 39b0e95b..09516d23 100644 --- a/db/staging_structure.sql +++ b/db/staging_structure.sql @@ -2096,7 +2096,10 @@ CREATE TABLE ctgov.outcome_measurements ( dispersion_upper_limit numeric, explanation_of_na text, dispersion_upper_limit_raw character varying, - dispersion_lower_limit_raw character varying + dispersion_lower_limit_raw character varying, + denom_units character varying, + denom_value double precision, + denom_value_raw double precision ); @@ -3128,7 +3131,7 @@ CREATE TABLE ctgov_v2.baseline_counts ( id integer NOT NULL, nct_id character varying, result_group_id integer, - ctgov_group_code character varying, + ctgov_v2_group_code character varying, units character varying, scope character varying, count integer @@ -3163,7 +3166,7 @@ CREATE TABLE ctgov_v2.baseline_measurements ( id integer NOT NULL, nct_id character varying, result_group_id integer, - ctgov_group_code character varying, + ctgov_v2_group_code character varying, classification character varying, category character varying, title character varying, @@ -3628,7 +3631,7 @@ CREATE TABLE ctgov_v2.drop_withdrawals ( id integer NOT NULL, nct_id character varying, result_group_id integer, - ctgov_group_code character varying, + ctgov_v2_group_code character varying, period character varying, reason character varying, count integer, @@ -4018,7 +4021,7 @@ CREATE TABLE ctgov_v2.milestones ( id integer NOT NULL, nct_id character varying, result_group_id integer, - ctgov_group_code character varying, + ctgov_v2_group_code character varying, title character varying, period character varying, description text, @@ -4110,7 +4113,7 @@ CREATE TABLE ctgov_v2.outcome_analysis_groups ( nct_id character varying, outcome_analysis_id integer, result_group_id integer, - ctgov_group_code character varying + ctgov_v2_group_code character varying ); @@ -4143,7 +4146,7 @@ CREATE TABLE ctgov_v2.outcome_counts ( nct_id character varying, outcome_id integer, result_group_id integer, - ctgov_group_code character varying, + ctgov_v2_group_code character varying, scope character varying, units character varying, count integer @@ -4179,7 +4182,7 @@ CREATE TABLE ctgov_v2.outcome_measurements ( nct_id character varying, outcome_id integer, result_group_id integer, - ctgov_group_code character varying, + ctgov_v2_group_code character varying, classification character varying, category character varying, title character varying, @@ -4389,7 +4392,7 @@ ALTER SEQUENCE ctgov_v2.provided_documents_id_seq OWNED BY ctgov_v2.provided_doc CREATE TABLE ctgov_v2.reported_event_totals ( id integer NOT NULL, nct_id character varying NOT NULL, - ctgov_group_code character varying NOT NULL, + ctgov_v2_group_code character varying NOT NULL, event_type character varying, classification character varying NOT NULL, subjects_affected integer, @@ -4427,7 +4430,7 @@ CREATE TABLE ctgov_v2.reported_events ( id integer NOT NULL, nct_id character varying, result_group_id integer, - ctgov_group_code character varying, + ctgov_v2_group_code character varying, time_frame text, event_type character varying, default_vocab character varying, @@ -4577,7 +4580,7 @@ ALTER SEQUENCE ctgov_v2.result_contacts_id_seq OWNED BY ctgov_v2.result_contacts CREATE TABLE ctgov_v2.result_groups ( id integer NOT NULL, nct_id character varying, - ctgov_group_code character varying, + ctgov_v2_group_code character varying, result_type character varying, title character varying, description text @@ -8313,6 +8316,7 @@ INSERT INTO "schema_migrations" (version) VALUES ('20240204045613'), ('20240204055613'), ('20240306012711'), -('20240324222521'); +('20240324222521'), +('20240425154619'); diff --git a/db/structure.sql b/db/structure.sql index fa1688c1..39b0e95b 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -17,17 +17,10 @@ CREATE SCHEMA ctgov; -- --- Name: public; Type: SCHEMA; Schema: -; Owner: - +-- Name: ctgov_v2; Type: SCHEMA; Schema: -; Owner: - -- -CREATE SCHEMA public; - - --- --- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: - --- - -COMMENT ON SCHEMA public IS 'standard public schema'; +CREATE SCHEMA ctgov_v2; -- @@ -264,6 +257,233 @@ CREATE FUNCTION ctgov.study_summaries_for_condition(character varying) RETURNS T $_$; +-- +-- Name: category_insert_function(); Type: FUNCTION; Schema: ctgov_v2; Owner: - +-- + +CREATE FUNCTION ctgov_v2.category_insert_function() RETURNS trigger + LANGUAGE plpgsql + AS $$ + BEGIN + INSERT INTO ctgov_v2.search_results (id, nct_id, name, created_at, updated_at, grouping, study_search_id) + + VALUES (NEW.id, NEW.nct_id, NEW.name, NEW.created_at, NEW.updated_at, NEW.grouping, NEW.study_search_id); + RETURN NEW; + END; + $$; + + +-- +-- Name: ids_for_org(character varying); Type: FUNCTION; Schema: ctgov_v2; Owner: - +-- + +CREATE FUNCTION ctgov_v2.ids_for_org(character varying) RETURNS TABLE(nct_id character varying) + LANGUAGE sql + AS $_$ + SELECT DISTINCT nct_id FROM responsible_parties WHERE lower(affiliation) like lower($1) + UNION + SELECT DISTINCT nct_id FROM facilities WHERE lower(name) like lower($1) or lower(city) like lower($1) or lower(state) like lower($1) or lower(country) like lower($1) + UNION + SELECT DISTINCT nct_id FROM sponsors WHERE lower(name) like lower($1) + UNION + SELECT DISTINCT nct_id FROM result_contacts WHERE lower(organization) like lower($1) + ; + $_$; + + +-- +-- Name: ids_for_term(character varying); Type: FUNCTION; Schema: ctgov_v2; Owner: - +-- + +CREATE FUNCTION ctgov_v2.ids_for_term(character varying) RETURNS TABLE(nct_id character varying) + LANGUAGE sql + AS $_$ + SELECT DISTINCT nct_id FROM browse_conditions WHERE downcase_mesh_term like lower($1) + UNION + SELECT DISTINCT nct_id FROM browse_interventions WHERE downcase_mesh_term like lower($1) + UNION + SELECT DISTINCT nct_id FROM studies WHERE lower(brief_title) like lower($1) + UNION + SELECT DISTINCT nct_id FROM keywords WHERE lower(name) like lower($1) + ; + $_$; + + +-- +-- Name: study_summaries_for_condition(character varying); Type: FUNCTION; Schema: ctgov_v2; Owner: - +-- + +CREATE FUNCTION ctgov_v2.study_summaries_for_condition(character varying) RETURNS TABLE(nct_id character varying, title text, recruitment character varying, were_results_reported boolean, conditions text, interventions text, gender character varying, age text, phase character varying, enrollment integer, study_type character varying, sponsors text, other_ids text, study_first_submitted_date date, start_date date, completion_month_year character varying, last_update_submitted_date date, verification_month_year character varying, results_first_submitted_date date, acronym character varying, primary_completion_month_year character varying, outcome_measures text, disposition_first_submitted_date date, allocation character varying, intervention_model character varying, observational_model character varying, primary_purpose character varying, time_perspective character varying, masking character varying, masking_description text, intervention_model_description text, subject_masked boolean, caregiver_masked boolean, investigator_masked boolean, outcomes_assessor_masked boolean, number_of_facilities integer) + LANGUAGE sql + AS $_$ + SELECT DISTINCT s.nct_id, + s.brief_title, + s.overall_status, + cv.were_results_reported, + bc.mesh_term, + i.names as interventions, + e.gender, + CASE + WHEN e.minimum_age = 'N/A' AND e.maximum_age = 'N/A' THEN 'No age restriction' + WHEN e.minimum_age != 'N/A' AND e.maximum_age = 'N/A' THEN concat(e.minimum_age, ' and older') + WHEN e.minimum_age = 'N/A' AND e.maximum_age != 'N/A' THEN concat('up to ', e.maximum_age) + ELSE concat(e.minimum_age, ' to ', e.maximum_age) + END, + CASE + WHEN s.phase='N/A' THEN NULL + ELSE s.phase + END, + s.enrollment, + s.study_type, + sp.names as sponsors, + id.names as id_values, + s.study_first_submitted_date, + s.start_date, + s.completion_month_year, + s.last_update_submitted_date, + s.verification_month_year, + s.results_first_submitted_date, + s.acronym, + s.primary_completion_month_year, + o.names as design_outcomes, + s.disposition_first_submitted_date, + d.allocation, + d.intervention_model, + d.observational_model, + d.primary_purpose, + d.time_perspective, + d.masking, + d.masking_description, + d.intervention_model_description, + d.subject_masked, + d.caregiver_masked, + d.investigator_masked, + d.outcomes_assessor_masked, + cv.number_of_facilities + FROM studies s + INNER JOIN browse_conditions bc ON s.nct_id = bc.nct_id and bc.downcase_mesh_term like lower($1) + LEFT OUTER JOIN calculated_values cv ON s.nct_id = cv.nct_id + LEFT OUTER JOIN all_conditions c ON s.nct_id = c.nct_id + LEFT OUTER JOIN all_interventions i ON s.nct_id = i.nct_id + LEFT OUTER JOIN all_sponsors sp ON s.nct_id = sp.nct_id + LEFT OUTER JOIN eligibilities e ON s.nct_id = e.nct_id + LEFT OUTER JOIN all_id_information id ON s.nct_id = id.nct_id + LEFT OUTER JOIN all_design_outcomes o ON s.nct_id = o.nct_id + LEFT OUTER JOIN designs d ON s.nct_id = d.nct_id + UNION + SELECT DISTINCT s.nct_id, + s.brief_title, + s.overall_status, + cv.were_results_reported, + bc.name, + i.names as interventions, + e.gender, + CASE + WHEN e.minimum_age = 'N/A' AND e.maximum_age = 'N/A' THEN 'No age restriction' + WHEN e.minimum_age != 'N/A' AND e.maximum_age = 'N/A' THEN concat(e.minimum_age, ' and older') + WHEN e.minimum_age = 'N/A' AND e.maximum_age != 'N/A' THEN concat('up to ', e.maximum_age) + ELSE concat(e.minimum_age, ' to ', e.maximum_age) + END, + CASE + WHEN s.phase='N/A' THEN NULL + ELSE s.phase + END, + s.enrollment, + s.study_type, + sp.names as sponsors, + id.names as id_values, + s.study_first_submitted_date, + s.start_date, + s.completion_month_year, + s.last_update_submitted_date, + s.verification_month_year, + s.results_first_submitted_date, + s.acronym, + s.primary_completion_month_year, + o.names as design_outcomes, + s.disposition_first_submitted_date, + d.allocation, + d.intervention_model, + d.observational_model, + d.primary_purpose, + d.time_perspective, + d.masking, + d.masking_description, + d.intervention_model_description, + d.subject_masked, + d.caregiver_masked, + d.investigator_masked, + d.outcomes_assessor_masked, + cv.number_of_facilities + FROM studies s + INNER JOIN conditions bc ON s.nct_id = bc.nct_id and bc.downcase_name like lower($1) + LEFT OUTER JOIN calculated_values cv ON s.nct_id = cv.nct_id + LEFT OUTER JOIN all_conditions c ON s.nct_id = c.nct_id + LEFT OUTER JOIN all_interventions i ON s.nct_id = i.nct_id + LEFT OUTER JOIN all_sponsors sp ON s.nct_id = sp.nct_id + LEFT OUTER JOIN eligibilities e ON s.nct_id = e.nct_id + LEFT OUTER JOIN all_id_information id ON s.nct_id = id.nct_id + LEFT OUTER JOIN all_design_outcomes o ON s.nct_id = o.nct_id + LEFT OUTER JOIN designs d ON s.nct_id = d.nct_id + UNION + SELECT DISTINCT s.nct_id, + s.brief_title, + s.overall_status, + cv.were_results_reported, + k.name, + i.names as interventions, + e.gender, + CASE + WHEN e.minimum_age = 'N/A' AND e.maximum_age = 'N/A' THEN 'No age restriction' + WHEN e.minimum_age != 'N/A' AND e.maximum_age = 'N/A' THEN concat(e.minimum_age, ' and older') + WHEN e.minimum_age = 'N/A' AND e.maximum_age != 'N/A' THEN concat('up to ', e.maximum_age) + ELSE concat(e.minimum_age, ' to ', e.maximum_age) + END, + CASE + WHEN s.phase='N/A' THEN NULL + ELSE s.phase + END, + s.enrollment, + s.study_type, + sp.names as sponsors, + id.names as id_values, + s.study_first_submitted_date, + s.start_date, + s.completion_month_year, + s.last_update_submitted_date, + s.verification_month_year, + s.results_first_submitted_date, + s.acronym, + s.primary_completion_month_year, + o.names as outcome_measures, + s.disposition_first_submitted_date, + d.allocation, + d.intervention_model, + d.observational_model, + d.primary_purpose, + d.time_perspective, + d.masking, + d.masking_description, + d.intervention_model_description, + d.subject_masked, + d.caregiver_masked, + d.investigator_masked, + d.outcomes_assessor_masked, + cv.number_of_facilities + FROM studies s + INNER JOIN keywords k ON s.nct_id = k.nct_id and k.downcase_name like lower($1) + LEFT OUTER JOIN calculated_values cv ON s.nct_id = cv.nct_id + LEFT OUTER JOIN all_conditions c ON s.nct_id = c.nct_id + LEFT OUTER JOIN all_interventions i ON s.nct_id = i.nct_id + LEFT OUTER JOIN all_sponsors sp ON s.nct_id = sp.nct_id + LEFT OUTER JOIN eligibilities e ON s.nct_id = e.nct_id + LEFT OUTER JOIN all_id_information id ON s.nct_id = id.nct_id + LEFT OUTER JOIN all_design_outcomes o ON s.nct_id = o.nct_id + LEFT OUTER JOIN designs d ON s.nct_id = d.nct_id + ; + $_$; + + -- -- Name: count_estimate(text); Type: FUNCTION; Schema: public; Owner: - -- @@ -1027,41 +1247,120 @@ CREATE TABLE ctgov.eligibilities ( -- --- Name: covid_19_studies; Type: VIEW; Schema: ctgov; Owner: - +-- Name: studies; Type: TABLE; Schema: ctgov_v2; Owner: - -- -CREATE VIEW ctgov.covid_19_studies AS - SELECT s.nct_id, - s.overall_status, - s.study_type, - s.official_title, - s.acronym, - s.phase, - s.why_stopped, - s.has_dmc, - s.enrollment, - s.is_fda_regulated_device, - s.is_fda_regulated_drug, - s.is_unapproved_device, - s.has_expanded_access, - s.study_first_submitted_date, - s.last_update_posted_date, - s.results_first_posted_date, - s.start_date, - s.primary_completion_date, - s.completion_date, - s.study_first_posted_date, - cv.number_of_facilities, - cv.has_single_facility, - cv.nlm_download_date, - s.number_of_arms, - s.number_of_groups, - sp.name AS lead_sponsor, - aid.names AS other_ids, - e.gender, - e.gender_based, - e.gender_description, - e.population, +CREATE TABLE ctgov_v2.studies ( + nct_id character varying, + nlm_download_date_description character varying, + study_first_submitted_date date, + results_first_submitted_date date, + disposition_first_submitted_date date, + last_update_submitted_date date, + study_first_submitted_qc_date date, + study_first_posted_date date, + study_first_posted_date_type character varying, + results_first_submitted_qc_date date, + results_first_posted_date date, + results_first_posted_date_type character varying, + disposition_first_submitted_qc_date date, + disposition_first_posted_date date, + disposition_first_posted_date_type character varying, + last_update_submitted_qc_date date, + last_update_posted_date date, + last_update_posted_date_type character varying, + start_month_year character varying, + start_date_type character varying, + start_date date, + verification_month_year character varying, + verification_date date, + completion_month_year character varying, + completion_date_type character varying, + completion_date date, + primary_completion_month_year character varying, + primary_completion_date_type character varying, + primary_completion_date date, + target_duration character varying, + study_type character varying, + acronym character varying, + baseline_population text, + brief_title text, + official_title text, + overall_status character varying, + last_known_status character varying, + phase character varying, + enrollment integer, + enrollment_type character varying, + source character varying, + limitations_and_caveats character varying, + number_of_arms integer, + number_of_groups integer, + why_stopped character varying, + has_expanded_access boolean, + expanded_access_type_individual boolean, + expanded_access_type_intermediate boolean, + expanded_access_type_treatment boolean, + has_dmc boolean, + is_fda_regulated_drug boolean, + is_fda_regulated_device boolean, + is_unapproved_device boolean, + is_ppsd boolean, + is_us_export boolean, + biospec_retention character varying, + biospec_description text, + ipd_time_frame character varying, + ipd_access_criteria character varying, + ipd_url character varying, + plan_to_share_ipd character varying, + plan_to_share_ipd_description character varying, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL, + source_class character varying, + delayed_posting boolean, + expanded_access_nctid character varying, + expanded_access_status_for_nctid character varying, + fdaaa801_violation boolean, + baseline_type_units_analyzed character varying, + patient_registry boolean +); + + +-- +-- Name: covid_19_studies; Type: VIEW; Schema: ctgov; Owner: - +-- + +CREATE VIEW ctgov.covid_19_studies AS + SELECT s.nct_id, + s.overall_status, + s.study_type, + s.official_title, + s.acronym, + s.phase, + s.why_stopped, + s.has_dmc, + s.enrollment, + s.is_fda_regulated_device, + s.is_fda_regulated_drug, + s.is_unapproved_device, + s.has_expanded_access, + s.study_first_submitted_date, + s.last_update_posted_date, + s.results_first_posted_date, + s.start_date, + s.primary_completion_date, + s.completion_date, + s.study_first_posted_date, + cv.number_of_facilities, + cv.has_single_facility, + cv.nlm_download_date, + s.number_of_arms, + s.number_of_groups, + sp.name AS lead_sponsor, + aid.names AS other_ids, + e.gender, + e.gender_based, + e.gender_description, + e.population, e.minimum_age, e.maximum_age, e.criteria, @@ -2461,224 +2760,387 @@ ALTER SEQUENCE ctgov.study_searches_id_seq OWNED BY ctgov.study_searches.id; -- --- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: - +-- Name: browse_conditions; Type: TABLE; Schema: ctgov_v2; Owner: - -- -CREATE TABLE public.ar_internal_metadata ( - key character varying NOT NULL, - value character varying, - created_at timestamp(6) without time zone NOT NULL, - updated_at timestamp(6) without time zone NOT NULL +CREATE TABLE ctgov_v2.browse_conditions ( + id integer NOT NULL, + nct_id character varying, + mesh_term character varying, + downcase_mesh_term character varying, + mesh_type character varying ); -- --- Name: schema_migrations; Type: TABLE; Schema: public; Owner: - +-- Name: all_browse_conditions; Type: VIEW; Schema: ctgov_v2; Owner: - -- -CREATE TABLE public.schema_migrations ( - version character varying NOT NULL -); +CREATE VIEW ctgov_v2.all_browse_conditions AS + SELECT browse_conditions.nct_id, + array_to_string(array_agg(DISTINCT browse_conditions.mesh_term), '|'::text) AS names + FROM ctgov_v2.browse_conditions + GROUP BY browse_conditions.nct_id; -- --- Name: active_storage_attachments; Type: TABLE; Schema: support; Owner: - +-- Name: browse_interventions; Type: TABLE; Schema: ctgov_v2; Owner: - -- -CREATE TABLE support.active_storage_attachments ( - id bigint NOT NULL, - name character varying NOT NULL, - record_type character varying NOT NULL, - record_id bigint NOT NULL, - blob_id bigint NOT NULL, - created_at timestamp without time zone NOT NULL +CREATE TABLE ctgov_v2.browse_interventions ( + id integer NOT NULL, + nct_id character varying, + mesh_term character varying, + downcase_mesh_term character varying, + mesh_type character varying ); -- --- Name: active_storage_attachments_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- Name: all_browse_interventions; Type: VIEW; Schema: ctgov_v2; Owner: - -- -CREATE SEQUENCE support.active_storage_attachments_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; +CREATE VIEW ctgov_v2.all_browse_interventions AS + SELECT browse_interventions.nct_id, + array_to_string(array_agg(browse_interventions.mesh_term), '|'::text) AS names + FROM ctgov_v2.browse_interventions + GROUP BY browse_interventions.nct_id; -- --- Name: active_storage_attachments_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- Name: facilities; Type: TABLE; Schema: ctgov_v2; Owner: - -- -ALTER SEQUENCE support.active_storage_attachments_id_seq OWNED BY support.active_storage_attachments.id; +CREATE TABLE ctgov_v2.facilities ( + id integer NOT NULL, + nct_id character varying, + status character varying, + name character varying, + city character varying, + state character varying, + zip character varying, + country character varying +); -- --- Name: active_storage_blobs; Type: TABLE; Schema: support; Owner: - +-- Name: all_cities; Type: VIEW; Schema: ctgov_v2; Owner: - -- -CREATE TABLE support.active_storage_blobs ( - id bigint NOT NULL, - key character varying NOT NULL, - filename character varying NOT NULL, - content_type character varying, - metadata text, - byte_size bigint NOT NULL, - checksum character varying NOT NULL, - created_at timestamp without time zone NOT NULL -); +CREATE VIEW ctgov_v2.all_cities AS + SELECT facilities.nct_id, + array_to_string(array_agg(DISTINCT facilities.city), '|'::text) AS names + FROM ctgov_v2.facilities + GROUP BY facilities.nct_id; -- --- Name: active_storage_blobs_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- Name: conditions; Type: TABLE; Schema: ctgov_v2; Owner: - -- -CREATE SEQUENCE support.active_storage_blobs_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; +CREATE TABLE ctgov_v2.conditions ( + id integer NOT NULL, + nct_id character varying, + name character varying, + downcase_name character varying +); -- --- Name: active_storage_blobs_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- Name: all_conditions; Type: VIEW; Schema: ctgov_v2; Owner: - -- -ALTER SEQUENCE support.active_storage_blobs_id_seq OWNED BY support.active_storage_blobs.id; +CREATE VIEW ctgov_v2.all_conditions AS + SELECT conditions.nct_id, + array_to_string(array_agg(DISTINCT conditions.name), '|'::text) AS names + FROM ctgov_v2.conditions + GROUP BY conditions.nct_id; -- --- Name: background_jobs; Type: TABLE; Schema: support; Owner: - +-- Name: countries; Type: TABLE; Schema: ctgov_v2; Owner: - -- -CREATE TABLE support.background_jobs ( - id bigint NOT NULL, - user_id integer, - status character varying, - completed_at timestamp without time zone, - logs character varying, - type character varying, - data json, - url character varying, - created_at timestamp(6) without time zone NOT NULL, - updated_at timestamp(6) without time zone NOT NULL, - user_error_message character varying +CREATE TABLE ctgov_v2.countries ( + id integer NOT NULL, + nct_id character varying, + name character varying, + removed boolean ); -- --- Name: background_jobs_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- Name: all_countries; Type: VIEW; Schema: ctgov_v2; Owner: - -- -CREATE SEQUENCE support.background_jobs_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; +CREATE VIEW ctgov_v2.all_countries AS + SELECT countries.nct_id, + array_to_string(array_agg(DISTINCT countries.name), '|'::text) AS names + FROM ctgov_v2.countries + WHERE (countries.removed IS NOT TRUE) + GROUP BY countries.nct_id; -- --- Name: background_jobs_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- Name: design_outcomes; Type: TABLE; Schema: ctgov_v2; Owner: - -- -ALTER SEQUENCE support.background_jobs_id_seq OWNED BY support.background_jobs.id; +CREATE TABLE ctgov_v2.design_outcomes ( + id integer NOT NULL, + nct_id character varying, + outcome_type character varying, + measure text, + time_frame text, + population character varying, + description text +); -- --- Name: file_records; Type: TABLE; Schema: support; Owner: - +-- Name: all_design_outcomes; Type: VIEW; Schema: ctgov_v2; Owner: - -- -CREATE TABLE support.file_records ( - id bigint NOT NULL, - filename character varying, - file_size bigint, - file_type character varying, - created_at timestamp(6) without time zone NOT NULL, - updated_at timestamp(6) without time zone NOT NULL, - url character varying, - load_event_id bigint -); +CREATE VIEW ctgov_v2.all_design_outcomes AS + SELECT design_outcomes.nct_id, + array_to_string(array_agg(DISTINCT design_outcomes.measure), '|'::text) AS names + FROM ctgov_v2.design_outcomes + GROUP BY design_outcomes.nct_id; -- --- Name: file_records_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- Name: all_facilities; Type: VIEW; Schema: ctgov_v2; Owner: - -- -CREATE SEQUENCE support.file_records_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; +CREATE VIEW ctgov_v2.all_facilities AS + SELECT facilities.nct_id, + array_to_string(array_agg(facilities.name), '|'::text) AS names + FROM ctgov_v2.facilities + GROUP BY facilities.nct_id; -- --- Name: file_records_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- Name: design_groups; Type: TABLE; Schema: ctgov_v2; Owner: - -- -ALTER SEQUENCE support.file_records_id_seq OWNED BY support.file_records.id; - - +CREATE TABLE ctgov_v2.design_groups ( + id integer NOT NULL, + nct_id character varying, + group_type character varying, + title character varying, + description text +); + + -- --- Name: load_events; Type: TABLE; Schema: support; Owner: - +-- Name: all_group_types; Type: VIEW; Schema: ctgov_v2; Owner: - -- -CREATE TABLE support.load_events ( +CREATE VIEW ctgov_v2.all_group_types AS + SELECT design_groups.nct_id, + array_to_string(array_agg(DISTINCT design_groups.group_type), '|'::text) AS names + FROM ctgov_v2.design_groups + GROUP BY design_groups.nct_id; + + +-- +-- Name: id_information; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.id_information ( id integer NOT NULL, - event_type character varying, - status character varying, - description text, - problems text, - should_add integer, - should_change integer, - processed integer, - load_time character varying, - completed_at timestamp without time zone, - created_at timestamp without time zone NOT NULL, - updated_at timestamp without time zone NOT NULL + nct_id character varying, + id_source character varying, + id_value character varying, + id_type character varying, + id_type_description character varying, + id_link character varying ); -- --- Name: load_events_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- Name: all_id_information; Type: VIEW; Schema: ctgov_v2; Owner: - -- -CREATE SEQUENCE support.load_events_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; +CREATE VIEW ctgov_v2.all_id_information AS + SELECT id_information.nct_id, + array_to_string(array_agg(DISTINCT id_information.id_value), '|'::text) AS names + FROM ctgov_v2.id_information + GROUP BY id_information.nct_id; -- --- Name: load_events_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- Name: interventions; Type: TABLE; Schema: ctgov_v2; Owner: - -- -ALTER SEQUENCE support.load_events_id_seq OWNED BY support.load_events.id; +CREATE TABLE ctgov_v2.interventions ( + id integer NOT NULL, + nct_id character varying, + intervention_type character varying, + name character varying, + description text +); -- --- Name: load_issues; Type: TABLE; Schema: support; Owner: - +-- Name: all_intervention_types; Type: VIEW; Schema: ctgov_v2; Owner: - -- -CREATE TABLE support.load_issues ( - id bigint NOT NULL, - load_event_id bigint, +CREATE VIEW ctgov_v2.all_intervention_types AS + SELECT interventions.nct_id, + array_to_string(array_agg(interventions.intervention_type), '|'::text) AS names + FROM ctgov_v2.interventions + GROUP BY interventions.nct_id; + + +-- +-- Name: all_interventions; Type: VIEW; Schema: ctgov_v2; Owner: - +-- + +CREATE VIEW ctgov_v2.all_interventions AS + SELECT interventions.nct_id, + array_to_string(array_agg(interventions.name), '|'::text) AS names + FROM ctgov_v2.interventions + GROUP BY interventions.nct_id; + + +-- +-- Name: keywords; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.keywords ( + id integer NOT NULL, nct_id character varying, - message character varying + name character varying, + downcase_name character varying ); -- --- Name: load_issues_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- Name: all_keywords; Type: VIEW; Schema: ctgov_v2; Owner: - -- -CREATE SEQUENCE support.load_issues_id_seq +CREATE VIEW ctgov_v2.all_keywords AS + SELECT keywords.nct_id, + array_to_string(array_agg(DISTINCT keywords.name), '|'::text) AS names + FROM ctgov_v2.keywords + GROUP BY keywords.nct_id; + + +-- +-- Name: overall_officials; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.overall_officials ( + id integer NOT NULL, + nct_id character varying, + role character varying, + name character varying, + affiliation character varying +); + + +-- +-- Name: all_overall_official_affiliations; Type: VIEW; Schema: ctgov_v2; Owner: - +-- + +CREATE VIEW ctgov_v2.all_overall_official_affiliations AS + SELECT overall_officials.nct_id, + array_to_string(array_agg(overall_officials.affiliation), '|'::text) AS names + FROM ctgov_v2.overall_officials + GROUP BY overall_officials.nct_id; + + +-- +-- Name: all_overall_officials; Type: VIEW; Schema: ctgov_v2; Owner: - +-- + +CREATE VIEW ctgov_v2.all_overall_officials AS + SELECT overall_officials.nct_id, + array_to_string(array_agg(overall_officials.name), '|'::text) AS names + FROM ctgov_v2.overall_officials + GROUP BY overall_officials.nct_id; + + +-- +-- Name: all_primary_outcome_measures; Type: VIEW; Schema: ctgov_v2; Owner: - +-- + +CREATE VIEW ctgov_v2.all_primary_outcome_measures AS + SELECT design_outcomes.nct_id, + array_to_string(array_agg(DISTINCT design_outcomes.measure), '|'::text) AS names + FROM ctgov_v2.design_outcomes + WHERE ((design_outcomes.outcome_type)::text = 'primary'::text) + GROUP BY design_outcomes.nct_id; + + +-- +-- Name: all_secondary_outcome_measures; Type: VIEW; Schema: ctgov_v2; Owner: - +-- + +CREATE VIEW ctgov_v2.all_secondary_outcome_measures AS + SELECT design_outcomes.nct_id, + array_to_string(array_agg(DISTINCT design_outcomes.measure), '|'::text) AS names + FROM ctgov_v2.design_outcomes + WHERE ((design_outcomes.outcome_type)::text = 'secondary'::text) + GROUP BY design_outcomes.nct_id; + + +-- +-- Name: sponsors; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.sponsors ( + id integer NOT NULL, + nct_id character varying, + agency_class character varying, + lead_or_collaborator character varying, + name character varying +); + + +-- +-- Name: all_sponsors; Type: VIEW; Schema: ctgov_v2; Owner: - +-- + +CREATE VIEW ctgov_v2.all_sponsors AS + SELECT sponsors.nct_id, + array_to_string(array_agg(DISTINCT sponsors.name), '|'::text) AS names + FROM ctgov_v2.sponsors + GROUP BY sponsors.nct_id; + + +-- +-- Name: all_states; Type: VIEW; Schema: ctgov_v2; Owner: - +-- + +CREATE VIEW ctgov_v2.all_states AS + SELECT facilities.nct_id, + array_to_string(array_agg(DISTINCT facilities.state), '|'::text) AS names + FROM ctgov_v2.facilities + GROUP BY facilities.nct_id; + + +-- +-- Name: baseline_counts; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.baseline_counts ( + id integer NOT NULL, + nct_id character varying, + result_group_id integer, + ctgov_group_code character varying, + units character varying, + scope character varying, + count integer +); + + +-- +-- Name: baseline_counts_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.baseline_counts_id_seq + AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -2687,36 +3149,47 @@ CREATE SEQUENCE support.load_issues_id_seq -- --- Name: load_issues_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- Name: baseline_counts_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - -- -ALTER SEQUENCE support.load_issues_id_seq OWNED BY support.load_issues.id; +ALTER SEQUENCE ctgov_v2.baseline_counts_id_seq OWNED BY ctgov_v2.baseline_counts.id; -- --- Name: sanity_checks; Type: TABLE; Schema: support; Owner: - +-- Name: baseline_measurements; Type: TABLE; Schema: ctgov_v2; Owner: - -- -CREATE TABLE support.sanity_checks ( +CREATE TABLE ctgov_v2.baseline_measurements ( id integer NOT NULL, - table_name character varying, nct_id character varying, - column_name character varying, - check_type character varying, - row_count integer, + result_group_id integer, + ctgov_group_code character varying, + classification character varying, + category character varying, + title character varying, description text, - most_current boolean, - created_at timestamp without time zone NOT NULL, - updated_at timestamp without time zone NOT NULL, - load_event_id bigint + units character varying, + param_type character varying, + param_value character varying, + param_value_num numeric, + dispersion_type character varying, + dispersion_value character varying, + dispersion_value_num numeric, + dispersion_lower_limit numeric, + dispersion_upper_limit numeric, + explanation_of_na character varying, + number_analyzed integer, + number_analyzed_units character varying, + population_description character varying, + calculate_percentage character varying ); -- --- Name: sanity_checks_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- Name: baseline_measurements_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - -- -CREATE SEQUENCE support.sanity_checks_id_seq +CREATE SEQUENCE ctgov_v2.baseline_measurements_id_seq AS integer START WITH 1 INCREMENT BY 1 @@ -2726,33 +3199,28 @@ CREATE SEQUENCE support.sanity_checks_id_seq -- --- Name: sanity_checks_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- Name: baseline_measurements_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - -- -ALTER SEQUENCE support.sanity_checks_id_seq OWNED BY support.sanity_checks.id; +ALTER SEQUENCE ctgov_v2.baseline_measurements_id_seq OWNED BY ctgov_v2.baseline_measurements.id; -- --- Name: study_json_records; Type: TABLE; Schema: support; Owner: - +-- Name: brief_summaries; Type: TABLE; Schema: ctgov_v2; Owner: - -- -CREATE TABLE support.study_json_records ( +CREATE TABLE ctgov_v2.brief_summaries ( id integer NOT NULL, - nct_id character varying NOT NULL, - content jsonb NOT NULL, - saved_study_at timestamp without time zone, - created_at timestamp without time zone NOT NULL, - updated_at timestamp without time zone NOT NULL, - download_date character varying, - version character varying DEFAULT '1'::character varying + nct_id character varying, + description text ); -- --- Name: study_json_records_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- Name: brief_summaries_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - -- -CREATE SEQUENCE support.study_json_records_id_seq +CREATE SEQUENCE ctgov_v2.brief_summaries_id_seq AS integer START WITH 1 INCREMENT BY 1 @@ -2762,32 +3230,38 @@ CREATE SEQUENCE support.study_json_records_id_seq -- --- Name: study_json_records_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- Name: brief_summaries_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - -- -ALTER SEQUENCE support.study_json_records_id_seq OWNED BY support.study_json_records.id; +ALTER SEQUENCE ctgov_v2.brief_summaries_id_seq OWNED BY ctgov_v2.brief_summaries.id; -- --- Name: study_statistics_comparisons; Type: TABLE; Schema: support; Owner: - +-- Name: browse_conditions_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - -- -CREATE TABLE support.study_statistics_comparisons ( - id bigint NOT NULL, - ctgov_selector character varying, - "table" character varying, - "column" character varying, - condition character varying, - instances_query character varying, - unique_query character varying -); +CREATE SEQUENCE ctgov_v2.browse_conditions_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; -- --- Name: study_statistics_comparisons_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- Name: browse_conditions_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - -- -CREATE SEQUENCE support.study_statistics_comparisons_id_seq +ALTER SEQUENCE ctgov_v2.browse_conditions_id_seq OWNED BY ctgov_v2.browse_conditions.id; + + +-- +-- Name: browse_interventions_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.browse_interventions_id_seq + AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -2796,1625 +3270,4837 @@ CREATE SEQUENCE support.study_statistics_comparisons_id_seq -- --- Name: study_statistics_comparisons_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- Name: browse_interventions_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - -- -ALTER SEQUENCE support.study_statistics_comparisons_id_seq OWNED BY support.study_statistics_comparisons.id; +ALTER SEQUENCE ctgov_v2.browse_interventions_id_seq OWNED BY ctgov_v2.browse_interventions.id; -- --- Name: study_xml_records; Type: TABLE; Schema: support; Owner: - +-- Name: calculated_values; Type: TABLE; Schema: ctgov_v2; Owner: - -- -CREATE TABLE support.study_xml_records ( +CREATE TABLE ctgov_v2.calculated_values ( id integer NOT NULL, nct_id character varying, - content xml, - created_study_at timestamp without time zone, - created_at timestamp without time zone NOT NULL, - updated_at timestamp without time zone NOT NULL + number_of_facilities integer, + number_of_nsae_subjects integer, + number_of_sae_subjects integer, + registered_in_calendar_year integer, + nlm_download_date date, + actual_duration integer, + were_results_reported boolean DEFAULT false, + months_to_report_results integer, + has_us_facility boolean, + has_single_facility boolean DEFAULT false, + minimum_age_num integer, + maximum_age_num integer, + minimum_age_unit character varying, + maximum_age_unit character varying, + number_of_primary_outcomes_to_measure integer, + number_of_secondary_outcomes_to_measure integer, + number_of_other_outcomes_to_measure integer +); + + +-- +-- Name: calculated_values_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.calculated_values_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: calculated_values_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.calculated_values_id_seq OWNED BY ctgov_v2.calculated_values.id; + + +-- +-- Name: search_results; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.search_results ( + id integer NOT NULL, + nct_id character varying NOT NULL, + name character varying NOT NULL, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL, + "grouping" character varying DEFAULT ''::character varying NOT NULL, + study_search_id integer +); + + +-- +-- Name: categories; Type: VIEW; Schema: ctgov_v2; Owner: - +-- + +CREATE VIEW ctgov_v2.categories AS + SELECT search_results.id, + search_results.nct_id, + search_results.name, + search_results.created_at, + search_results.updated_at, + search_results."grouping", + search_results.study_search_id + FROM ctgov_v2.search_results; + + +-- +-- Name: categories_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.categories_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: central_contacts; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.central_contacts ( + id integer NOT NULL, + nct_id character varying, + contact_type character varying, + name character varying, + phone character varying, + email character varying, + phone_extension character varying, + role character varying +); + + +-- +-- Name: central_contacts_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.central_contacts_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: central_contacts_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.central_contacts_id_seq OWNED BY ctgov_v2.central_contacts.id; + + +-- +-- Name: conditions_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.conditions_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: conditions_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.conditions_id_seq OWNED BY ctgov_v2.conditions.id; + + +-- +-- Name: countries_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.countries_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: countries_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.countries_id_seq OWNED BY ctgov_v2.countries.id; + + +-- +-- Name: design_group_interventions; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.design_group_interventions ( + id integer NOT NULL, + nct_id character varying, + design_group_id integer, + intervention_id integer +); + + +-- +-- Name: design_group_interventions_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.design_group_interventions_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: design_group_interventions_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.design_group_interventions_id_seq OWNED BY ctgov_v2.design_group_interventions.id; + + +-- +-- Name: design_groups_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.design_groups_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: design_groups_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.design_groups_id_seq OWNED BY ctgov_v2.design_groups.id; + + +-- +-- Name: design_outcomes_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.design_outcomes_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: design_outcomes_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.design_outcomes_id_seq OWNED BY ctgov_v2.design_outcomes.id; + + +-- +-- Name: designs; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.designs ( + id integer NOT NULL, + nct_id character varying, + allocation character varying, + intervention_model character varying, + observational_model character varying, + primary_purpose character varying, + time_perspective character varying, + masking character varying, + masking_description text, + intervention_model_description text, + subject_masked boolean, + caregiver_masked boolean, + investigator_masked boolean, + outcomes_assessor_masked boolean +); + + +-- +-- Name: designs_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.designs_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: designs_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.designs_id_seq OWNED BY ctgov_v2.designs.id; + + +-- +-- Name: detailed_descriptions; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.detailed_descriptions ( + id integer NOT NULL, + nct_id character varying, + description text ); -- --- Name: study_xml_records_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- Name: detailed_descriptions_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.detailed_descriptions_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: detailed_descriptions_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.detailed_descriptions_id_seq OWNED BY ctgov_v2.detailed_descriptions.id; + + +-- +-- Name: documents; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.documents ( + id integer NOT NULL, + nct_id character varying, + document_id character varying, + document_type character varying, + url character varying, + comment text +); + + +-- +-- Name: documents_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.documents_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: documents_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.documents_id_seq OWNED BY ctgov_v2.documents.id; + + +-- +-- Name: drop_withdrawals; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.drop_withdrawals ( + id integer NOT NULL, + nct_id character varying, + result_group_id integer, + ctgov_group_code character varying, + period character varying, + reason character varying, + count integer, + drop_withdraw_comment character varying, + reason_comment character varying, + count_units integer +); + + +-- +-- Name: drop_withdrawals_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.drop_withdrawals_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: drop_withdrawals_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.drop_withdrawals_id_seq OWNED BY ctgov_v2.drop_withdrawals.id; + + +-- +-- Name: eligibilities; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.eligibilities ( + id integer NOT NULL, + nct_id character varying, + sampling_method character varying, + gender character varying, + minimum_age character varying, + maximum_age character varying, + healthy_volunteers boolean, + population text, + criteria text, + gender_description text, + gender_based boolean, + adult boolean, + child boolean, + older_adult boolean +); + + +-- +-- Name: eligibilities_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.eligibilities_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: eligibilities_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.eligibilities_id_seq OWNED BY ctgov_v2.eligibilities.id; + + +-- +-- Name: facilities_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.facilities_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: facilities_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.facilities_id_seq OWNED BY ctgov_v2.facilities.id; + + +-- +-- Name: facility_contacts; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.facility_contacts ( + id integer NOT NULL, + nct_id character varying, + facility_id integer, + contact_type character varying, + name character varying, + email character varying, + phone character varying, + phone_extension character varying +); + + +-- +-- Name: facility_contacts_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.facility_contacts_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: facility_contacts_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.facility_contacts_id_seq OWNED BY ctgov_v2.facility_contacts.id; + + +-- +-- Name: facility_investigators; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.facility_investigators ( + id integer NOT NULL, + nct_id character varying, + facility_id integer, + role character varying, + name character varying +); + + +-- +-- Name: facility_investigators_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.facility_investigators_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: facility_investigators_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.facility_investigators_id_seq OWNED BY ctgov_v2.facility_investigators.id; + + +-- +-- Name: id_information_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.id_information_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: id_information_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.id_information_id_seq OWNED BY ctgov_v2.id_information.id; + + +-- +-- Name: intervention_other_names; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.intervention_other_names ( + id integer NOT NULL, + nct_id character varying, + intervention_id integer, + name character varying +); + + +-- +-- Name: intervention_other_names_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.intervention_other_names_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: intervention_other_names_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.intervention_other_names_id_seq OWNED BY ctgov_v2.intervention_other_names.id; + + +-- +-- Name: interventions_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.interventions_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: interventions_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.interventions_id_seq OWNED BY ctgov_v2.interventions.id; + + +-- +-- Name: ipd_information_types; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.ipd_information_types ( + id integer NOT NULL, + nct_id character varying, + name character varying +); + + +-- +-- Name: ipd_information_types_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.ipd_information_types_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: ipd_information_types_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.ipd_information_types_id_seq OWNED BY ctgov_v2.ipd_information_types.id; + + +-- +-- Name: keywords_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.keywords_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: keywords_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.keywords_id_seq OWNED BY ctgov_v2.keywords.id; + + +-- +-- Name: links; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.links ( + id integer NOT NULL, + nct_id character varying, + url character varying, + description text +); + + +-- +-- Name: links_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.links_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: links_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.links_id_seq OWNED BY ctgov_v2.links.id; + + +-- +-- Name: mesh_headings; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.mesh_headings ( + id integer NOT NULL, + qualifier character varying, + heading character varying, + subcategory character varying +); + + +-- +-- Name: mesh_headings_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.mesh_headings_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: mesh_headings_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.mesh_headings_id_seq OWNED BY ctgov_v2.mesh_headings.id; + + +-- +-- Name: mesh_terms; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.mesh_terms ( + id integer NOT NULL, + qualifier character varying, + tree_number character varying, + description character varying, + mesh_term character varying, + downcase_mesh_term character varying +); + + +-- +-- Name: mesh_terms_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.mesh_terms_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: mesh_terms_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.mesh_terms_id_seq OWNED BY ctgov_v2.mesh_terms.id; + + +-- +-- Name: milestones; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.milestones ( + id integer NOT NULL, + nct_id character varying, + result_group_id integer, + ctgov_group_code character varying, + title character varying, + period character varying, + description text, + count integer, + milestone_description character varying, + count_units character varying +); + + +-- +-- Name: milestones_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.milestones_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: milestones_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.milestones_id_seq OWNED BY ctgov_v2.milestones.id; + + +-- +-- Name: outcome_analyses; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.outcome_analyses ( + id integer NOT NULL, + nct_id character varying, + outcome_id integer, + non_inferiority_type character varying, + non_inferiority_description text, + param_type character varying, + param_value numeric, + dispersion_type character varying, + dispersion_value numeric, + p_value_modifier character varying, + p_value double precision, + ci_n_sides character varying, + ci_percent numeric, + ci_lower_limit numeric, + ci_upper_limit numeric, + ci_upper_limit_na_comment character varying, + p_value_description character varying, + method character varying, + method_description text, + estimate_description text, + groups_description text, + other_analysis_description text, + ci_upper_limit_raw character varying, + ci_lower_limit_raw character varying, + p_value_raw character varying +); + + +-- +-- Name: outcome_analyses_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.outcome_analyses_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: outcome_analyses_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.outcome_analyses_id_seq OWNED BY ctgov_v2.outcome_analyses.id; + + +-- +-- Name: outcome_analysis_groups; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.outcome_analysis_groups ( + id integer NOT NULL, + nct_id character varying, + outcome_analysis_id integer, + result_group_id integer, + ctgov_group_code character varying +); + + +-- +-- Name: outcome_analysis_groups_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.outcome_analysis_groups_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: outcome_analysis_groups_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.outcome_analysis_groups_id_seq OWNED BY ctgov_v2.outcome_analysis_groups.id; + + +-- +-- Name: outcome_counts; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.outcome_counts ( + id integer NOT NULL, + nct_id character varying, + outcome_id integer, + result_group_id integer, + ctgov_group_code character varying, + scope character varying, + units character varying, + count integer +); + + +-- +-- Name: outcome_counts_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.outcome_counts_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: outcome_counts_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.outcome_counts_id_seq OWNED BY ctgov_v2.outcome_counts.id; + + +-- +-- Name: outcome_measurements; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.outcome_measurements ( + id integer NOT NULL, + nct_id character varying, + outcome_id integer, + result_group_id integer, + ctgov_group_code character varying, + classification character varying, + category character varying, + title character varying, + description text, + units character varying, + param_type character varying, + param_value character varying, + param_value_num numeric, + dispersion_type character varying, + dispersion_value character varying, + dispersion_value_num numeric, + dispersion_lower_limit numeric, + dispersion_upper_limit numeric, + explanation_of_na text, + dispersion_upper_limit_raw character varying, + dispersion_lower_limit_raw character varying +); + + +-- +-- Name: outcome_measurements_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.outcome_measurements_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: outcome_measurements_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.outcome_measurements_id_seq OWNED BY ctgov_v2.outcome_measurements.id; + + +-- +-- Name: outcomes; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.outcomes ( + id integer NOT NULL, + nct_id character varying, + outcome_type character varying, + title text, + description text, + time_frame text, + population text, + anticipated_posting_date date, + anticipated_posting_month_year character varying, + units character varying, + units_analyzed character varying, + dispersion_type character varying, + param_type character varying +); + + +-- +-- Name: outcomes_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.outcomes_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: outcomes_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.outcomes_id_seq OWNED BY ctgov_v2.outcomes.id; + + +-- +-- Name: overall_officials_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.overall_officials_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: overall_officials_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.overall_officials_id_seq OWNED BY ctgov_v2.overall_officials.id; + + +-- +-- Name: participant_flows; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.participant_flows ( + id integer NOT NULL, + nct_id character varying, + recruitment_details text, + pre_assignment_details text, + units_analyzed character varying +); + + +-- +-- Name: participant_flows_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.participant_flows_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: participant_flows_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.participant_flows_id_seq OWNED BY ctgov_v2.participant_flows.id; + + +-- +-- Name: pending_results; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.pending_results ( + id integer NOT NULL, + nct_id character varying, + event character varying, + event_date_description character varying, + event_date date +); + + +-- +-- Name: pending_results_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.pending_results_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: pending_results_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.pending_results_id_seq OWNED BY ctgov_v2.pending_results.id; + + +-- +-- Name: provided_documents; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.provided_documents ( + id integer NOT NULL, + nct_id character varying, + document_type character varying, + has_protocol boolean, + has_icf boolean, + has_sap boolean, + document_date date, + url character varying +); + + +-- +-- Name: provided_documents_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.provided_documents_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: provided_documents_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.provided_documents_id_seq OWNED BY ctgov_v2.provided_documents.id; + + +-- +-- Name: reported_event_totals; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.reported_event_totals ( + id integer NOT NULL, + nct_id character varying NOT NULL, + ctgov_group_code character varying NOT NULL, + event_type character varying, + classification character varying NOT NULL, + subjects_affected integer, + subjects_at_risk integer, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL +); + + +-- +-- Name: reported_event_totals_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.reported_event_totals_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: reported_event_totals_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.reported_event_totals_id_seq OWNED BY ctgov_v2.reported_event_totals.id; + + +-- +-- Name: reported_events; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.reported_events ( + id integer NOT NULL, + nct_id character varying, + result_group_id integer, + ctgov_group_code character varying, + time_frame text, + event_type character varying, + default_vocab character varying, + default_assessment character varying, + subjects_affected integer, + subjects_at_risk integer, + description text, + event_count integer, + organ_system character varying, + adverse_event_term character varying, + frequency_threshold integer, + vocab character varying, + assessment character varying +); + + +-- +-- Name: reported_events_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.reported_events_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: reported_events_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.reported_events_id_seq OWNED BY ctgov_v2.reported_events.id; + + +-- +-- Name: responsible_parties; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.responsible_parties ( + id integer NOT NULL, + nct_id character varying, + responsible_party_type character varying, + name character varying, + title character varying, + organization character varying, + affiliation text, + old_name_title character varying +); + + +-- +-- Name: responsible_parties_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.responsible_parties_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: responsible_parties_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.responsible_parties_id_seq OWNED BY ctgov_v2.responsible_parties.id; + + +-- +-- Name: result_agreements; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.result_agreements ( + id integer NOT NULL, + nct_id character varying, + pi_employee boolean, + agreement text, + restriction_type character varying, + other_details text, + restrictive_agreement boolean +); + + +-- +-- Name: result_agreements_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.result_agreements_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: result_agreements_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.result_agreements_id_seq OWNED BY ctgov_v2.result_agreements.id; + + +-- +-- Name: result_contacts; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.result_contacts ( + id integer NOT NULL, + nct_id character varying, + organization character varying, + name character varying, + phone character varying, + email character varying, + extension character varying +); + + +-- +-- Name: result_contacts_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.result_contacts_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: result_contacts_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.result_contacts_id_seq OWNED BY ctgov_v2.result_contacts.id; + + +-- +-- Name: result_groups; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.result_groups ( + id integer NOT NULL, + nct_id character varying, + ctgov_group_code character varying, + result_type character varying, + title character varying, + description text +); + + +-- +-- Name: result_groups_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.result_groups_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: result_groups_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.result_groups_id_seq OWNED BY ctgov_v2.result_groups.id; + + +-- +-- Name: retractions; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.retractions ( + id bigint NOT NULL, + reference_id integer, + pmid character varying, + source character varying, + nct_id character varying +); + + +-- +-- Name: retractions_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.retractions_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: retractions_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.retractions_id_seq OWNED BY ctgov_v2.retractions.id; + + +-- +-- Name: search_results_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.search_results_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: search_results_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.search_results_id_seq OWNED BY ctgov_v2.search_results.id; + + +-- +-- Name: sponsors_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.sponsors_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: sponsors_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.sponsors_id_seq OWNED BY ctgov_v2.sponsors.id; + + +-- +-- Name: study_records; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.study_records ( + id bigint NOT NULL, + nct_id character varying, + type character varying, + content json, + sha character varying, + created_at timestamp(6) without time zone NOT NULL, + updated_at timestamp(6) without time zone NOT NULL +); + + +-- +-- Name: study_records_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.study_records_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: study_records_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.study_records_id_seq OWNED BY ctgov_v2.study_records.id; + + +-- +-- Name: study_references; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.study_references ( + id integer NOT NULL, + nct_id character varying, + pmid character varying, + reference_type character varying, + citation text +); + + +-- +-- Name: study_references_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.study_references_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: study_references_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.study_references_id_seq OWNED BY ctgov_v2.study_references.id; + + +-- +-- Name: study_searches; Type: TABLE; Schema: ctgov_v2; Owner: - +-- + +CREATE TABLE ctgov_v2.study_searches ( + id integer NOT NULL, + save_tsv boolean DEFAULT false NOT NULL, + query character varying NOT NULL, + "grouping" character varying DEFAULT ''::character varying NOT NULL, + name character varying DEFAULT ''::character varying NOT NULL, + beta_api boolean DEFAULT false NOT NULL, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL, + active boolean +); + + +-- +-- Name: study_searches_id_seq; Type: SEQUENCE; Schema: ctgov_v2; Owner: - +-- + +CREATE SEQUENCE ctgov_v2.study_searches_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: study_searches_id_seq; Type: SEQUENCE OWNED BY; Schema: ctgov_v2; Owner: - +-- + +ALTER SEQUENCE ctgov_v2.study_searches_id_seq OWNED BY ctgov_v2.study_searches.id; + + +-- +-- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.ar_internal_metadata ( + key character varying NOT NULL, + value character varying, + created_at timestamp(6) without time zone NOT NULL, + updated_at timestamp(6) without time zone NOT NULL +); + + +-- +-- Name: schema_migrations; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.schema_migrations ( + version character varying NOT NULL +); + + +-- +-- Name: active_storage_attachments; Type: TABLE; Schema: support; Owner: - +-- + +CREATE TABLE support.active_storage_attachments ( + id bigint NOT NULL, + name character varying NOT NULL, + record_type character varying NOT NULL, + record_id bigint NOT NULL, + blob_id bigint NOT NULL, + created_at timestamp without time zone NOT NULL +); + + +-- +-- Name: active_storage_attachments_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- + +CREATE SEQUENCE support.active_storage_attachments_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: active_storage_attachments_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- + +ALTER SEQUENCE support.active_storage_attachments_id_seq OWNED BY support.active_storage_attachments.id; + + +-- +-- Name: active_storage_blobs; Type: TABLE; Schema: support; Owner: - +-- + +CREATE TABLE support.active_storage_blobs ( + id bigint NOT NULL, + key character varying NOT NULL, + filename character varying NOT NULL, + content_type character varying, + metadata text, + byte_size bigint NOT NULL, + checksum character varying NOT NULL, + created_at timestamp without time zone NOT NULL +); + + +-- +-- Name: active_storage_blobs_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- + +CREATE SEQUENCE support.active_storage_blobs_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: active_storage_blobs_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- + +ALTER SEQUENCE support.active_storage_blobs_id_seq OWNED BY support.active_storage_blobs.id; + + +-- +-- Name: background_jobs; Type: TABLE; Schema: support; Owner: - +-- + +CREATE TABLE support.background_jobs ( + id bigint NOT NULL, + user_id integer, + status character varying, + completed_at timestamp without time zone, + logs character varying, + type character varying, + data json, + url character varying, + created_at timestamp(6) without time zone NOT NULL, + updated_at timestamp(6) without time zone NOT NULL, + user_error_message character varying +); + + +-- +-- Name: background_jobs_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- + +CREATE SEQUENCE support.background_jobs_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: background_jobs_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- + +ALTER SEQUENCE support.background_jobs_id_seq OWNED BY support.background_jobs.id; + + +-- +-- Name: file_records; Type: TABLE; Schema: support; Owner: - +-- + +CREATE TABLE support.file_records ( + id bigint NOT NULL, + filename character varying, + file_size bigint, + file_type character varying, + created_at timestamp(6) without time zone NOT NULL, + updated_at timestamp(6) without time zone NOT NULL, + url character varying, + load_event_id bigint +); + + +-- +-- Name: file_records_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- + +CREATE SEQUENCE support.file_records_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: file_records_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- + +ALTER SEQUENCE support.file_records_id_seq OWNED BY support.file_records.id; + + +-- +-- Name: load_events; Type: TABLE; Schema: support; Owner: - +-- + +CREATE TABLE support.load_events ( + id integer NOT NULL, + event_type character varying, + status character varying, + description text, + problems text, + should_add integer, + should_change integer, + processed integer, + load_time character varying, + completed_at timestamp without time zone, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL +); + + +-- +-- Name: load_events_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- + +CREATE SEQUENCE support.load_events_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: load_events_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- + +ALTER SEQUENCE support.load_events_id_seq OWNED BY support.load_events.id; + + +-- +-- Name: load_issues; Type: TABLE; Schema: support; Owner: - +-- + +CREATE TABLE support.load_issues ( + id bigint NOT NULL, + load_event_id bigint, + nct_id character varying, + message character varying +); + + +-- +-- Name: load_issues_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- + +CREATE SEQUENCE support.load_issues_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: load_issues_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- + +ALTER SEQUENCE support.load_issues_id_seq OWNED BY support.load_issues.id; + + +-- +-- Name: sanity_checks; Type: TABLE; Schema: support; Owner: - +-- + +CREATE TABLE support.sanity_checks ( + id integer NOT NULL, + table_name character varying, + nct_id character varying, + column_name character varying, + check_type character varying, + row_count integer, + description text, + most_current boolean, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL, + load_event_id bigint +); + + +-- +-- Name: sanity_checks_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- + +CREATE SEQUENCE support.sanity_checks_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: sanity_checks_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- + +ALTER SEQUENCE support.sanity_checks_id_seq OWNED BY support.sanity_checks.id; + + +-- +-- Name: study_json_records; Type: TABLE; Schema: support; Owner: - +-- + +CREATE TABLE support.study_json_records ( + id integer NOT NULL, + nct_id character varying NOT NULL, + content jsonb NOT NULL, + saved_study_at timestamp without time zone, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL, + download_date character varying, + version character varying DEFAULT '1'::character varying +); + + +-- +-- Name: study_json_records_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- + +CREATE SEQUENCE support.study_json_records_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: study_json_records_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- + +ALTER SEQUENCE support.study_json_records_id_seq OWNED BY support.study_json_records.id; + + +-- +-- Name: study_statistics_comparisons; Type: TABLE; Schema: support; Owner: - +-- + +CREATE TABLE support.study_statistics_comparisons ( + id bigint NOT NULL, + ctgov_selector character varying, + "table" character varying, + "column" character varying, + condition character varying, + instances_query character varying, + unique_query character varying +); + + +-- +-- Name: study_statistics_comparisons_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- + +CREATE SEQUENCE support.study_statistics_comparisons_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: study_statistics_comparisons_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- + +ALTER SEQUENCE support.study_statistics_comparisons_id_seq OWNED BY support.study_statistics_comparisons.id; + + +-- +-- Name: study_xml_records; Type: TABLE; Schema: support; Owner: - +-- + +CREATE TABLE support.study_xml_records ( + id integer NOT NULL, + nct_id character varying, + content xml, + created_study_at timestamp without time zone, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL +); + + +-- +-- Name: study_xml_records_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- + +CREATE SEQUENCE support.study_xml_records_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: study_xml_records_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- + +ALTER SEQUENCE support.study_xml_records_id_seq OWNED BY support.study_xml_records.id; + + +-- +-- Name: verifiers; Type: TABLE; Schema: support; Owner: - +-- + +CREATE TABLE support.verifiers ( + id bigint NOT NULL, + differences json DEFAULT '[]'::json NOT NULL, + last_run timestamp without time zone, + source json, + created_at timestamp(6) without time zone NOT NULL, + updated_at timestamp(6) without time zone NOT NULL, + load_event_id integer +); + + +-- +-- Name: verifiers_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- + +CREATE SEQUENCE support.verifiers_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: verifiers_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- + +ALTER SEQUENCE support.verifiers_id_seq OWNED BY support.verifiers.id; + + +-- +-- Name: baseline_counts id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.baseline_counts ALTER COLUMN id SET DEFAULT nextval('ctgov.baseline_counts_id_seq'::regclass); + + +-- +-- Name: baseline_measurements id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.baseline_measurements ALTER COLUMN id SET DEFAULT nextval('ctgov.baseline_measurements_id_seq'::regclass); + + +-- +-- Name: brief_summaries id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.brief_summaries ALTER COLUMN id SET DEFAULT nextval('ctgov.brief_summaries_id_seq'::regclass); + + +-- +-- Name: browse_conditions id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.browse_conditions ALTER COLUMN id SET DEFAULT nextval('ctgov.browse_conditions_id_seq'::regclass); + + +-- +-- Name: browse_interventions id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.browse_interventions ALTER COLUMN id SET DEFAULT nextval('ctgov.browse_interventions_id_seq'::regclass); + + +-- +-- Name: calculated_values id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.calculated_values ALTER COLUMN id SET DEFAULT nextval('ctgov.calculated_values_id_seq'::regclass); + + +-- +-- Name: central_contacts id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.central_contacts ALTER COLUMN id SET DEFAULT nextval('ctgov.central_contacts_id_seq'::regclass); + + +-- +-- Name: conditions id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.conditions ALTER COLUMN id SET DEFAULT nextval('ctgov.conditions_id_seq'::regclass); + + +-- +-- Name: countries id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.countries ALTER COLUMN id SET DEFAULT nextval('ctgov.countries_id_seq'::regclass); + + +-- +-- Name: design_group_interventions id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.design_group_interventions ALTER COLUMN id SET DEFAULT nextval('ctgov.design_group_interventions_id_seq'::regclass); + + +-- +-- Name: design_groups id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.design_groups ALTER COLUMN id SET DEFAULT nextval('ctgov.design_groups_id_seq'::regclass); + + +-- +-- Name: design_outcomes id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.design_outcomes ALTER COLUMN id SET DEFAULT nextval('ctgov.design_outcomes_id_seq'::regclass); + + +-- +-- Name: designs id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.designs ALTER COLUMN id SET DEFAULT nextval('ctgov.designs_id_seq'::regclass); + + +-- +-- Name: detailed_descriptions id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.detailed_descriptions ALTER COLUMN id SET DEFAULT nextval('ctgov.detailed_descriptions_id_seq'::regclass); + + +-- +-- Name: documents id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.documents ALTER COLUMN id SET DEFAULT nextval('ctgov.documents_id_seq'::regclass); + + +-- +-- Name: drop_withdrawals id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.drop_withdrawals ALTER COLUMN id SET DEFAULT nextval('ctgov.drop_withdrawals_id_seq'::regclass); + + +-- +-- Name: eligibilities id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.eligibilities ALTER COLUMN id SET DEFAULT nextval('ctgov.eligibilities_id_seq'::regclass); + + +-- +-- Name: facilities id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.facilities ALTER COLUMN id SET DEFAULT nextval('ctgov.facilities_id_seq'::regclass); + + +-- +-- Name: facility_contacts id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.facility_contacts ALTER COLUMN id SET DEFAULT nextval('ctgov.facility_contacts_id_seq'::regclass); + + +-- +-- Name: facility_investigators id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.facility_investigators ALTER COLUMN id SET DEFAULT nextval('ctgov.facility_investigators_id_seq'::regclass); + + +-- +-- Name: id_information id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.id_information ALTER COLUMN id SET DEFAULT nextval('ctgov.id_information_id_seq'::regclass); + + +-- +-- Name: intervention_other_names id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.intervention_other_names ALTER COLUMN id SET DEFAULT nextval('ctgov.intervention_other_names_id_seq'::regclass); + + +-- +-- Name: interventions id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.interventions ALTER COLUMN id SET DEFAULT nextval('ctgov.interventions_id_seq'::regclass); + + +-- +-- Name: ipd_information_types id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.ipd_information_types ALTER COLUMN id SET DEFAULT nextval('ctgov.ipd_information_types_id_seq'::regclass); + + +-- +-- Name: keywords id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.keywords ALTER COLUMN id SET DEFAULT nextval('ctgov.keywords_id_seq'::regclass); + + +-- +-- Name: links id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.links ALTER COLUMN id SET DEFAULT nextval('ctgov.links_id_seq'::regclass); + + +-- +-- Name: mesh_headings id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.mesh_headings ALTER COLUMN id SET DEFAULT nextval('ctgov.mesh_headings_id_seq'::regclass); + + +-- +-- Name: mesh_terms id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.mesh_terms ALTER COLUMN id SET DEFAULT nextval('ctgov.mesh_terms_id_seq'::regclass); + + +-- +-- Name: milestones id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.milestones ALTER COLUMN id SET DEFAULT nextval('ctgov.milestones_id_seq'::regclass); + + +-- +-- Name: outcome_analyses id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.outcome_analyses ALTER COLUMN id SET DEFAULT nextval('ctgov.outcome_analyses_id_seq'::regclass); + + +-- +-- Name: outcome_analysis_groups id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.outcome_analysis_groups ALTER COLUMN id SET DEFAULT nextval('ctgov.outcome_analysis_groups_id_seq'::regclass); + + +-- +-- Name: outcome_counts id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.outcome_counts ALTER COLUMN id SET DEFAULT nextval('ctgov.outcome_counts_id_seq'::regclass); + + +-- +-- Name: outcome_measurements id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.outcome_measurements ALTER COLUMN id SET DEFAULT nextval('ctgov.outcome_measurements_id_seq'::regclass); + + +-- +-- Name: outcomes id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.outcomes ALTER COLUMN id SET DEFAULT nextval('ctgov.outcomes_id_seq'::regclass); + + +-- +-- Name: overall_officials id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.overall_officials ALTER COLUMN id SET DEFAULT nextval('ctgov.overall_officials_id_seq'::regclass); + + +-- +-- Name: participant_flows id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.participant_flows ALTER COLUMN id SET DEFAULT nextval('ctgov.participant_flows_id_seq'::regclass); + + +-- +-- Name: pending_results id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.pending_results ALTER COLUMN id SET DEFAULT nextval('ctgov.pending_results_id_seq'::regclass); + + +-- +-- Name: provided_documents id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.provided_documents ALTER COLUMN id SET DEFAULT nextval('ctgov.provided_documents_id_seq'::regclass); + + +-- +-- Name: reported_event_totals id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.reported_event_totals ALTER COLUMN id SET DEFAULT nextval('ctgov.reported_event_totals_id_seq'::regclass); + + +-- +-- Name: reported_events id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.reported_events ALTER COLUMN id SET DEFAULT nextval('ctgov.reported_events_id_seq'::regclass); + + +-- +-- Name: responsible_parties id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.responsible_parties ALTER COLUMN id SET DEFAULT nextval('ctgov.responsible_parties_id_seq'::regclass); + + +-- +-- Name: result_agreements id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.result_agreements ALTER COLUMN id SET DEFAULT nextval('ctgov.result_agreements_id_seq'::regclass); + + +-- +-- Name: result_contacts id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.result_contacts ALTER COLUMN id SET DEFAULT nextval('ctgov.result_contacts_id_seq'::regclass); + + +-- +-- Name: result_groups id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.result_groups ALTER COLUMN id SET DEFAULT nextval('ctgov.result_groups_id_seq'::regclass); + + +-- +-- Name: retractions id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.retractions ALTER COLUMN id SET DEFAULT nextval('ctgov.retractions_id_seq'::regclass); + + +-- +-- Name: search_results id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.search_results ALTER COLUMN id SET DEFAULT nextval('ctgov.search_results_id_seq'::regclass); + + +-- +-- Name: sponsors id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.sponsors ALTER COLUMN id SET DEFAULT nextval('ctgov.sponsors_id_seq'::regclass); + + +-- +-- Name: study_records id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.study_records ALTER COLUMN id SET DEFAULT nextval('ctgov.study_records_id_seq'::regclass); + + +-- +-- Name: study_references id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.study_references ALTER COLUMN id SET DEFAULT nextval('ctgov.study_references_id_seq'::regclass); + + +-- +-- Name: study_searches id; Type: DEFAULT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.study_searches ALTER COLUMN id SET DEFAULT nextval('ctgov.study_searches_id_seq'::regclass); + + +-- +-- Name: baseline_counts id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.baseline_counts ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.baseline_counts_id_seq'::regclass); + + +-- +-- Name: baseline_measurements id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.baseline_measurements ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.baseline_measurements_id_seq'::regclass); + + +-- +-- Name: brief_summaries id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.brief_summaries ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.brief_summaries_id_seq'::regclass); + + +-- +-- Name: browse_conditions id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.browse_conditions ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.browse_conditions_id_seq'::regclass); + + +-- +-- Name: browse_interventions id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.browse_interventions ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.browse_interventions_id_seq'::regclass); + + +-- +-- Name: calculated_values id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.calculated_values ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.calculated_values_id_seq'::regclass); + + +-- +-- Name: central_contacts id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.central_contacts ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.central_contacts_id_seq'::regclass); + + +-- +-- Name: conditions id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.conditions ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.conditions_id_seq'::regclass); + + +-- +-- Name: countries id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.countries ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.countries_id_seq'::regclass); + + +-- +-- Name: design_group_interventions id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.design_group_interventions ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.design_group_interventions_id_seq'::regclass); + + +-- +-- Name: design_groups id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.design_groups ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.design_groups_id_seq'::regclass); + + +-- +-- Name: design_outcomes id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.design_outcomes ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.design_outcomes_id_seq'::regclass); + + +-- +-- Name: designs id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.designs ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.designs_id_seq'::regclass); + + +-- +-- Name: detailed_descriptions id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.detailed_descriptions ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.detailed_descriptions_id_seq'::regclass); + + +-- +-- Name: documents id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.documents ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.documents_id_seq'::regclass); + + +-- +-- Name: drop_withdrawals id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.drop_withdrawals ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.drop_withdrawals_id_seq'::regclass); + + +-- +-- Name: eligibilities id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.eligibilities ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.eligibilities_id_seq'::regclass); + + +-- +-- Name: facilities id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.facilities ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.facilities_id_seq'::regclass); + + +-- +-- Name: facility_contacts id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.facility_contacts ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.facility_contacts_id_seq'::regclass); + + +-- +-- Name: facility_investigators id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.facility_investigators ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.facility_investigators_id_seq'::regclass); + + +-- +-- Name: id_information id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.id_information ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.id_information_id_seq'::regclass); + + +-- +-- Name: intervention_other_names id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.intervention_other_names ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.intervention_other_names_id_seq'::regclass); + + +-- +-- Name: interventions id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.interventions ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.interventions_id_seq'::regclass); + + +-- +-- Name: ipd_information_types id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.ipd_information_types ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.ipd_information_types_id_seq'::regclass); + + +-- +-- Name: keywords id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.keywords ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.keywords_id_seq'::regclass); + + +-- +-- Name: links id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.links ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.links_id_seq'::regclass); + + +-- +-- Name: mesh_headings id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.mesh_headings ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.mesh_headings_id_seq'::regclass); + + +-- +-- Name: mesh_terms id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.mesh_terms ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.mesh_terms_id_seq'::regclass); + + +-- +-- Name: milestones id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.milestones ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.milestones_id_seq'::regclass); + + +-- +-- Name: outcome_analyses id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.outcome_analyses ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.outcome_analyses_id_seq'::regclass); + + +-- +-- Name: outcome_analysis_groups id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.outcome_analysis_groups ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.outcome_analysis_groups_id_seq'::regclass); + + +-- +-- Name: outcome_counts id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.outcome_counts ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.outcome_counts_id_seq'::regclass); + + +-- +-- Name: outcome_measurements id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.outcome_measurements ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.outcome_measurements_id_seq'::regclass); + + +-- +-- Name: outcomes id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.outcomes ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.outcomes_id_seq'::regclass); + + +-- +-- Name: overall_officials id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.overall_officials ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.overall_officials_id_seq'::regclass); + + +-- +-- Name: participant_flows id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.participant_flows ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.participant_flows_id_seq'::regclass); + + +-- +-- Name: pending_results id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.pending_results ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.pending_results_id_seq'::regclass); + + +-- +-- Name: provided_documents id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.provided_documents ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.provided_documents_id_seq'::regclass); + + +-- +-- Name: reported_event_totals id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.reported_event_totals ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.reported_event_totals_id_seq'::regclass); + + +-- +-- Name: reported_events id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.reported_events ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.reported_events_id_seq'::regclass); + + +-- +-- Name: responsible_parties id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.responsible_parties ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.responsible_parties_id_seq'::regclass); + + +-- +-- Name: result_agreements id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.result_agreements ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.result_agreements_id_seq'::regclass); + + +-- +-- Name: result_contacts id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.result_contacts ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.result_contacts_id_seq'::regclass); + + +-- +-- Name: result_groups id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.result_groups ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.result_groups_id_seq'::regclass); + + +-- +-- Name: retractions id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.retractions ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.retractions_id_seq'::regclass); + + +-- +-- Name: search_results id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.search_results ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.search_results_id_seq'::regclass); + + +-- +-- Name: sponsors id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.sponsors ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.sponsors_id_seq'::regclass); + + +-- +-- Name: study_records id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.study_records ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.study_records_id_seq'::regclass); + + +-- +-- Name: study_references id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.study_references ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.study_references_id_seq'::regclass); + + +-- +-- Name: study_searches id; Type: DEFAULT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.study_searches ALTER COLUMN id SET DEFAULT nextval('ctgov_v2.study_searches_id_seq'::regclass); + + +-- +-- Name: active_storage_attachments id; Type: DEFAULT; Schema: support; Owner: - +-- + +ALTER TABLE ONLY support.active_storage_attachments ALTER COLUMN id SET DEFAULT nextval('support.active_storage_attachments_id_seq'::regclass); + + +-- +-- Name: active_storage_blobs id; Type: DEFAULT; Schema: support; Owner: - +-- + +ALTER TABLE ONLY support.active_storage_blobs ALTER COLUMN id SET DEFAULT nextval('support.active_storage_blobs_id_seq'::regclass); + + +-- +-- Name: background_jobs id; Type: DEFAULT; Schema: support; Owner: - +-- + +ALTER TABLE ONLY support.background_jobs ALTER COLUMN id SET DEFAULT nextval('support.background_jobs_id_seq'::regclass); + + +-- +-- Name: file_records id; Type: DEFAULT; Schema: support; Owner: - +-- + +ALTER TABLE ONLY support.file_records ALTER COLUMN id SET DEFAULT nextval('support.file_records_id_seq'::regclass); + + +-- +-- Name: load_events id; Type: DEFAULT; Schema: support; Owner: - +-- + +ALTER TABLE ONLY support.load_events ALTER COLUMN id SET DEFAULT nextval('support.load_events_id_seq'::regclass); + + +-- +-- Name: load_issues id; Type: DEFAULT; Schema: support; Owner: - +-- + +ALTER TABLE ONLY support.load_issues ALTER COLUMN id SET DEFAULT nextval('support.load_issues_id_seq'::regclass); + + +-- +-- Name: sanity_checks id; Type: DEFAULT; Schema: support; Owner: - +-- + +ALTER TABLE ONLY support.sanity_checks ALTER COLUMN id SET DEFAULT nextval('support.sanity_checks_id_seq'::regclass); + + +-- +-- Name: study_json_records id; Type: DEFAULT; Schema: support; Owner: - +-- + +ALTER TABLE ONLY support.study_json_records ALTER COLUMN id SET DEFAULT nextval('support.study_json_records_id_seq'::regclass); + + +-- +-- Name: study_statistics_comparisons id; Type: DEFAULT; Schema: support; Owner: - +-- + +ALTER TABLE ONLY support.study_statistics_comparisons ALTER COLUMN id SET DEFAULT nextval('support.study_statistics_comparisons_id_seq'::regclass); + + +-- +-- Name: study_xml_records id; Type: DEFAULT; Schema: support; Owner: - +-- + +ALTER TABLE ONLY support.study_xml_records ALTER COLUMN id SET DEFAULT nextval('support.study_xml_records_id_seq'::regclass); + + +-- +-- Name: verifiers id; Type: DEFAULT; Schema: support; Owner: - +-- + +ALTER TABLE ONLY support.verifiers ALTER COLUMN id SET DEFAULT nextval('support.verifiers_id_seq'::regclass); + + +-- +-- Name: baseline_counts baseline_counts_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.baseline_counts + ADD CONSTRAINT baseline_counts_pkey PRIMARY KEY (id); + + +-- +-- Name: baseline_measurements baseline_measurements_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.baseline_measurements + ADD CONSTRAINT baseline_measurements_pkey PRIMARY KEY (id); + + +-- +-- Name: brief_summaries brief_summaries_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.brief_summaries + ADD CONSTRAINT brief_summaries_pkey PRIMARY KEY (id); + + +-- +-- Name: browse_conditions browse_conditions_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.browse_conditions + ADD CONSTRAINT browse_conditions_pkey PRIMARY KEY (id); + + +-- +-- Name: browse_interventions browse_interventions_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.browse_interventions + ADD CONSTRAINT browse_interventions_pkey PRIMARY KEY (id); + + +-- +-- Name: calculated_values calculated_values_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.calculated_values + ADD CONSTRAINT calculated_values_pkey PRIMARY KEY (id); + + +-- +-- Name: central_contacts central_contacts_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.central_contacts + ADD CONSTRAINT central_contacts_pkey PRIMARY KEY (id); + + +-- +-- Name: conditions conditions_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.conditions + ADD CONSTRAINT conditions_pkey PRIMARY KEY (id); + + +-- +-- Name: countries countries_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.countries + ADD CONSTRAINT countries_pkey PRIMARY KEY (id); + + +-- +-- Name: design_group_interventions design_group_interventions_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.design_group_interventions + ADD CONSTRAINT design_group_interventions_pkey PRIMARY KEY (id); + + +-- +-- Name: design_groups design_groups_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.design_groups + ADD CONSTRAINT design_groups_pkey PRIMARY KEY (id); + + +-- +-- Name: design_outcomes design_outcomes_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.design_outcomes + ADD CONSTRAINT design_outcomes_pkey PRIMARY KEY (id); + + +-- +-- Name: designs designs_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.designs + ADD CONSTRAINT designs_pkey PRIMARY KEY (id); + + +-- +-- Name: detailed_descriptions detailed_descriptions_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.detailed_descriptions + ADD CONSTRAINT detailed_descriptions_pkey PRIMARY KEY (id); + + +-- +-- Name: documents documents_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.documents + ADD CONSTRAINT documents_pkey PRIMARY KEY (id); + + +-- +-- Name: drop_withdrawals drop_withdrawals_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.drop_withdrawals + ADD CONSTRAINT drop_withdrawals_pkey PRIMARY KEY (id); + + +-- +-- Name: eligibilities eligibilities_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.eligibilities + ADD CONSTRAINT eligibilities_pkey PRIMARY KEY (id); + + +-- +-- Name: facilities facilities_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.facilities + ADD CONSTRAINT facilities_pkey PRIMARY KEY (id); + + +-- +-- Name: facility_contacts facility_contacts_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.facility_contacts + ADD CONSTRAINT facility_contacts_pkey PRIMARY KEY (id); + + +-- +-- Name: facility_investigators facility_investigators_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.facility_investigators + ADD CONSTRAINT facility_investigators_pkey PRIMARY KEY (id); + + +-- +-- Name: id_information id_information_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.id_information + ADD CONSTRAINT id_information_pkey PRIMARY KEY (id); + + +-- +-- Name: intervention_other_names intervention_other_names_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.intervention_other_names + ADD CONSTRAINT intervention_other_names_pkey PRIMARY KEY (id); + + +-- +-- Name: interventions interventions_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.interventions + ADD CONSTRAINT interventions_pkey PRIMARY KEY (id); + + +-- +-- Name: ipd_information_types ipd_information_types_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.ipd_information_types + ADD CONSTRAINT ipd_information_types_pkey PRIMARY KEY (id); + + +-- +-- Name: keywords keywords_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.keywords + ADD CONSTRAINT keywords_pkey PRIMARY KEY (id); + + +-- +-- Name: links links_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.links + ADD CONSTRAINT links_pkey PRIMARY KEY (id); + + +-- +-- Name: mesh_headings mesh_headings_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.mesh_headings + ADD CONSTRAINT mesh_headings_pkey PRIMARY KEY (id); + + +-- +-- Name: mesh_terms mesh_terms_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.mesh_terms + ADD CONSTRAINT mesh_terms_pkey PRIMARY KEY (id); + + +-- +-- Name: milestones milestones_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.milestones + ADD CONSTRAINT milestones_pkey PRIMARY KEY (id); + + +-- +-- Name: outcome_analyses outcome_analyses_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.outcome_analyses + ADD CONSTRAINT outcome_analyses_pkey PRIMARY KEY (id); + + +-- +-- Name: outcome_analysis_groups outcome_analysis_groups_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.outcome_analysis_groups + ADD CONSTRAINT outcome_analysis_groups_pkey PRIMARY KEY (id); + + +-- +-- Name: outcome_counts outcome_counts_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.outcome_counts + ADD CONSTRAINT outcome_counts_pkey PRIMARY KEY (id); + + +-- +-- Name: outcome_measurements outcome_measurements_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.outcome_measurements + ADD CONSTRAINT outcome_measurements_pkey PRIMARY KEY (id); + + +-- +-- Name: outcomes outcomes_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.outcomes + ADD CONSTRAINT outcomes_pkey PRIMARY KEY (id); + + +-- +-- Name: overall_officials overall_officials_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.overall_officials + ADD CONSTRAINT overall_officials_pkey PRIMARY KEY (id); + + +-- +-- Name: participant_flows participant_flows_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.participant_flows + ADD CONSTRAINT participant_flows_pkey PRIMARY KEY (id); + + +-- +-- Name: pending_results pending_results_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.pending_results + ADD CONSTRAINT pending_results_pkey PRIMARY KEY (id); + + +-- +-- Name: provided_documents provided_documents_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.provided_documents + ADD CONSTRAINT provided_documents_pkey PRIMARY KEY (id); + + +-- +-- Name: reported_event_totals reported_event_totals_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.reported_event_totals + ADD CONSTRAINT reported_event_totals_pkey PRIMARY KEY (id); + + +-- +-- Name: reported_events reported_events_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.reported_events + ADD CONSTRAINT reported_events_pkey PRIMARY KEY (id); + + +-- +-- Name: responsible_parties responsible_parties_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.responsible_parties + ADD CONSTRAINT responsible_parties_pkey PRIMARY KEY (id); + + +-- +-- Name: result_agreements result_agreements_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.result_agreements + ADD CONSTRAINT result_agreements_pkey PRIMARY KEY (id); + + +-- +-- Name: result_contacts result_contacts_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.result_contacts + ADD CONSTRAINT result_contacts_pkey PRIMARY KEY (id); + + +-- +-- Name: result_groups result_groups_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.result_groups + ADD CONSTRAINT result_groups_pkey PRIMARY KEY (id); + + +-- +-- Name: retractions retractions_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.retractions + ADD CONSTRAINT retractions_pkey PRIMARY KEY (id); + + +-- +-- Name: search_results search_results_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.search_results + ADD CONSTRAINT search_results_pkey PRIMARY KEY (id); + + +-- +-- Name: sponsors sponsors_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.sponsors + ADD CONSTRAINT sponsors_pkey PRIMARY KEY (id); + + +-- +-- Name: study_records study_records_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.study_records + ADD CONSTRAINT study_records_pkey PRIMARY KEY (id); + + +-- +-- Name: study_references study_references_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.study_references + ADD CONSTRAINT study_references_pkey PRIMARY KEY (id); + + +-- +-- Name: study_searches study_searches_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- + +ALTER TABLE ONLY ctgov.study_searches + ADD CONSTRAINT study_searches_pkey PRIMARY KEY (id); + + +-- +-- Name: baseline_counts baseline_counts_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.baseline_counts + ADD CONSTRAINT baseline_counts_pkey PRIMARY KEY (id); + + +-- +-- Name: baseline_measurements baseline_measurements_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.baseline_measurements + ADD CONSTRAINT baseline_measurements_pkey PRIMARY KEY (id); + + +-- +-- Name: brief_summaries brief_summaries_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.brief_summaries + ADD CONSTRAINT brief_summaries_pkey PRIMARY KEY (id); + + +-- +-- Name: browse_conditions browse_conditions_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.browse_conditions + ADD CONSTRAINT browse_conditions_pkey PRIMARY KEY (id); + + +-- +-- Name: browse_interventions browse_interventions_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.browse_interventions + ADD CONSTRAINT browse_interventions_pkey PRIMARY KEY (id); + + +-- +-- Name: calculated_values calculated_values_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.calculated_values + ADD CONSTRAINT calculated_values_pkey PRIMARY KEY (id); + + +-- +-- Name: central_contacts central_contacts_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.central_contacts + ADD CONSTRAINT central_contacts_pkey PRIMARY KEY (id); + + +-- +-- Name: conditions conditions_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.conditions + ADD CONSTRAINT conditions_pkey PRIMARY KEY (id); + + +-- +-- Name: countries countries_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.countries + ADD CONSTRAINT countries_pkey PRIMARY KEY (id); + + +-- +-- Name: design_group_interventions design_group_interventions_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.design_group_interventions + ADD CONSTRAINT design_group_interventions_pkey PRIMARY KEY (id); + + +-- +-- Name: design_groups design_groups_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.design_groups + ADD CONSTRAINT design_groups_pkey PRIMARY KEY (id); + + +-- +-- Name: design_outcomes design_outcomes_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.design_outcomes + ADD CONSTRAINT design_outcomes_pkey PRIMARY KEY (id); + + +-- +-- Name: designs designs_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.designs + ADD CONSTRAINT designs_pkey PRIMARY KEY (id); + + +-- +-- Name: detailed_descriptions detailed_descriptions_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.detailed_descriptions + ADD CONSTRAINT detailed_descriptions_pkey PRIMARY KEY (id); + + +-- +-- Name: documents documents_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.documents + ADD CONSTRAINT documents_pkey PRIMARY KEY (id); + + +-- +-- Name: drop_withdrawals drop_withdrawals_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.drop_withdrawals + ADD CONSTRAINT drop_withdrawals_pkey PRIMARY KEY (id); + + +-- +-- Name: eligibilities eligibilities_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.eligibilities + ADD CONSTRAINT eligibilities_pkey PRIMARY KEY (id); + + +-- +-- Name: facilities facilities_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.facilities + ADD CONSTRAINT facilities_pkey PRIMARY KEY (id); + + +-- +-- Name: facility_contacts facility_contacts_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.facility_contacts + ADD CONSTRAINT facility_contacts_pkey PRIMARY KEY (id); + + +-- +-- Name: facility_investigators facility_investigators_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.facility_investigators + ADD CONSTRAINT facility_investigators_pkey PRIMARY KEY (id); + + +-- +-- Name: id_information id_information_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.id_information + ADD CONSTRAINT id_information_pkey PRIMARY KEY (id); + + +-- +-- Name: intervention_other_names intervention_other_names_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - +-- + +ALTER TABLE ONLY ctgov_v2.intervention_other_names + ADD CONSTRAINT intervention_other_names_pkey PRIMARY KEY (id); + + +-- +-- Name: interventions interventions_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -CREATE SEQUENCE support.study_xml_records_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; +ALTER TABLE ONLY ctgov_v2.interventions + ADD CONSTRAINT interventions_pkey PRIMARY KEY (id); -- --- Name: study_xml_records_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- Name: ipd_information_types ipd_information_types_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER SEQUENCE support.study_xml_records_id_seq OWNED BY support.study_xml_records.id; +ALTER TABLE ONLY ctgov_v2.ipd_information_types + ADD CONSTRAINT ipd_information_types_pkey PRIMARY KEY (id); -- --- Name: verifiers; Type: TABLE; Schema: support; Owner: - +-- Name: keywords keywords_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -CREATE TABLE support.verifiers ( - id bigint NOT NULL, - differences json DEFAULT '[]'::json NOT NULL, - last_run timestamp without time zone, - source json, - created_at timestamp(6) without time zone NOT NULL, - updated_at timestamp(6) without time zone NOT NULL, - load_event_id integer -); +ALTER TABLE ONLY ctgov_v2.keywords + ADD CONSTRAINT keywords_pkey PRIMARY KEY (id); -- --- Name: verifiers_id_seq; Type: SEQUENCE; Schema: support; Owner: - +-- Name: links links_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -CREATE SEQUENCE support.verifiers_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; +ALTER TABLE ONLY ctgov_v2.links + ADD CONSTRAINT links_pkey PRIMARY KEY (id); -- --- Name: verifiers_id_seq; Type: SEQUENCE OWNED BY; Schema: support; Owner: - +-- Name: mesh_headings mesh_headings_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER SEQUENCE support.verifiers_id_seq OWNED BY support.verifiers.id; +ALTER TABLE ONLY ctgov_v2.mesh_headings + ADD CONSTRAINT mesh_headings_pkey PRIMARY KEY (id); -- --- Name: baseline_counts id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: mesh_terms mesh_terms_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER TABLE ONLY ctgov.baseline_counts ALTER COLUMN id SET DEFAULT nextval('ctgov.baseline_counts_id_seq'::regclass); +ALTER TABLE ONLY ctgov_v2.mesh_terms + ADD CONSTRAINT mesh_terms_pkey PRIMARY KEY (id); -- --- Name: baseline_measurements id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: milestones milestones_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER TABLE ONLY ctgov.baseline_measurements ALTER COLUMN id SET DEFAULT nextval('ctgov.baseline_measurements_id_seq'::regclass); +ALTER TABLE ONLY ctgov_v2.milestones + ADD CONSTRAINT milestones_pkey PRIMARY KEY (id); -- --- Name: brief_summaries id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: outcome_analyses outcome_analyses_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER TABLE ONLY ctgov.brief_summaries ALTER COLUMN id SET DEFAULT nextval('ctgov.brief_summaries_id_seq'::regclass); +ALTER TABLE ONLY ctgov_v2.outcome_analyses + ADD CONSTRAINT outcome_analyses_pkey PRIMARY KEY (id); -- --- Name: browse_conditions id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: outcome_analysis_groups outcome_analysis_groups_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER TABLE ONLY ctgov.browse_conditions ALTER COLUMN id SET DEFAULT nextval('ctgov.browse_conditions_id_seq'::regclass); +ALTER TABLE ONLY ctgov_v2.outcome_analysis_groups + ADD CONSTRAINT outcome_analysis_groups_pkey PRIMARY KEY (id); -- --- Name: browse_interventions id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: outcome_counts outcome_counts_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER TABLE ONLY ctgov.browse_interventions ALTER COLUMN id SET DEFAULT nextval('ctgov.browse_interventions_id_seq'::regclass); +ALTER TABLE ONLY ctgov_v2.outcome_counts + ADD CONSTRAINT outcome_counts_pkey PRIMARY KEY (id); -- --- Name: calculated_values id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: outcome_measurements outcome_measurements_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER TABLE ONLY ctgov.calculated_values ALTER COLUMN id SET DEFAULT nextval('ctgov.calculated_values_id_seq'::regclass); +ALTER TABLE ONLY ctgov_v2.outcome_measurements + ADD CONSTRAINT outcome_measurements_pkey PRIMARY KEY (id); -- --- Name: central_contacts id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: outcomes outcomes_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER TABLE ONLY ctgov.central_contacts ALTER COLUMN id SET DEFAULT nextval('ctgov.central_contacts_id_seq'::regclass); +ALTER TABLE ONLY ctgov_v2.outcomes + ADD CONSTRAINT outcomes_pkey PRIMARY KEY (id); -- --- Name: conditions id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: overall_officials overall_officials_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER TABLE ONLY ctgov.conditions ALTER COLUMN id SET DEFAULT nextval('ctgov.conditions_id_seq'::regclass); +ALTER TABLE ONLY ctgov_v2.overall_officials + ADD CONSTRAINT overall_officials_pkey PRIMARY KEY (id); -- --- Name: countries id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: participant_flows participant_flows_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER TABLE ONLY ctgov.countries ALTER COLUMN id SET DEFAULT nextval('ctgov.countries_id_seq'::regclass); +ALTER TABLE ONLY ctgov_v2.participant_flows + ADD CONSTRAINT participant_flows_pkey PRIMARY KEY (id); -- --- Name: design_group_interventions id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: pending_results pending_results_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER TABLE ONLY ctgov.design_group_interventions ALTER COLUMN id SET DEFAULT nextval('ctgov.design_group_interventions_id_seq'::regclass); +ALTER TABLE ONLY ctgov_v2.pending_results + ADD CONSTRAINT pending_results_pkey PRIMARY KEY (id); -- --- Name: design_groups id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: provided_documents provided_documents_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER TABLE ONLY ctgov.design_groups ALTER COLUMN id SET DEFAULT nextval('ctgov.design_groups_id_seq'::regclass); +ALTER TABLE ONLY ctgov_v2.provided_documents + ADD CONSTRAINT provided_documents_pkey PRIMARY KEY (id); -- --- Name: design_outcomes id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: reported_event_totals reported_event_totals_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER TABLE ONLY ctgov.design_outcomes ALTER COLUMN id SET DEFAULT nextval('ctgov.design_outcomes_id_seq'::regclass); +ALTER TABLE ONLY ctgov_v2.reported_event_totals + ADD CONSTRAINT reported_event_totals_pkey PRIMARY KEY (id); -- --- Name: designs id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: reported_events reported_events_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER TABLE ONLY ctgov.designs ALTER COLUMN id SET DEFAULT nextval('ctgov.designs_id_seq'::regclass); +ALTER TABLE ONLY ctgov_v2.reported_events + ADD CONSTRAINT reported_events_pkey PRIMARY KEY (id); -- --- Name: detailed_descriptions id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: responsible_parties responsible_parties_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER TABLE ONLY ctgov.detailed_descriptions ALTER COLUMN id SET DEFAULT nextval('ctgov.detailed_descriptions_id_seq'::regclass); +ALTER TABLE ONLY ctgov_v2.responsible_parties + ADD CONSTRAINT responsible_parties_pkey PRIMARY KEY (id); -- --- Name: documents id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: result_agreements result_agreements_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER TABLE ONLY ctgov.documents ALTER COLUMN id SET DEFAULT nextval('ctgov.documents_id_seq'::regclass); +ALTER TABLE ONLY ctgov_v2.result_agreements + ADD CONSTRAINT result_agreements_pkey PRIMARY KEY (id); -- --- Name: drop_withdrawals id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: result_contacts result_contacts_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER TABLE ONLY ctgov.drop_withdrawals ALTER COLUMN id SET DEFAULT nextval('ctgov.drop_withdrawals_id_seq'::regclass); +ALTER TABLE ONLY ctgov_v2.result_contacts + ADD CONSTRAINT result_contacts_pkey PRIMARY KEY (id); -- --- Name: eligibilities id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: result_groups result_groups_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER TABLE ONLY ctgov.eligibilities ALTER COLUMN id SET DEFAULT nextval('ctgov.eligibilities_id_seq'::regclass); +ALTER TABLE ONLY ctgov_v2.result_groups + ADD CONSTRAINT result_groups_pkey PRIMARY KEY (id); -- --- Name: facilities id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: retractions retractions_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER TABLE ONLY ctgov.facilities ALTER COLUMN id SET DEFAULT nextval('ctgov.facilities_id_seq'::regclass); +ALTER TABLE ONLY ctgov_v2.retractions + ADD CONSTRAINT retractions_pkey PRIMARY KEY (id); -- --- Name: facility_contacts id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: search_results search_results_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER TABLE ONLY ctgov.facility_contacts ALTER COLUMN id SET DEFAULT nextval('ctgov.facility_contacts_id_seq'::regclass); +ALTER TABLE ONLY ctgov_v2.search_results + ADD CONSTRAINT search_results_pkey PRIMARY KEY (id); -- --- Name: facility_investigators id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: sponsors sponsors_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER TABLE ONLY ctgov.facility_investigators ALTER COLUMN id SET DEFAULT nextval('ctgov.facility_investigators_id_seq'::regclass); +ALTER TABLE ONLY ctgov_v2.sponsors + ADD CONSTRAINT sponsors_pkey PRIMARY KEY (id); -- --- Name: id_information id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: study_records study_records_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER TABLE ONLY ctgov.id_information ALTER COLUMN id SET DEFAULT nextval('ctgov.id_information_id_seq'::regclass); +ALTER TABLE ONLY ctgov_v2.study_records + ADD CONSTRAINT study_records_pkey PRIMARY KEY (id); -- --- Name: intervention_other_names id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: study_references study_references_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER TABLE ONLY ctgov.intervention_other_names ALTER COLUMN id SET DEFAULT nextval('ctgov.intervention_other_names_id_seq'::regclass); +ALTER TABLE ONLY ctgov_v2.study_references + ADD CONSTRAINT study_references_pkey PRIMARY KEY (id); -- --- Name: interventions id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: study_searches study_searches_pkey; Type: CONSTRAINT; Schema: ctgov_v2; Owner: - -- -ALTER TABLE ONLY ctgov.interventions ALTER COLUMN id SET DEFAULT nextval('ctgov.interventions_id_seq'::regclass); +ALTER TABLE ONLY ctgov_v2.study_searches + ADD CONSTRAINT study_searches_pkey PRIMARY KEY (id); -- --- Name: ipd_information_types id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: ar_internal_metadata ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY ctgov.ipd_information_types ALTER COLUMN id SET DEFAULT nextval('ctgov.ipd_information_types_id_seq'::regclass); +ALTER TABLE ONLY public.ar_internal_metadata + ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key); -- --- Name: keywords id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY ctgov.keywords ALTER COLUMN id SET DEFAULT nextval('ctgov.keywords_id_seq'::regclass); +ALTER TABLE ONLY public.schema_migrations + ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version); -- --- Name: links id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: active_storage_attachments active_storage_attachments_pkey; Type: CONSTRAINT; Schema: support; Owner: - -- -ALTER TABLE ONLY ctgov.links ALTER COLUMN id SET DEFAULT nextval('ctgov.links_id_seq'::regclass); +ALTER TABLE ONLY support.active_storage_attachments + ADD CONSTRAINT active_storage_attachments_pkey PRIMARY KEY (id); -- --- Name: mesh_headings id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: active_storage_blobs active_storage_blobs_pkey; Type: CONSTRAINT; Schema: support; Owner: - -- -ALTER TABLE ONLY ctgov.mesh_headings ALTER COLUMN id SET DEFAULT nextval('ctgov.mesh_headings_id_seq'::regclass); +ALTER TABLE ONLY support.active_storage_blobs + ADD CONSTRAINT active_storage_blobs_pkey PRIMARY KEY (id); -- --- Name: mesh_terms id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: background_jobs background_jobs_pkey; Type: CONSTRAINT; Schema: support; Owner: - -- -ALTER TABLE ONLY ctgov.mesh_terms ALTER COLUMN id SET DEFAULT nextval('ctgov.mesh_terms_id_seq'::regclass); +ALTER TABLE ONLY support.background_jobs + ADD CONSTRAINT background_jobs_pkey PRIMARY KEY (id); -- --- Name: milestones id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: file_records file_records_pkey; Type: CONSTRAINT; Schema: support; Owner: - -- -ALTER TABLE ONLY ctgov.milestones ALTER COLUMN id SET DEFAULT nextval('ctgov.milestones_id_seq'::regclass); +ALTER TABLE ONLY support.file_records + ADD CONSTRAINT file_records_pkey PRIMARY KEY (id); -- --- Name: outcome_analyses id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: load_events load_events_pkey; Type: CONSTRAINT; Schema: support; Owner: - -- -ALTER TABLE ONLY ctgov.outcome_analyses ALTER COLUMN id SET DEFAULT nextval('ctgov.outcome_analyses_id_seq'::regclass); +ALTER TABLE ONLY support.load_events + ADD CONSTRAINT load_events_pkey PRIMARY KEY (id); -- --- Name: outcome_analysis_groups id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: load_issues load_issues_pkey; Type: CONSTRAINT; Schema: support; Owner: - -- -ALTER TABLE ONLY ctgov.outcome_analysis_groups ALTER COLUMN id SET DEFAULT nextval('ctgov.outcome_analysis_groups_id_seq'::regclass); +ALTER TABLE ONLY support.load_issues + ADD CONSTRAINT load_issues_pkey PRIMARY KEY (id); -- --- Name: outcome_counts id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: sanity_checks sanity_checks_pkey; Type: CONSTRAINT; Schema: support; Owner: - -- -ALTER TABLE ONLY ctgov.outcome_counts ALTER COLUMN id SET DEFAULT nextval('ctgov.outcome_counts_id_seq'::regclass); +ALTER TABLE ONLY support.sanity_checks + ADD CONSTRAINT sanity_checks_pkey PRIMARY KEY (id); -- --- Name: outcome_measurements id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: study_json_records study_json_records_pkey; Type: CONSTRAINT; Schema: support; Owner: - -- -ALTER TABLE ONLY ctgov.outcome_measurements ALTER COLUMN id SET DEFAULT nextval('ctgov.outcome_measurements_id_seq'::regclass); +ALTER TABLE ONLY support.study_json_records + ADD CONSTRAINT study_json_records_pkey PRIMARY KEY (id); -- --- Name: outcomes id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: study_statistics_comparisons study_statistics_comparisons_pkey; Type: CONSTRAINT; Schema: support; Owner: - -- -ALTER TABLE ONLY ctgov.outcomes ALTER COLUMN id SET DEFAULT nextval('ctgov.outcomes_id_seq'::regclass); +ALTER TABLE ONLY support.study_statistics_comparisons + ADD CONSTRAINT study_statistics_comparisons_pkey PRIMARY KEY (id); -- --- Name: overall_officials id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: study_xml_records study_xml_records_pkey; Type: CONSTRAINT; Schema: support; Owner: - -- -ALTER TABLE ONLY ctgov.overall_officials ALTER COLUMN id SET DEFAULT nextval('ctgov.overall_officials_id_seq'::regclass); +ALTER TABLE ONLY support.study_xml_records + ADD CONSTRAINT study_xml_records_pkey PRIMARY KEY (id); -- --- Name: participant_flows id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: verifiers verifiers_pkey; Type: CONSTRAINT; Schema: support; Owner: - -- -ALTER TABLE ONLY ctgov.participant_flows ALTER COLUMN id SET DEFAULT nextval('ctgov.participant_flows_id_seq'::regclass); +ALTER TABLE ONLY support.verifiers + ADD CONSTRAINT verifiers_pkey PRIMARY KEY (id); -- --- Name: pending_results id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: index_baseline_measurements_on_category; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.pending_results ALTER COLUMN id SET DEFAULT nextval('ctgov.pending_results_id_seq'::regclass); +CREATE INDEX index_baseline_measurements_on_category ON ctgov.baseline_measurements USING btree (category); -- --- Name: provided_documents id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: index_baseline_measurements_on_classification; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.provided_documents ALTER COLUMN id SET DEFAULT nextval('ctgov.provided_documents_id_seq'::regclass); +CREATE INDEX index_baseline_measurements_on_classification ON ctgov.baseline_measurements USING btree (classification); -- --- Name: reported_event_totals id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: index_baseline_measurements_on_dispersion_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.reported_event_totals ALTER COLUMN id SET DEFAULT nextval('ctgov.reported_event_totals_id_seq'::regclass); +CREATE INDEX index_baseline_measurements_on_dispersion_type ON ctgov.baseline_measurements USING btree (dispersion_type); -- --- Name: reported_events id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: index_baseline_measurements_on_param_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.reported_events ALTER COLUMN id SET DEFAULT nextval('ctgov.reported_events_id_seq'::regclass); +CREATE INDEX index_baseline_measurements_on_param_type ON ctgov.baseline_measurements USING btree (param_type); -- --- Name: responsible_parties id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: index_browse_conditions_on_downcase_mesh_term; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.responsible_parties ALTER COLUMN id SET DEFAULT nextval('ctgov.responsible_parties_id_seq'::regclass); +CREATE INDEX index_browse_conditions_on_downcase_mesh_term ON ctgov.browse_conditions USING btree (downcase_mesh_term); -- --- Name: result_agreements id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: index_browse_conditions_on_mesh_term; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.result_agreements ALTER COLUMN id SET DEFAULT nextval('ctgov.result_agreements_id_seq'::regclass); +CREATE INDEX index_browse_conditions_on_mesh_term ON ctgov.browse_conditions USING btree (mesh_term); -- --- Name: result_contacts id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: index_browse_conditions_on_nct_id; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.result_contacts ALTER COLUMN id SET DEFAULT nextval('ctgov.result_contacts_id_seq'::regclass); +CREATE INDEX index_browse_conditions_on_nct_id ON ctgov.browse_conditions USING btree (nct_id); -- --- Name: result_groups id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: index_browse_interventions_on_downcase_mesh_term; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.result_groups ALTER COLUMN id SET DEFAULT nextval('ctgov.result_groups_id_seq'::regclass); +CREATE INDEX index_browse_interventions_on_downcase_mesh_term ON ctgov.browse_interventions USING btree (downcase_mesh_term); -- --- Name: retractions id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: index_browse_interventions_on_mesh_term; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.retractions ALTER COLUMN id SET DEFAULT nextval('ctgov.retractions_id_seq'::regclass); +CREATE INDEX index_browse_interventions_on_mesh_term ON ctgov.browse_interventions USING btree (mesh_term); -- --- Name: search_results id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: index_browse_interventions_on_nct_id; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.search_results ALTER COLUMN id SET DEFAULT nextval('ctgov.search_results_id_seq'::regclass); +CREATE INDEX index_browse_interventions_on_nct_id ON ctgov.browse_interventions USING btree (nct_id); -- --- Name: sponsors id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: index_calculated_values_on_actual_duration; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.sponsors ALTER COLUMN id SET DEFAULT nextval('ctgov.sponsors_id_seq'::regclass); +CREATE INDEX index_calculated_values_on_actual_duration ON ctgov.calculated_values USING btree (actual_duration); -- --- Name: study_records id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: index_calculated_values_on_months_to_report_results; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.study_records ALTER COLUMN id SET DEFAULT nextval('ctgov.study_records_id_seq'::regclass); +CREATE INDEX index_calculated_values_on_months_to_report_results ON ctgov.calculated_values USING btree (months_to_report_results); -- --- Name: study_references id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: index_calculated_values_on_number_of_facilities; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.study_references ALTER COLUMN id SET DEFAULT nextval('ctgov.study_references_id_seq'::regclass); +CREATE INDEX index_calculated_values_on_number_of_facilities ON ctgov.calculated_values USING btree (number_of_facilities); -- --- Name: study_searches id; Type: DEFAULT; Schema: ctgov; Owner: - +-- Name: index_central_contacts_on_contact_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.study_searches ALTER COLUMN id SET DEFAULT nextval('ctgov.study_searches_id_seq'::regclass); +CREATE INDEX index_central_contacts_on_contact_type ON ctgov.central_contacts USING btree (contact_type); -- --- Name: active_storage_attachments id; Type: DEFAULT; Schema: support; Owner: - +-- Name: index_conditions_on_downcase_name; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.active_storage_attachments ALTER COLUMN id SET DEFAULT nextval('support.active_storage_attachments_id_seq'::regclass); +CREATE INDEX index_conditions_on_downcase_name ON ctgov.conditions USING btree (downcase_name); -- --- Name: active_storage_blobs id; Type: DEFAULT; Schema: support; Owner: - +-- Name: index_conditions_on_name; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.active_storage_blobs ALTER COLUMN id SET DEFAULT nextval('support.active_storage_blobs_id_seq'::regclass); +CREATE INDEX index_conditions_on_name ON ctgov.conditions USING btree (name); -- --- Name: background_jobs id; Type: DEFAULT; Schema: support; Owner: - +-- Name: index_design_group_interventions_on_design_group_id; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.background_jobs ALTER COLUMN id SET DEFAULT nextval('support.background_jobs_id_seq'::regclass); +CREATE INDEX index_design_group_interventions_on_design_group_id ON ctgov.design_group_interventions USING btree (design_group_id); -- --- Name: file_records id; Type: DEFAULT; Schema: support; Owner: - +-- Name: index_design_group_interventions_on_intervention_id; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.file_records ALTER COLUMN id SET DEFAULT nextval('support.file_records_id_seq'::regclass); +CREATE INDEX index_design_group_interventions_on_intervention_id ON ctgov.design_group_interventions USING btree (intervention_id); -- --- Name: load_events id; Type: DEFAULT; Schema: support; Owner: - +-- Name: index_design_groups_on_group_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.load_events ALTER COLUMN id SET DEFAULT nextval('support.load_events_id_seq'::regclass); +CREATE INDEX index_design_groups_on_group_type ON ctgov.design_groups USING btree (group_type); -- --- Name: load_issues id; Type: DEFAULT; Schema: support; Owner: - +-- Name: index_design_outcomes_on_measure; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.load_issues ALTER COLUMN id SET DEFAULT nextval('support.load_issues_id_seq'::regclass); +CREATE INDEX index_design_outcomes_on_measure ON ctgov.design_outcomes USING btree (measure); -- --- Name: sanity_checks id; Type: DEFAULT; Schema: support; Owner: - +-- Name: index_design_outcomes_on_outcome_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.sanity_checks ALTER COLUMN id SET DEFAULT nextval('support.sanity_checks_id_seq'::regclass); +CREATE INDEX index_design_outcomes_on_outcome_type ON ctgov.design_outcomes USING btree (outcome_type); -- --- Name: study_json_records id; Type: DEFAULT; Schema: support; Owner: - +-- Name: index_designs_on_caregiver_masked; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.study_json_records ALTER COLUMN id SET DEFAULT nextval('support.study_json_records_id_seq'::regclass); +CREATE INDEX index_designs_on_caregiver_masked ON ctgov.designs USING btree (caregiver_masked); -- --- Name: study_statistics_comparisons id; Type: DEFAULT; Schema: support; Owner: - +-- Name: index_designs_on_investigator_masked; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.study_statistics_comparisons ALTER COLUMN id SET DEFAULT nextval('support.study_statistics_comparisons_id_seq'::regclass); +CREATE INDEX index_designs_on_investigator_masked ON ctgov.designs USING btree (investigator_masked); -- --- Name: study_xml_records id; Type: DEFAULT; Schema: support; Owner: - +-- Name: index_designs_on_masking; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.study_xml_records ALTER COLUMN id SET DEFAULT nextval('support.study_xml_records_id_seq'::regclass); +CREATE INDEX index_designs_on_masking ON ctgov.designs USING btree (masking); -- --- Name: verifiers id; Type: DEFAULT; Schema: support; Owner: - +-- Name: index_designs_on_outcomes_assessor_masked; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.verifiers ALTER COLUMN id SET DEFAULT nextval('support.verifiers_id_seq'::regclass); +CREATE INDEX index_designs_on_outcomes_assessor_masked ON ctgov.designs USING btree (outcomes_assessor_masked); -- --- Name: baseline_counts baseline_counts_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_designs_on_subject_masked; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.baseline_counts - ADD CONSTRAINT baseline_counts_pkey PRIMARY KEY (id); +CREATE INDEX index_designs_on_subject_masked ON ctgov.designs USING btree (subject_masked); -- --- Name: baseline_measurements baseline_measurements_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_documents_on_document_id; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.baseline_measurements - ADD CONSTRAINT baseline_measurements_pkey PRIMARY KEY (id); +CREATE INDEX index_documents_on_document_id ON ctgov.documents USING btree (document_id); -- --- Name: brief_summaries brief_summaries_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_documents_on_document_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.brief_summaries - ADD CONSTRAINT brief_summaries_pkey PRIMARY KEY (id); +CREATE INDEX index_documents_on_document_type ON ctgov.documents USING btree (document_type); -- --- Name: browse_conditions browse_conditions_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_drop_withdrawals_on_period; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.browse_conditions - ADD CONSTRAINT browse_conditions_pkey PRIMARY KEY (id); +CREATE INDEX index_drop_withdrawals_on_period ON ctgov.drop_withdrawals USING btree (period); -- --- Name: browse_interventions browse_interventions_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_eligibilities_on_gender; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.browse_interventions - ADD CONSTRAINT browse_interventions_pkey PRIMARY KEY (id); +CREATE INDEX index_eligibilities_on_gender ON ctgov.eligibilities USING btree (gender); -- --- Name: calculated_values calculated_values_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_eligibilities_on_healthy_volunteers; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.calculated_values - ADD CONSTRAINT calculated_values_pkey PRIMARY KEY (id); +CREATE INDEX index_eligibilities_on_healthy_volunteers ON ctgov.eligibilities USING btree (healthy_volunteers); -- --- Name: central_contacts central_contacts_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_eligibilities_on_maximum_age; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.central_contacts - ADD CONSTRAINT central_contacts_pkey PRIMARY KEY (id); +CREATE INDEX index_eligibilities_on_maximum_age ON ctgov.eligibilities USING btree (maximum_age); -- --- Name: conditions conditions_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_eligibilities_on_minimum_age; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.conditions - ADD CONSTRAINT conditions_pkey PRIMARY KEY (id); +CREATE INDEX index_eligibilities_on_minimum_age ON ctgov.eligibilities USING btree (minimum_age); -- --- Name: countries countries_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_facilities_on_city; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.countries - ADD CONSTRAINT countries_pkey PRIMARY KEY (id); +CREATE INDEX index_facilities_on_city ON ctgov.facilities USING btree (city); -- --- Name: design_group_interventions design_group_interventions_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_facilities_on_country; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.design_group_interventions - ADD CONSTRAINT design_group_interventions_pkey PRIMARY KEY (id); +CREATE INDEX index_facilities_on_country ON ctgov.facilities USING btree (country); -- --- Name: design_groups design_groups_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_facilities_on_name; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.design_groups - ADD CONSTRAINT design_groups_pkey PRIMARY KEY (id); +CREATE INDEX index_facilities_on_name ON ctgov.facilities USING btree (name); -- --- Name: design_outcomes design_outcomes_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_facilities_on_state; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.design_outcomes - ADD CONSTRAINT design_outcomes_pkey PRIMARY KEY (id); +CREATE INDEX index_facilities_on_state ON ctgov.facilities USING btree (state); -- --- Name: designs designs_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_facilities_on_status; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.designs - ADD CONSTRAINT designs_pkey PRIMARY KEY (id); +CREATE INDEX index_facilities_on_status ON ctgov.facilities USING btree (status); -- --- Name: detailed_descriptions detailed_descriptions_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_facility_contacts_on_contact_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.detailed_descriptions - ADD CONSTRAINT detailed_descriptions_pkey PRIMARY KEY (id); +CREATE INDEX index_facility_contacts_on_contact_type ON ctgov.facility_contacts USING btree (contact_type); -- --- Name: documents documents_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_id_information_on_id_source; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.documents - ADD CONSTRAINT documents_pkey PRIMARY KEY (id); +CREATE INDEX index_id_information_on_id_source ON ctgov.id_information USING btree (id_source); -- --- Name: drop_withdrawals drop_withdrawals_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_interventions_on_intervention_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.drop_withdrawals - ADD CONSTRAINT drop_withdrawals_pkey PRIMARY KEY (id); +CREATE INDEX index_interventions_on_intervention_type ON ctgov.interventions USING btree (intervention_type); -- --- Name: eligibilities eligibilities_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_keywords_on_downcase_name; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.eligibilities - ADD CONSTRAINT eligibilities_pkey PRIMARY KEY (id); +CREATE INDEX index_keywords_on_downcase_name ON ctgov.keywords USING btree (downcase_name); -- --- Name: facilities facilities_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_keywords_on_name; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.facilities - ADD CONSTRAINT facilities_pkey PRIMARY KEY (id); +CREATE INDEX index_keywords_on_name ON ctgov.keywords USING btree (name); -- --- Name: facility_contacts facility_contacts_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_mesh_headings_on_qualifier; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.facility_contacts - ADD CONSTRAINT facility_contacts_pkey PRIMARY KEY (id); +CREATE INDEX index_mesh_headings_on_qualifier ON ctgov.mesh_headings USING btree (qualifier); -- --- Name: facility_investigators facility_investigators_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_mesh_terms_on_description; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.facility_investigators - ADD CONSTRAINT facility_investigators_pkey PRIMARY KEY (id); +CREATE INDEX index_mesh_terms_on_description ON ctgov.mesh_terms USING btree (description); -- --- Name: id_information id_information_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_mesh_terms_on_downcase_mesh_term; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.id_information - ADD CONSTRAINT id_information_pkey PRIMARY KEY (id); +CREATE INDEX index_mesh_terms_on_downcase_mesh_term ON ctgov.mesh_terms USING btree (downcase_mesh_term); -- --- Name: intervention_other_names intervention_other_names_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_mesh_terms_on_mesh_term; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.intervention_other_names - ADD CONSTRAINT intervention_other_names_pkey PRIMARY KEY (id); +CREATE INDEX index_mesh_terms_on_mesh_term ON ctgov.mesh_terms USING btree (mesh_term); -- --- Name: interventions interventions_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_mesh_terms_on_qualifier; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.interventions - ADD CONSTRAINT interventions_pkey PRIMARY KEY (id); +CREATE INDEX index_mesh_terms_on_qualifier ON ctgov.mesh_terms USING btree (qualifier); -- --- Name: ipd_information_types ipd_information_types_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_milestones_on_period; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.ipd_information_types - ADD CONSTRAINT ipd_information_types_pkey PRIMARY KEY (id); +CREATE INDEX index_milestones_on_period ON ctgov.milestones USING btree (period); -- --- Name: keywords keywords_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_outcome_analyses_on_dispersion_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.keywords - ADD CONSTRAINT keywords_pkey PRIMARY KEY (id); +CREATE INDEX index_outcome_analyses_on_dispersion_type ON ctgov.outcome_analyses USING btree (dispersion_type); -- --- Name: links links_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_outcome_analyses_on_param_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.links - ADD CONSTRAINT links_pkey PRIMARY KEY (id); +CREATE INDEX index_outcome_analyses_on_param_type ON ctgov.outcome_analyses USING btree (param_type); -- --- Name: mesh_headings mesh_headings_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_outcome_measurements_on_category; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.mesh_headings - ADD CONSTRAINT mesh_headings_pkey PRIMARY KEY (id); +CREATE INDEX index_outcome_measurements_on_category ON ctgov.outcome_measurements USING btree (category); -- --- Name: mesh_terms mesh_terms_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_outcome_measurements_on_classification; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.mesh_terms - ADD CONSTRAINT mesh_terms_pkey PRIMARY KEY (id); +CREATE INDEX index_outcome_measurements_on_classification ON ctgov.outcome_measurements USING btree (classification); -- --- Name: milestones milestones_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_outcome_measurements_on_dispersion_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.milestones - ADD CONSTRAINT milestones_pkey PRIMARY KEY (id); +CREATE INDEX index_outcome_measurements_on_dispersion_type ON ctgov.outcome_measurements USING btree (dispersion_type); -- --- Name: outcome_analyses outcome_analyses_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_outcomes_on_dispersion_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.outcome_analyses - ADD CONSTRAINT outcome_analyses_pkey PRIMARY KEY (id); +CREATE INDEX index_outcomes_on_dispersion_type ON ctgov.outcomes USING btree (dispersion_type); -- --- Name: outcome_analysis_groups outcome_analysis_groups_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_outcomes_on_param_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.outcome_analysis_groups - ADD CONSTRAINT outcome_analysis_groups_pkey PRIMARY KEY (id); +CREATE INDEX index_outcomes_on_param_type ON ctgov.outcomes USING btree (param_type); -- --- Name: outcome_counts outcome_counts_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_overall_officials_on_affiliation; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.outcome_counts - ADD CONSTRAINT outcome_counts_pkey PRIMARY KEY (id); +CREATE INDEX index_overall_officials_on_affiliation ON ctgov.overall_officials USING btree (affiliation); -- --- Name: outcome_measurements outcome_measurements_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_overall_officials_on_nct_id; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.outcome_measurements - ADD CONSTRAINT outcome_measurements_pkey PRIMARY KEY (id); +CREATE INDEX index_overall_officials_on_nct_id ON ctgov.overall_officials USING btree (nct_id); -- --- Name: outcomes outcomes_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_reported_events_on_event_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.outcomes - ADD CONSTRAINT outcomes_pkey PRIMARY KEY (id); +CREATE INDEX index_reported_events_on_event_type ON ctgov.reported_events USING btree (event_type); -- --- Name: overall_officials overall_officials_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_reported_events_on_subjects_affected; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.overall_officials - ADD CONSTRAINT overall_officials_pkey PRIMARY KEY (id); +CREATE INDEX index_reported_events_on_subjects_affected ON ctgov.reported_events USING btree (subjects_affected); -- --- Name: participant_flows participant_flows_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_responsible_parties_on_nct_id; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.participant_flows - ADD CONSTRAINT participant_flows_pkey PRIMARY KEY (id); +CREATE INDEX index_responsible_parties_on_nct_id ON ctgov.responsible_parties USING btree (nct_id); -- --- Name: pending_results pending_results_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_responsible_parties_on_organization; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.pending_results - ADD CONSTRAINT pending_results_pkey PRIMARY KEY (id); +CREATE INDEX index_responsible_parties_on_organization ON ctgov.responsible_parties USING btree (organization); -- --- Name: provided_documents provided_documents_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_responsible_parties_on_responsible_party_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.provided_documents - ADD CONSTRAINT provided_documents_pkey PRIMARY KEY (id); +CREATE INDEX index_responsible_parties_on_responsible_party_type ON ctgov.responsible_parties USING btree (responsible_party_type); -- --- Name: reported_event_totals reported_event_totals_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_result_contacts_on_organization; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.reported_event_totals - ADD CONSTRAINT reported_event_totals_pkey PRIMARY KEY (id); +CREATE INDEX index_result_contacts_on_organization ON ctgov.result_contacts USING btree (organization); -- --- Name: reported_events reported_events_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_result_groups_on_result_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.reported_events - ADD CONSTRAINT reported_events_pkey PRIMARY KEY (id); +CREATE INDEX index_result_groups_on_result_type ON ctgov.result_groups USING btree (result_type); -- --- Name: responsible_parties responsible_parties_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_search_results_on_nct_id_and_name; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.responsible_parties - ADD CONSTRAINT responsible_parties_pkey PRIMARY KEY (id); +CREATE UNIQUE INDEX index_search_results_on_nct_id_and_name ON ctgov.search_results USING btree (nct_id, name); -- --- Name: result_agreements result_agreements_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_search_results_on_nct_id_and_name_and_grouping; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.result_agreements - ADD CONSTRAINT result_agreements_pkey PRIMARY KEY (id); +CREATE UNIQUE INDEX index_search_results_on_nct_id_and_name_and_grouping ON ctgov.search_results USING btree (nct_id, name, "grouping"); -- --- Name: result_contacts result_contacts_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_sponsors_on_agency_class; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.result_contacts - ADD CONSTRAINT result_contacts_pkey PRIMARY KEY (id); +CREATE INDEX index_sponsors_on_agency_class ON ctgov.sponsors USING btree (agency_class); -- --- Name: result_groups result_groups_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_sponsors_on_name; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.result_groups - ADD CONSTRAINT result_groups_pkey PRIMARY KEY (id); +CREATE INDEX index_sponsors_on_name ON ctgov.sponsors USING btree (name); -- --- Name: retractions retractions_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_studies_on_completion_date; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.retractions - ADD CONSTRAINT retractions_pkey PRIMARY KEY (id); +CREATE INDEX index_studies_on_completion_date ON ctgov.studies USING btree (completion_date); -- --- Name: search_results search_results_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_studies_on_disposition_first_submitted_date; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.search_results - ADD CONSTRAINT search_results_pkey PRIMARY KEY (id); +CREATE INDEX index_studies_on_disposition_first_submitted_date ON ctgov.studies USING btree (disposition_first_submitted_date); -- --- Name: sponsors sponsors_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_studies_on_enrollment_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.sponsors - ADD CONSTRAINT sponsors_pkey PRIMARY KEY (id); +CREATE INDEX index_studies_on_enrollment_type ON ctgov.studies USING btree (enrollment_type); -- --- Name: study_records study_records_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_studies_on_last_known_status; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.study_records - ADD CONSTRAINT study_records_pkey PRIMARY KEY (id); +CREATE INDEX index_studies_on_last_known_status ON ctgov.studies USING btree (last_known_status); -- --- Name: study_references study_references_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_studies_on_last_update_submitted_date; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.study_references - ADD CONSTRAINT study_references_pkey PRIMARY KEY (id); +CREATE INDEX index_studies_on_last_update_submitted_date ON ctgov.studies USING btree (last_update_submitted_date); -- --- Name: study_searches study_searches_pkey; Type: CONSTRAINT; Schema: ctgov; Owner: - +-- Name: index_studies_on_nct_id; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY ctgov.study_searches - ADD CONSTRAINT study_searches_pkey PRIMARY KEY (id); +CREATE UNIQUE INDEX index_studies_on_nct_id ON ctgov.studies USING btree (nct_id); -- --- Name: ar_internal_metadata ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: index_studies_on_overall_status; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY public.ar_internal_metadata - ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key); +CREATE INDEX index_studies_on_overall_status ON ctgov.studies USING btree (overall_status); -- --- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: index_studies_on_phase; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY public.schema_migrations - ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version); +CREATE INDEX index_studies_on_phase ON ctgov.studies USING btree (phase); -- --- Name: active_storage_attachments active_storage_attachments_pkey; Type: CONSTRAINT; Schema: support; Owner: - +-- Name: index_studies_on_primary_completion_date; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.active_storage_attachments - ADD CONSTRAINT active_storage_attachments_pkey PRIMARY KEY (id); +CREATE INDEX index_studies_on_primary_completion_date ON ctgov.studies USING btree (primary_completion_date); -- --- Name: active_storage_blobs active_storage_blobs_pkey; Type: CONSTRAINT; Schema: support; Owner: - +-- Name: index_studies_on_primary_completion_date_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.active_storage_blobs - ADD CONSTRAINT active_storage_blobs_pkey PRIMARY KEY (id); +CREATE INDEX index_studies_on_primary_completion_date_type ON ctgov.studies USING btree (primary_completion_date_type); -- --- Name: background_jobs background_jobs_pkey; Type: CONSTRAINT; Schema: support; Owner: - +-- Name: index_studies_on_results_first_submitted_date; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.background_jobs - ADD CONSTRAINT background_jobs_pkey PRIMARY KEY (id); +CREATE INDEX index_studies_on_results_first_submitted_date ON ctgov.studies USING btree (results_first_submitted_date); -- --- Name: file_records file_records_pkey; Type: CONSTRAINT; Schema: support; Owner: - +-- Name: index_studies_on_source; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.file_records - ADD CONSTRAINT file_records_pkey PRIMARY KEY (id); +CREATE INDEX index_studies_on_source ON ctgov.studies USING btree (source); -- --- Name: load_events load_events_pkey; Type: CONSTRAINT; Schema: support; Owner: - +-- Name: index_studies_on_start_date; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.load_events - ADD CONSTRAINT load_events_pkey PRIMARY KEY (id); +CREATE INDEX index_studies_on_start_date ON ctgov.studies USING btree (start_date); -- --- Name: load_issues load_issues_pkey; Type: CONSTRAINT; Schema: support; Owner: - +-- Name: index_studies_on_start_date_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.load_issues - ADD CONSTRAINT load_issues_pkey PRIMARY KEY (id); +CREATE INDEX index_studies_on_start_date_type ON ctgov.studies USING btree (start_date_type); -- --- Name: sanity_checks sanity_checks_pkey; Type: CONSTRAINT; Schema: support; Owner: - +-- Name: index_studies_on_study_first_submitted_date; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.sanity_checks - ADD CONSTRAINT sanity_checks_pkey PRIMARY KEY (id); +CREATE INDEX index_studies_on_study_first_submitted_date ON ctgov.studies USING btree (study_first_submitted_date); -- --- Name: study_json_records study_json_records_pkey; Type: CONSTRAINT; Schema: support; Owner: - +-- Name: index_studies_on_study_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.study_json_records - ADD CONSTRAINT study_json_records_pkey PRIMARY KEY (id); +CREATE INDEX index_studies_on_study_type ON ctgov.studies USING btree (study_type); -- --- Name: study_statistics_comparisons study_statistics_comparisons_pkey; Type: CONSTRAINT; Schema: support; Owner: - +-- Name: index_study_records_on_nct_id_and_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.study_statistics_comparisons - ADD CONSTRAINT study_statistics_comparisons_pkey PRIMARY KEY (id); +CREATE UNIQUE INDEX index_study_records_on_nct_id_and_type ON ctgov.study_records USING btree (nct_id, type); -- --- Name: study_xml_records study_xml_records_pkey; Type: CONSTRAINT; Schema: support; Owner: - +-- Name: index_study_references_on_reference_type; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.study_xml_records - ADD CONSTRAINT study_xml_records_pkey PRIMARY KEY (id); +CREATE INDEX index_study_references_on_reference_type ON ctgov.study_references USING btree (reference_type); -- --- Name: verifiers verifiers_pkey; Type: CONSTRAINT; Schema: support; Owner: - +-- Name: index_study_searches_on_query_and_grouping; Type: INDEX; Schema: ctgov; Owner: - -- -ALTER TABLE ONLY support.verifiers - ADD CONSTRAINT verifiers_pkey PRIMARY KEY (id); +CREATE UNIQUE INDEX index_study_searches_on_query_and_grouping ON ctgov.study_searches USING btree (query, "grouping"); -- --- Name: index_baseline_measurements_on_category; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_baseline_measurements_on_category; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_baseline_measurements_on_category ON ctgov.baseline_measurements USING btree (category); +CREATE INDEX index_baseline_measurements_on_category ON ctgov_v2.baseline_measurements USING btree (category); -- --- Name: index_baseline_measurements_on_classification; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_baseline_measurements_on_classification; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_baseline_measurements_on_classification ON ctgov.baseline_measurements USING btree (classification); +CREATE INDEX index_baseline_measurements_on_classification ON ctgov_v2.baseline_measurements USING btree (classification); -- --- Name: index_baseline_measurements_on_dispersion_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_baseline_measurements_on_dispersion_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_baseline_measurements_on_dispersion_type ON ctgov.baseline_measurements USING btree (dispersion_type); +CREATE INDEX index_baseline_measurements_on_dispersion_type ON ctgov_v2.baseline_measurements USING btree (dispersion_type); -- --- Name: index_baseline_measurements_on_param_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_baseline_measurements_on_param_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_baseline_measurements_on_param_type ON ctgov.baseline_measurements USING btree (param_type); +CREATE INDEX index_baseline_measurements_on_param_type ON ctgov_v2.baseline_measurements USING btree (param_type); -- --- Name: index_browse_conditions_on_downcase_mesh_term; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_browse_conditions_on_downcase_mesh_term; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_browse_conditions_on_downcase_mesh_term ON ctgov.browse_conditions USING btree (downcase_mesh_term); +CREATE INDEX index_browse_conditions_on_downcase_mesh_term ON ctgov_v2.browse_conditions USING btree (downcase_mesh_term); -- --- Name: index_browse_conditions_on_mesh_term; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_browse_conditions_on_mesh_term; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_browse_conditions_on_mesh_term ON ctgov.browse_conditions USING btree (mesh_term); +CREATE INDEX index_browse_conditions_on_mesh_term ON ctgov_v2.browse_conditions USING btree (mesh_term); -- --- Name: index_browse_conditions_on_nct_id; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_browse_conditions_on_nct_id; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_browse_conditions_on_nct_id ON ctgov.browse_conditions USING btree (nct_id); +CREATE INDEX index_browse_conditions_on_nct_id ON ctgov_v2.browse_conditions USING btree (nct_id); -- --- Name: index_browse_interventions_on_downcase_mesh_term; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_browse_interventions_on_downcase_mesh_term; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_browse_interventions_on_downcase_mesh_term ON ctgov.browse_interventions USING btree (downcase_mesh_term); +CREATE INDEX index_browse_interventions_on_downcase_mesh_term ON ctgov_v2.browse_interventions USING btree (downcase_mesh_term); -- --- Name: index_browse_interventions_on_mesh_term; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_browse_interventions_on_mesh_term; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_browse_interventions_on_mesh_term ON ctgov.browse_interventions USING btree (mesh_term); +CREATE INDEX index_browse_interventions_on_mesh_term ON ctgov_v2.browse_interventions USING btree (mesh_term); -- --- Name: index_browse_interventions_on_nct_id; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_browse_interventions_on_nct_id; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_browse_interventions_on_nct_id ON ctgov.browse_interventions USING btree (nct_id); +CREATE INDEX index_browse_interventions_on_nct_id ON ctgov_v2.browse_interventions USING btree (nct_id); -- --- Name: index_calculated_values_on_actual_duration; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_calculated_values_on_actual_duration; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_calculated_values_on_actual_duration ON ctgov.calculated_values USING btree (actual_duration); +CREATE INDEX index_calculated_values_on_actual_duration ON ctgov_v2.calculated_values USING btree (actual_duration); -- --- Name: index_calculated_values_on_months_to_report_results; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_calculated_values_on_months_to_report_results; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_calculated_values_on_months_to_report_results ON ctgov.calculated_values USING btree (months_to_report_results); +CREATE INDEX index_calculated_values_on_months_to_report_results ON ctgov_v2.calculated_values USING btree (months_to_report_results); -- --- Name: index_calculated_values_on_number_of_facilities; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_calculated_values_on_number_of_facilities; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_calculated_values_on_number_of_facilities ON ctgov.calculated_values USING btree (number_of_facilities); +CREATE INDEX index_calculated_values_on_number_of_facilities ON ctgov_v2.calculated_values USING btree (number_of_facilities); -- --- Name: index_central_contacts_on_contact_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_central_contacts_on_contact_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_central_contacts_on_contact_type ON ctgov.central_contacts USING btree (contact_type); +CREATE INDEX index_central_contacts_on_contact_type ON ctgov_v2.central_contacts USING btree (contact_type); -- --- Name: index_conditions_on_downcase_name; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_conditions_on_downcase_name; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_conditions_on_downcase_name ON ctgov.conditions USING btree (downcase_name); +CREATE INDEX index_conditions_on_downcase_name ON ctgov_v2.conditions USING btree (downcase_name); -- --- Name: index_conditions_on_name; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_conditions_on_name; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_conditions_on_name ON ctgov.conditions USING btree (name); +CREATE INDEX index_conditions_on_name ON ctgov_v2.conditions USING btree (name); -- --- Name: index_design_group_interventions_on_design_group_id; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_design_group_interventions_on_design_group_id; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_design_group_interventions_on_design_group_id ON ctgov.design_group_interventions USING btree (design_group_id); +CREATE INDEX index_design_group_interventions_on_design_group_id ON ctgov_v2.design_group_interventions USING btree (design_group_id); -- --- Name: index_design_group_interventions_on_intervention_id; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_design_group_interventions_on_intervention_id; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_design_group_interventions_on_intervention_id ON ctgov.design_group_interventions USING btree (intervention_id); +CREATE INDEX index_design_group_interventions_on_intervention_id ON ctgov_v2.design_group_interventions USING btree (intervention_id); -- --- Name: index_design_groups_on_group_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_design_groups_on_group_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_design_groups_on_group_type ON ctgov.design_groups USING btree (group_type); +CREATE INDEX index_design_groups_on_group_type ON ctgov_v2.design_groups USING btree (group_type); -- --- Name: index_design_outcomes_on_measure; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_design_outcomes_on_measure; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_design_outcomes_on_measure ON ctgov.design_outcomes USING btree (measure); +CREATE INDEX index_design_outcomes_on_measure ON ctgov_v2.design_outcomes USING btree (measure); -- --- Name: index_design_outcomes_on_outcome_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_design_outcomes_on_outcome_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_design_outcomes_on_outcome_type ON ctgov.design_outcomes USING btree (outcome_type); +CREATE INDEX index_design_outcomes_on_outcome_type ON ctgov_v2.design_outcomes USING btree (outcome_type); -- --- Name: index_designs_on_caregiver_masked; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_designs_on_caregiver_masked; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_designs_on_caregiver_masked ON ctgov.designs USING btree (caregiver_masked); +CREATE INDEX index_designs_on_caregiver_masked ON ctgov_v2.designs USING btree (caregiver_masked); -- --- Name: index_designs_on_investigator_masked; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_designs_on_investigator_masked; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_designs_on_investigator_masked ON ctgov.designs USING btree (investigator_masked); +CREATE INDEX index_designs_on_investigator_masked ON ctgov_v2.designs USING btree (investigator_masked); -- --- Name: index_designs_on_masking; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_designs_on_masking; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_designs_on_masking ON ctgov.designs USING btree (masking); +CREATE INDEX index_designs_on_masking ON ctgov_v2.designs USING btree (masking); -- --- Name: index_designs_on_outcomes_assessor_masked; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_designs_on_outcomes_assessor_masked; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_designs_on_outcomes_assessor_masked ON ctgov.designs USING btree (outcomes_assessor_masked); +CREATE INDEX index_designs_on_outcomes_assessor_masked ON ctgov_v2.designs USING btree (outcomes_assessor_masked); -- --- Name: index_designs_on_subject_masked; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_designs_on_subject_masked; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_designs_on_subject_masked ON ctgov.designs USING btree (subject_masked); +CREATE INDEX index_designs_on_subject_masked ON ctgov_v2.designs USING btree (subject_masked); -- --- Name: index_documents_on_document_id; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_documents_on_document_id; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_documents_on_document_id ON ctgov.documents USING btree (document_id); +CREATE INDEX index_documents_on_document_id ON ctgov_v2.documents USING btree (document_id); -- --- Name: index_documents_on_document_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_documents_on_document_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_documents_on_document_type ON ctgov.documents USING btree (document_type); +CREATE INDEX index_documents_on_document_type ON ctgov_v2.documents USING btree (document_type); -- --- Name: index_drop_withdrawals_on_period; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_drop_withdrawals_on_period; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_drop_withdrawals_on_period ON ctgov.drop_withdrawals USING btree (period); +CREATE INDEX index_drop_withdrawals_on_period ON ctgov_v2.drop_withdrawals USING btree (period); -- --- Name: index_eligibilities_on_gender; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_eligibilities_on_gender; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_eligibilities_on_gender ON ctgov.eligibilities USING btree (gender); +CREATE INDEX index_eligibilities_on_gender ON ctgov_v2.eligibilities USING btree (gender); -- --- Name: index_eligibilities_on_healthy_volunteers; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_eligibilities_on_healthy_volunteers; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_eligibilities_on_healthy_volunteers ON ctgov.eligibilities USING btree (healthy_volunteers); +CREATE INDEX index_eligibilities_on_healthy_volunteers ON ctgov_v2.eligibilities USING btree (healthy_volunteers); -- --- Name: index_eligibilities_on_maximum_age; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_eligibilities_on_maximum_age; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_eligibilities_on_maximum_age ON ctgov.eligibilities USING btree (maximum_age); +CREATE INDEX index_eligibilities_on_maximum_age ON ctgov_v2.eligibilities USING btree (maximum_age); -- --- Name: index_eligibilities_on_minimum_age; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_eligibilities_on_minimum_age; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_eligibilities_on_minimum_age ON ctgov.eligibilities USING btree (minimum_age); +CREATE INDEX index_eligibilities_on_minimum_age ON ctgov_v2.eligibilities USING btree (minimum_age); -- --- Name: index_facilities_on_city; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_facilities_on_city; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_facilities_on_city ON ctgov.facilities USING btree (city); +CREATE INDEX index_facilities_on_city ON ctgov_v2.facilities USING btree (city); -- --- Name: index_facilities_on_country; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_facilities_on_country; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_facilities_on_country ON ctgov.facilities USING btree (country); +CREATE INDEX index_facilities_on_country ON ctgov_v2.facilities USING btree (country); -- --- Name: index_facilities_on_name; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_facilities_on_name; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_facilities_on_name ON ctgov.facilities USING btree (name); +CREATE INDEX index_facilities_on_name ON ctgov_v2.facilities USING btree (name); -- --- Name: index_facilities_on_state; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_facilities_on_state; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_facilities_on_state ON ctgov.facilities USING btree (state); +CREATE INDEX index_facilities_on_state ON ctgov_v2.facilities USING btree (state); -- --- Name: index_facilities_on_status; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_facilities_on_status; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_facilities_on_status ON ctgov.facilities USING btree (status); +CREATE INDEX index_facilities_on_status ON ctgov_v2.facilities USING btree (status); -- --- Name: index_facility_contacts_on_contact_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_facility_contacts_on_contact_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_facility_contacts_on_contact_type ON ctgov.facility_contacts USING btree (contact_type); +CREATE INDEX index_facility_contacts_on_contact_type ON ctgov_v2.facility_contacts USING btree (contact_type); -- --- Name: index_id_information_on_id_source; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_id_information_on_id_source; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_id_information_on_id_source ON ctgov.id_information USING btree (id_source); +CREATE INDEX index_id_information_on_id_source ON ctgov_v2.id_information USING btree (id_source); -- --- Name: index_interventions_on_intervention_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_interventions_on_intervention_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_interventions_on_intervention_type ON ctgov.interventions USING btree (intervention_type); +CREATE INDEX index_interventions_on_intervention_type ON ctgov_v2.interventions USING btree (intervention_type); -- --- Name: index_keywords_on_downcase_name; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_keywords_on_downcase_name; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_keywords_on_downcase_name ON ctgov.keywords USING btree (downcase_name); +CREATE INDEX index_keywords_on_downcase_name ON ctgov_v2.keywords USING btree (downcase_name); -- --- Name: index_keywords_on_name; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_keywords_on_name; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_keywords_on_name ON ctgov.keywords USING btree (name); +CREATE INDEX index_keywords_on_name ON ctgov_v2.keywords USING btree (name); -- --- Name: index_mesh_headings_on_qualifier; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_mesh_headings_on_qualifier; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_mesh_headings_on_qualifier ON ctgov.mesh_headings USING btree (qualifier); +CREATE INDEX index_mesh_headings_on_qualifier ON ctgov_v2.mesh_headings USING btree (qualifier); -- --- Name: index_mesh_terms_on_description; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_mesh_terms_on_description; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_mesh_terms_on_description ON ctgov.mesh_terms USING btree (description); +CREATE INDEX index_mesh_terms_on_description ON ctgov_v2.mesh_terms USING btree (description); -- --- Name: index_mesh_terms_on_downcase_mesh_term; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_mesh_terms_on_downcase_mesh_term; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_mesh_terms_on_downcase_mesh_term ON ctgov.mesh_terms USING btree (downcase_mesh_term); +CREATE INDEX index_mesh_terms_on_downcase_mesh_term ON ctgov_v2.mesh_terms USING btree (downcase_mesh_term); -- --- Name: index_mesh_terms_on_mesh_term; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_mesh_terms_on_mesh_term; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_mesh_terms_on_mesh_term ON ctgov.mesh_terms USING btree (mesh_term); +CREATE INDEX index_mesh_terms_on_mesh_term ON ctgov_v2.mesh_terms USING btree (mesh_term); -- --- Name: index_mesh_terms_on_qualifier; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_mesh_terms_on_qualifier; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_mesh_terms_on_qualifier ON ctgov.mesh_terms USING btree (qualifier); +CREATE INDEX index_mesh_terms_on_qualifier ON ctgov_v2.mesh_terms USING btree (qualifier); -- --- Name: index_milestones_on_period; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_milestones_on_period; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_milestones_on_period ON ctgov.milestones USING btree (period); +CREATE INDEX index_milestones_on_period ON ctgov_v2.milestones USING btree (period); -- --- Name: index_outcome_analyses_on_dispersion_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_outcome_analyses_on_dispersion_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_outcome_analyses_on_dispersion_type ON ctgov.outcome_analyses USING btree (dispersion_type); +CREATE INDEX index_outcome_analyses_on_dispersion_type ON ctgov_v2.outcome_analyses USING btree (dispersion_type); -- --- Name: index_outcome_analyses_on_param_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_outcome_analyses_on_param_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_outcome_analyses_on_param_type ON ctgov.outcome_analyses USING btree (param_type); +CREATE INDEX index_outcome_analyses_on_param_type ON ctgov_v2.outcome_analyses USING btree (param_type); -- --- Name: index_outcome_measurements_on_category; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_outcome_measurements_on_category; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_outcome_measurements_on_category ON ctgov.outcome_measurements USING btree (category); +CREATE INDEX index_outcome_measurements_on_category ON ctgov_v2.outcome_measurements USING btree (category); -- --- Name: index_outcome_measurements_on_classification; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_outcome_measurements_on_classification; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_outcome_measurements_on_classification ON ctgov.outcome_measurements USING btree (classification); +CREATE INDEX index_outcome_measurements_on_classification ON ctgov_v2.outcome_measurements USING btree (classification); -- --- Name: index_outcome_measurements_on_dispersion_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_outcome_measurements_on_dispersion_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_outcome_measurements_on_dispersion_type ON ctgov.outcome_measurements USING btree (dispersion_type); +CREATE INDEX index_outcome_measurements_on_dispersion_type ON ctgov_v2.outcome_measurements USING btree (dispersion_type); -- --- Name: index_outcomes_on_dispersion_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_outcomes_on_dispersion_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_outcomes_on_dispersion_type ON ctgov.outcomes USING btree (dispersion_type); +CREATE INDEX index_outcomes_on_dispersion_type ON ctgov_v2.outcomes USING btree (dispersion_type); -- --- Name: index_outcomes_on_param_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_outcomes_on_param_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_outcomes_on_param_type ON ctgov.outcomes USING btree (param_type); +CREATE INDEX index_outcomes_on_param_type ON ctgov_v2.outcomes USING btree (param_type); -- --- Name: index_overall_officials_on_affiliation; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_overall_officials_on_affiliation; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_overall_officials_on_affiliation ON ctgov.overall_officials USING btree (affiliation); +CREATE INDEX index_overall_officials_on_affiliation ON ctgov_v2.overall_officials USING btree (affiliation); -- --- Name: index_overall_officials_on_nct_id; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_overall_officials_on_nct_id; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_overall_officials_on_nct_id ON ctgov.overall_officials USING btree (nct_id); +CREATE INDEX index_overall_officials_on_nct_id ON ctgov_v2.overall_officials USING btree (nct_id); -- --- Name: index_reported_events_on_event_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_reported_events_on_event_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_reported_events_on_event_type ON ctgov.reported_events USING btree (event_type); +CREATE INDEX index_reported_events_on_event_type ON ctgov_v2.reported_events USING btree (event_type); -- --- Name: index_reported_events_on_subjects_affected; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_reported_events_on_subjects_affected; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_reported_events_on_subjects_affected ON ctgov.reported_events USING btree (subjects_affected); +CREATE INDEX index_reported_events_on_subjects_affected ON ctgov_v2.reported_events USING btree (subjects_affected); -- --- Name: index_responsible_parties_on_nct_id; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_responsible_parties_on_nct_id; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_responsible_parties_on_nct_id ON ctgov.responsible_parties USING btree (nct_id); +CREATE INDEX index_responsible_parties_on_nct_id ON ctgov_v2.responsible_parties USING btree (nct_id); -- --- Name: index_responsible_parties_on_organization; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_responsible_parties_on_organization; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_responsible_parties_on_organization ON ctgov.responsible_parties USING btree (organization); +CREATE INDEX index_responsible_parties_on_organization ON ctgov_v2.responsible_parties USING btree (organization); -- --- Name: index_responsible_parties_on_responsible_party_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_responsible_parties_on_responsible_party_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_responsible_parties_on_responsible_party_type ON ctgov.responsible_parties USING btree (responsible_party_type); +CREATE INDEX index_responsible_parties_on_responsible_party_type ON ctgov_v2.responsible_parties USING btree (responsible_party_type); -- --- Name: index_result_contacts_on_organization; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_result_contacts_on_organization; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_result_contacts_on_organization ON ctgov.result_contacts USING btree (organization); +CREATE INDEX index_result_contacts_on_organization ON ctgov_v2.result_contacts USING btree (organization); -- --- Name: index_result_groups_on_result_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_result_groups_on_result_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_result_groups_on_result_type ON ctgov.result_groups USING btree (result_type); +CREATE INDEX index_result_groups_on_result_type ON ctgov_v2.result_groups USING btree (result_type); -- --- Name: index_search_results_on_nct_id_and_name; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_search_results_on_nct_id_and_name; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE UNIQUE INDEX index_search_results_on_nct_id_and_name ON ctgov.search_results USING btree (nct_id, name); +CREATE UNIQUE INDEX index_search_results_on_nct_id_and_name ON ctgov_v2.search_results USING btree (nct_id, name); -- --- Name: index_search_results_on_nct_id_and_name_and_grouping; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_search_results_on_nct_id_and_name_and_grouping; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE UNIQUE INDEX index_search_results_on_nct_id_and_name_and_grouping ON ctgov.search_results USING btree (nct_id, name, "grouping"); +CREATE UNIQUE INDEX index_search_results_on_nct_id_and_name_and_grouping ON ctgov_v2.search_results USING btree (nct_id, name, "grouping"); -- --- Name: index_sponsors_on_agency_class; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_sponsors_on_agency_class; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_sponsors_on_agency_class ON ctgov.sponsors USING btree (agency_class); +CREATE INDEX index_sponsors_on_agency_class ON ctgov_v2.sponsors USING btree (agency_class); -- --- Name: index_sponsors_on_name; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_sponsors_on_name; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_sponsors_on_name ON ctgov.sponsors USING btree (name); +CREATE INDEX index_sponsors_on_name ON ctgov_v2.sponsors USING btree (name); -- --- Name: index_studies_on_completion_date; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_studies_on_completion_date; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_studies_on_completion_date ON ctgov.studies USING btree (completion_date); +CREATE INDEX index_studies_on_completion_date ON ctgov_v2.studies USING btree (completion_date); -- --- Name: index_studies_on_disposition_first_submitted_date; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_studies_on_disposition_first_submitted_date; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_studies_on_disposition_first_submitted_date ON ctgov.studies USING btree (disposition_first_submitted_date); +CREATE INDEX index_studies_on_disposition_first_submitted_date ON ctgov_v2.studies USING btree (disposition_first_submitted_date); -- --- Name: index_studies_on_enrollment_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_studies_on_enrollment_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_studies_on_enrollment_type ON ctgov.studies USING btree (enrollment_type); +CREATE INDEX index_studies_on_enrollment_type ON ctgov_v2.studies USING btree (enrollment_type); -- --- Name: index_studies_on_last_known_status; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_studies_on_last_known_status; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_studies_on_last_known_status ON ctgov.studies USING btree (last_known_status); +CREATE INDEX index_studies_on_last_known_status ON ctgov_v2.studies USING btree (last_known_status); -- --- Name: index_studies_on_last_update_submitted_date; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_studies_on_last_update_submitted_date; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_studies_on_last_update_submitted_date ON ctgov.studies USING btree (last_update_submitted_date); +CREATE INDEX index_studies_on_last_update_submitted_date ON ctgov_v2.studies USING btree (last_update_submitted_date); -- --- Name: index_studies_on_nct_id; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_studies_on_nct_id; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE UNIQUE INDEX index_studies_on_nct_id ON ctgov.studies USING btree (nct_id); +CREATE UNIQUE INDEX index_studies_on_nct_id ON ctgov_v2.studies USING btree (nct_id); -- --- Name: index_studies_on_overall_status; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_studies_on_overall_status; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_studies_on_overall_status ON ctgov.studies USING btree (overall_status); +CREATE INDEX index_studies_on_overall_status ON ctgov_v2.studies USING btree (overall_status); -- --- Name: index_studies_on_phase; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_studies_on_phase; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_studies_on_phase ON ctgov.studies USING btree (phase); +CREATE INDEX index_studies_on_phase ON ctgov_v2.studies USING btree (phase); -- --- Name: index_studies_on_primary_completion_date; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_studies_on_primary_completion_date; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_studies_on_primary_completion_date ON ctgov.studies USING btree (primary_completion_date); +CREATE INDEX index_studies_on_primary_completion_date ON ctgov_v2.studies USING btree (primary_completion_date); -- --- Name: index_studies_on_primary_completion_date_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_studies_on_primary_completion_date_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_studies_on_primary_completion_date_type ON ctgov.studies USING btree (primary_completion_date_type); +CREATE INDEX index_studies_on_primary_completion_date_type ON ctgov_v2.studies USING btree (primary_completion_date_type); -- --- Name: index_studies_on_results_first_submitted_date; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_studies_on_results_first_submitted_date; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_studies_on_results_first_submitted_date ON ctgov.studies USING btree (results_first_submitted_date); +CREATE INDEX index_studies_on_results_first_submitted_date ON ctgov_v2.studies USING btree (results_first_submitted_date); -- --- Name: index_studies_on_source; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_studies_on_source; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_studies_on_source ON ctgov.studies USING btree (source); +CREATE INDEX index_studies_on_source ON ctgov_v2.studies USING btree (source); -- --- Name: index_studies_on_start_date; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_studies_on_start_date; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_studies_on_start_date ON ctgov.studies USING btree (start_date); +CREATE INDEX index_studies_on_start_date ON ctgov_v2.studies USING btree (start_date); -- --- Name: index_studies_on_start_date_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_studies_on_start_date_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_studies_on_start_date_type ON ctgov.studies USING btree (start_date_type); +CREATE INDEX index_studies_on_start_date_type ON ctgov_v2.studies USING btree (start_date_type); -- --- Name: index_studies_on_study_first_submitted_date; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_studies_on_study_first_submitted_date; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_studies_on_study_first_submitted_date ON ctgov.studies USING btree (study_first_submitted_date); +CREATE INDEX index_studies_on_study_first_submitted_date ON ctgov_v2.studies USING btree (study_first_submitted_date); -- --- Name: index_studies_on_study_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_studies_on_study_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_studies_on_study_type ON ctgov.studies USING btree (study_type); +CREATE INDEX index_studies_on_study_type ON ctgov_v2.studies USING btree (study_type); -- --- Name: index_study_records_on_nct_id_and_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_study_records_on_nct_id_and_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE UNIQUE INDEX index_study_records_on_nct_id_and_type ON ctgov.study_records USING btree (nct_id, type); +CREATE UNIQUE INDEX index_study_records_on_nct_id_and_type ON ctgov_v2.study_records USING btree (nct_id, type); -- --- Name: index_study_references_on_reference_type; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_study_references_on_reference_type; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE INDEX index_study_references_on_reference_type ON ctgov.study_references USING btree (reference_type); +CREATE INDEX index_study_references_on_reference_type ON ctgov_v2.study_references USING btree (reference_type); -- --- Name: index_study_searches_on_query_and_grouping; Type: INDEX; Schema: ctgov; Owner: - +-- Name: index_study_searches_on_query_and_grouping; Type: INDEX; Schema: ctgov_v2; Owner: - -- -CREATE UNIQUE INDEX index_study_searches_on_query_and_grouping ON ctgov.study_searches USING btree (query, "grouping"); +CREATE UNIQUE INDEX index_study_searches_on_query_and_grouping ON ctgov_v2.study_searches USING btree (query, "grouping"); -- @@ -4522,6 +8208,13 @@ CREATE INDEX "index_support.study_xml_records_on_nct_id" ON support.study_xml_re CREATE TRIGGER category_insert_trigger INSTEAD OF INSERT ON ctgov.categories FOR EACH ROW EXECUTE FUNCTION ctgov.category_insert_function(); +-- +-- Name: categories category_insert_trigger; Type: TRIGGER; Schema: ctgov_v2; Owner: - +-- + +CREATE TRIGGER category_insert_trigger INSTEAD OF INSERT ON ctgov_v2.categories FOR EACH ROW EXECUTE FUNCTION ctgov_v2.category_insert_function(); + + -- -- Name: active_storage_attachments fk_rails_0276932754; Type: FK CONSTRAINT; Schema: support; Owner: - -- @@ -4558,7 +8251,7 @@ ALTER TABLE ONLY support.file_records -- PostgreSQL database dump complete -- -SET search_path TO ctgov,support,public; +SET search_path TO ctgov, support, public; INSERT INTO "schema_migrations" (version) VALUES ('20160630191037'), diff --git a/lib/tasks/import.rake b/lib/tasks/import.rake new file mode 100644 index 00000000..5777a525 --- /dev/null +++ b/lib/tasks/import.rake @@ -0,0 +1,81 @@ +namespace :import do + desc 'import single study' + + desc 'import studies in a file' + task :file, [:file] => :environment do |t, args| + lines = File.readlines(args[:file]) + ids = lines.select{|k| k =~ /nct\d+/i } + ids = ids.map{|k| k.strip } + puts "importing #{ids.length} studies" + + ids.each do |nct_id| + + # download both + StudyDownloader.download([nct_id], '1') + StudyDownloader.download([nct_id], '2') + + # # import v1 + record = StudyJsonRecord.find_by(nct_id: nct_id, version: '1') + record.create_or_update_study + + # # import v2 + worker = StudyJsonRecord::Worker.new + records = StudyJsonRecord.where(nct_id: nct_id, version: '2') + worker.process(1, records) + end + end + + desc 'import missing v1 given v2' + task :missing_v1, [:nct_id] => :environment do |t, args| + v1 = Study.pluck(:nct_id) + v2 = [] + with_search_path('ctgov_v2') do + v2 = Study.pluck(:nct_id) + end + + missing = v2 - v1 + missing.each do |nct_id| + StudyDownloader.download([nct_id], '1') + record = StudyJsonRecord.find_by(nct_id: nct_id, version: '1') + record.create_or_update_study + end + end + + desc 'import both, imports studies using both api versions' + task :both, [:nct_id] => :environment do |t, args| + # download both + StudyDownloader.download([args[:nct_id]], '1') + StudyDownloader.download([args[:nct_id]], '2') + + # # import v1 + record = StudyJsonRecord.find_by(nct_id: args[:nct_id], version: '1') + record.create_or_update_study + + # # import v2 + worker = StudyJsonRecord::Worker.new + records = StudyJsonRecord.where(nct_id: args[:nct_id], version: '2') + worker.process(1, records) + + # compare the two + StudyRelationship.study_models.each do |model| + sql = <<-SQL + SELECT + COUNT(*) + FROM ctgov.#{model.table_name} + WHERE nct_id = '#{args[:nct_id]}' + SQL + original = ActiveRecord::Base.connection.execute(sql).to_a.first.dig('count') + + sql = <<-SQL + SELECT + COUNT(*) + FROM ctgov_v2.#{model.table_name} + WHERE nct_id = '#{args[:nct_id]}' + SQL + future = ActiveRecord::Base.connection.execute(sql).to_a.first.dig('count') + if original != future + puts "#{model.table_name}: v1: #{original} v2: #{future}" + end + end + end +end \ No newline at end of file diff --git a/lib/tasks/load.rake b/lib/tasks/load.rake index 00cd713e..cba2afbb 100644 --- a/lib/tasks/load.rake +++ b/lib/tasks/load.rake @@ -1,4 +1,26 @@ namespace :db do + desc 'Clear study data from the database' + task :clear, [:schema] => :environment do |t, args| + with_search_path(args[:schema]) do + StudyRelationship.study_models.each do |model| + model.delete_all + end + end + end + + desc 'process study json records' + task :import_study, [:nct_id] => :environment do |t, args| + worker = StudyJsonRecord::Worker.new + records = StudyJsonRecord.where(nct_id: args[:nct_id], version: '2') + worker.process(1, records) + end + + desc 'process study json records' + task :import, [:schema] => :environment do |t, args| + with_search_path(args[:schema]) do + StudyJsonRecord::Worker.new.import_all(5000) + end + end desc "Load the AACT database from ClinicalTrials.gov" task :run, [:schema] => :environment do |t, args| diff --git a/lib/tasks/stats.rake b/lib/tasks/stats.rake new file mode 100644 index 00000000..432460b3 --- /dev/null +++ b/lib/tasks/stats.rake @@ -0,0 +1,137 @@ +namespace :stats do + desc 'counts for all the tables' + task :counts, [:schema] => :environment do |t, args| + with_search_path(args[:schema]) do + StudyRelationship.study_models.each do |model| + printf("%-40s %s\n", model.name, model.count) + end + end + end + + desc 'compare' + task :compare => :environment do + `rm -rf comprisons` + `mkdir comparisons` + StudyRelationship.study_models.each do |model| + sql = <<-SQL + SELECT + original.nct_id + FROM ( + SELECT + nct_id, + COUNT(*) AS count + FROM ctgov.#{model.table_name} + GROUP BY nct_id + ) AS original + LEFT JOIN ( + SELECT + nct_id, + COUNT(*) AS count + FROM ctgov_v2.#{model.table_name} + GROUP BY nct_id + ) AS future ON future.nct_id = original.nct_id + WHERE original.count != future.count OR future.count IS NULL + SQL + + results = ActiveRecord::Base.connection.execute(sql) + next if results.count == 0 + CSV.open("comparisons/#{model.table_name}.csv", "w") do |csv| + # Write the header row (if your query has headers) + csv << results.fields + + # Write each row from the query results + results.each do |row| + csv << row.values + end + end + puts "#{model.table_name} #{results.count} differences" + end + end + + desc 'find missing studies' + task :missing => :environment do + sql = <<-SQL + SELECT + SJR.nct_id + FROM study_json_records SJR + LEFT JOIN ctgov_v2.studies S ON S.nct_id = SJR.nct_id + WHERE S.nct_id IS NULL + SQL + results = ActiveRecord::Base.connection.execute(sql) + results.each do |result| + puts result['nct_id'] + end + end + + desc 'compare studies' + task :compare_studies, [:nct_id] => :environment do |t, args| + StudyRelationship.study_models.each do |model| + sql = <<-SQL + SELECT + COUNT(*) + FROM ctgov.#{model.table_name} + WHERE nct_id = '#{args[:nct_id]}' + SQL + original = ActiveRecord::Base.connection.execute(sql).to_a.first.dig('count') + + sql = <<-SQL + SELECT + COUNT(*) + FROM ctgov_v2.#{model.table_name} + WHERE nct_id = '#{args[:nct_id]}' + SQL + future = ActiveRecord::Base.connection.execute(sql).to_a.first.dig('count') + if original != future + puts "#{model.table_name}: #{original} vs #{future}" + end + end + end + + desc 'compare model for one study' + task :compare_model, [:nct_id, :model] => :environment do |t, args| + model = args[:model].classify.constantize + v1 = model.where(nct_id: args[:nct_id]) + end + + desc 'compare unique' + task :compare_unique => :environment do + StudyRelationship.study_models.each do |model| + # for each model itereate through the columns and check number of unique values + model.attribute_names.each do |attribute| + sql = <<-SQL + SELECT + COUNT(DISTINCT #{attribute}) + FROM ctgov.#{model.table_name} + SQL + original = ActiveRecord::Base.connection.execute(sql).to_a.first.dig('count') + + sql = <<-SQL + SELECT + COUNT(DISTINCT #{attribute}) + FROM ctgov_v2.#{model.table_name} + SQL + future = ActiveRecord::Base.connection.execute(sql).to_a.first.dig('count') + if original > future + puts "#{model.table_name}.#{attribute}: #{original} vs #{future}".red + elsif original < future + puts "#{model.table_name}.#{attribute}: #{original} vs #{future}".green + end + end + end + end + + desc 'compare values' + task :compare_values, [:model, :column] => :environment do |t, args| + sql = <<-SQL + SELECT + #{args[:model]}.#{args[:column]} + FROM ctgov.#{args[:model]} + EXCEPT + SELECT + #{args[:model]}.#{args[:column]} + FROM ctgov_v2.#{args[:model]} + SQL + out = ActiveRecord::Base.connection.execute(sql).to_a + puts out.inspect + end +end \ No newline at end of file