<commit_before>Foreigner.load

class Setup < ActiveRecord::Migration
  def self.up
    create_table :projects, :force => true do |t|
      t.string        :name
      t.timestamps 
    end


    create_table :settings, :force => true do |t|
      t.references     :project
      t.string         :key
      t.string         :value
      t.timestamps
    end

    add_foreign_key(:settings, :projects, :dependent => :delete)
    add_index :settings, [:key, :project_id], :unique => true


    create_table :ext_resources, :force => true do |t|
      t.references     :project
      t.string         :type
      t.string         :location
      t.timestamps
    end

    add_foreign_key(:ext_resources, :projects, :dependent => :delete)


    create_table :events, :force => true do |t|
      t.references     :project
      t.string         :type
      t.string         :summary
      t.text           :body
      t.datetime       :occurred_at
      t.timestamps
    end

    add_foreign_key(:events, :projects, :dependent => :delete)
    add_index :events, :type, :unique => false
    add_index :events, :occurred_at, :unique => false


    create_table :tags, :force => true do |t|
      t.references    :project
      t.string        :name
      t.string        :color,         :default => "#359AFF"
    end

    add_foreign_key(:tags, :projects, :dependent => :delete)


    create_table :documents, :force => true do |t|
      t.references    :project
      t.string        :name
      t.string        :mimetype
      t.text          :path
      t.timestamps
    end

    add_foreign_key(:documents, :projects, :dependent => :delete)


    create_table :mails, :force => true do |t|
      t.references    :project
      t.string        :from
      t.string        :to
      t.string        :cc
      t.string        :subject
      t.text          :body
      t.timestamps
    end

    add_foreign_key(:mails, :projects, :dependent => :delete)


    create_table :notes, :force => true do |t|
      t.references    :project
      t.text          :text
      t.timestamps
    end

    add_foreign_key(:notes, :projects, :dependent => :delete)


    create_table :tasks, :force => true do |t|
      t.references    :project
      t.string        :summary
      t.text          :text
      t.integer       :importance,    :default => 0
      t.boolean       :completed,     :default => false
      t.boolean       :blocked,       :default => false
      t.datetime      :due_date
      t.timestamps
    end

    add_foreign_key(:tasks, :projects, :dependent => :delete)


    create_table :wikis, :force => true do |t|
      t.references    :project
      t.string        :title
      t.timestamps
    end

    add_foreign_key(:wikis, :projects, :dependent => :delete)


    create_table :wiki_contents, :force => true do |t|
      t.references    :wiki
      t.text          :comment
      t.longtext      :text
      t.timestamps
    end

    add_foreign_key(:wiki_contents, :wikis, :dependent => :delete)


#    #CPK:<commit_msg>woops - longtext is not right here<commit_after>Foreigner.load

class Setup < ActiveRecord::Migration
  def self.up
    create_table :projects, :force => true do |t|
      t.string        :name
      t.timestamps 
    end


    create_table :settings, :force => true do |t|
      t.references     :project
      t.string         :key
      t.string         :value
      t.timestamps
    end

    add_foreign_key(:settings, :projects, :dependent => :delete)
    add_index :settings, [:key, :project_id], :unique => true


    create_table :ext_resources, :force => true do |t|
      t.references     :project
      t.string         :type
      t.string         :location
      t.timestamps
    end

    add_foreign_key(:ext_resources, :projects, :dependent => :delete)


    create_table :events, :force => true do |t|
      t.references     :project
      t.string         :type
      t.string         :summary
      t.text           :body
      t.datetime       :occurred_at
      t.timestamps
    end

    add_foreign_key(:events, :projects, :dependent => :delete)
    add_index :events, :type, :unique => false
    add_index :events, :occurred_at, :unique => false


    create_table :tags, :force => true do |t|
      t.references    :project
      t.string        :name
      t.string        :color,         :default => "#359AFF"
    end

    add_foreign_key(:tags, :projects, :dependent => :delete)


    create_table :documents, :force => true do |t|
      t.references    :project
      t.string        :name
      t.string        :mimetype
      t.text          :path
      t.timestamps
    end

    add_foreign_key(:documents, :projects, :dependent => :delete)


    create_table :mails, :force => true do |t|
      t.references    :project
      t.string        :from
      t.string        :to
      t.string        :cc
      t.string        :subject
      t.text          :body
      t.timestamps
    end

    add_foreign_key(:mails, :projects, :dependent => :delete)


    create_table :notes, :force => true do |t|
      t.references    :project
      t.text          :text
      t.timestamps
    end

    add_foreign_key(:notes, :projects, :dependent => :delete)


    create_table :tasks, :force => true do |t|
      t.references    :project
      t.string        :summary
      t.text          :text
      t.integer       :importance,    :default => 0
      t.boolean       :completed,     :default => false
      t.boolean       :blocked,       :default => false
      t.datetime      :due_date
      t.timestamps
    end

    add_foreign_key(:tasks, :projects, :dependent => :delete)


    create_table :wikis, :force => true do |t|
      t.references    :project
      t.string        :title
      t.timestamps
    end

    add_foreign_key(:wikis, :projects, :dependent => :delete)


    create_table :wiki_contents, :force => true do |t|
      t.references    :wiki
      t.text          :comment
      t.text          :text
      t.timestamps
    end

    add_foreign_key(:wiki_contents, :wikis, :dependent => :delete)


#    #CPK:
{'fraction_non_alphanumeric': 0.10534100246507806, 'fraction_numerical': 0.001314708299096138, 'mean_word_length': 1.8626528692380055, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 59, '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': '3726689', 'n_tokens_mistral': 1970, 'n_tokens_neox': 1867, 'n_words': 476}