<commit_before>class CreateSupportTables < ActiveRecord::Migration

  def up

    execute <<-SQL
      CREATE SCHEMA IF NOT EXISTS support;
      ALTER role ctti set search_path to ctgov, support, public;
      GRANT usage on schema support to ctti;
      GRANT create on schema support to ctti;
    SQL

    create_table "support.load_events", force: :cascade do |t|
      t.string   "event_type"
      t.string   "status"
      t.text     "description"
      t.text     "problems"
      t.integer  "should_add"
      t.integer  "should_change"
      t.integer  "processed"
      t.string   "load_time"
      t.datetime "completed_at"
      t.timestamps null: false
    end

    create_table "support.sanity_checks", force: :cascade do |t|
      t.string   'table_name'
      t.string   'nct_id'
      t.string   'column_name'
      t.string   'check_type'
      t.integer  'row_count'
      t.text     'description'
      t.boolean  'most_current'
      t.timestamps null: false
    end

    create_table "support.study_xml_records", force: :cascade do |t|
      t.string   "nct_id"
      t.xml      "content"
      t.datetime "created_study_at"
      t.timestamps null: false
    end

    add_index "support.load_events", :event_type
    add_index "support.load_events", :status
    add_index "support.study_xml_records", :nct_id
    add_index "support.study_xml_records", :created_study_at
    add_index "support.sanity_checks", :table_name
    add_index "support.sanity_checks", :nct_id
    add_index "support.sanity_checks", :column_name
    add_index "support.sanity_checks", :check_type
  end

  def down
    execute <<-SQL
      DROP SCHEMA IF EXISTS support CASCADE;
      ALTER role ctti set search_path to ctgov, public;
    SQL
  end

end
<commit_msg>“IF NOT EXISTS” not implemented in postgres 9.6<commit_after>class CreateSupportTables < ActiveRecord::Migration

  def up

    execute <<-SQL
      CREATE SCHEMA support;
      ALTER role ctti set search_path to ctgov, support, public;
      GRANT usage on schema support to ctti;
      GRANT create on schema support to ctti;
    SQL

    create_table "support.load_events", force: :cascade do |t|
      t.string   "event_type"
      t.string   "status"
      t.text     "description"
      t.text     "problems"
      t.integer  "should_add"
      t.integer  "should_change"
      t.integer  "processed"
      t.string   "load_time"
      t.datetime "completed_at"
      t.timestamps null: false
    end

    create_table "support.sanity_checks", force: :cascade do |t|
      t.string   'table_name'
      t.string   'nct_id'
      t.string   'column_name'
      t.string   'check_type'
      t.integer  'row_count'
      t.text     'description'
      t.boolean  'most_current'
      t.timestamps null: false
    end

    create_table "support.study_xml_records", force: :cascade do |t|
      t.string   "nct_id"
      t.xml      "content"
      t.datetime "created_study_at"
      t.timestamps null: false
    end

    add_index "support.load_events", :event_type
    add_index "support.load_events", :status
    add_index "support.study_xml_records", :nct_id
    add_index "support.study_xml_records", :created_study_at
    add_index "support.sanity_checks", :table_name
    add_index "support.sanity_checks", :nct_id
    add_index "support.sanity_checks", :column_name
    add_index "support.sanity_checks", :check_type
  end

  def down
    execute <<-SQL
      DROP SCHEMA IF EXISTS support CASCADE;
      ALTER role ctti set search_path to ctgov, public;
    SQL
  end

end

{'fraction_non_alphanumeric': 0.0842728297632469, 'fraction_numerical': 0.0005636978579481398, 'mean_word_length': 2.666322314049587, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 8}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3625758', 'n_tokens_mistral': 1235, 'n_tokens_neox': 1179, 'n_words': 306}