<commit_before>class AddGqueriesForPolicies < ActiveRecord::Migration
  def self.up
    add_column :constraints, :gquery_id, :integer

    g = Constraint.find(1).create_gquery :key => 'policy_total_primary_energy', 
      :query => "Q(primary_demand_of_final_demand)"
    Constraint.find(1).update_attribute :gquery_id, g.id
    g = Constraint.find(2).create_gquery :key => 'policy_co2_reduction',
      :query => "SUM(-1,DIVIDE(Q(co2_emission_total),AREA(co2_emission_1990_billions)))"
    Constraint.find(2).update_attribute :gquery_id, g.id
    
    g = Constraint.find(3).create_gquery :key => 'policy_net_energy_import',
      :query => "Q(energy_dependence)"
    Constraint.find(3).update_attribute :gquery_id, g.id

    g = Constraint.find(4).create_gquery :key => 'policy_total_energy_cost',
      :query => "UNIT(Q(cost_total);billions)"
    Constraint.find(4).update_attribute :gquery_id, g.id

    g = Constraint.find(5).create_gquery :key => 'policy_not_shown',
      :query => "Q(area_footprint_per_nl)"
    Constraint.find(5).update_attribute :gquery_id, g.id

    g = Constraint.find(6).create_gquery :key => 'policy_renewable_percentage',<commit_msg>trying to fix db migration<commit_after>class Constraint < ActiveRecord::Base
  belongs_to :gquery
end

class AddGqueriesForPolicies < ActiveRecord::Migration
  def self.up
    add_column :constraints, :gquery_id, :integer

    g = Constraint.find(1).create_gquery :key => 'policy_total_primary_energy', 
      :query => "Q(primary_demand_of_final_demand)"
    Constraint.find(1).update_attribute :gquery_id, g.id
    g = Constraint.find(2).create_gquery :key => 'policy_co2_reduction',
      :query => "SUM(-1,DIVIDE(Q(co2_emission_total),AREA(co2_emission_1990_billions)))"
    Constraint.find(2).update_attribute :gquery_id, g.id
    
    g = Constraint.find(3).create_gquery :key => 'policy_net_energy_import',
      :query => "Q(energy_dependence)"
    Constraint.find(3).update_attribute :gquery_id, g.id

    g = Constraint.find(4).create_gquery :key => 'policy_total_energy_cost',
      :query => "UNIT(Q(cost_total);billions)"
    Constraint.find(4).update_attribute :gquery_id, g.id

    g = Constraint.find(5).create_gquery :key => 'policy_not_shown',
      :query => "Q(area_footprint_per_nl)"
    Constraint.find(5).update_attribute :gquery_id, g.id

    g = Constraint.find(6).create_gquery :key => 'policy_renewable_percentage',
{'fraction_non_alphanumeric': 0.13449564134495642, 'fraction_numerical': 0.0157741801577418, 'mean_word_length': 4.98014888337469, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '6956416', 'n_tokens_mistral': 886, 'n_tokens_neox': 840, 'n_words': 125}