<commit_before>module Cli

  class Migrate < Thor

    desc "reset", "migration reset (erase and migration up)"
    def reset
      init
      Sequel::Migrator.run(@db, MG_DIR, :target => 0)
      Sequel::Migrator.run(@db, MG_DIR)
    end

    desc "to", "Update migrations (up or down) to VERSION."
    def to
      init
      version = ENV['VERSION'].to_i
      raise "No VERSION was provided" if version.nil?
      Sequel::Migrator.run(@db, MG_DIR, :target => version)
    end

    desc "up", "Update migrations to latest available."
    def up
      init
      Sequel::Migrator.run(@db, MG_DIR)
    end

    desc "down", "Full migration downgrade (erase all data)."
    def down
      init
      Sequel::Migrator.run(@db, MG_DIR, :target => 0)
    end

    no_tasks do
      def init
        Sequel.extension :migration
        @db = Sequel.connect(DB_INFOS[:url], DB_INFOS[:options])
      end
    end

  end # Migrate

end ## Cli<commit_msg>Add Exception when migrate fails to get DB informations<commit_after>module Cli

  class Migrate < Thor

    desc "reset", "migration reset (erase and migration up)"
    def reset
      init
      Sequel::Migrator.run(@db, MG_DIR, :target => 0)
      Sequel::Migrator.run(@db, MG_DIR)
    end

    desc "to", "Update migrations (up or down) to VERSION."
    def to
      init
      version = ENV['VERSION'].to_i
      raise "No VERSION was provided" if version.nil?
      Sequel::Migrator.run(@db, MG_DIR, :target => version)
    end

    desc "up", "Update migrations to latest available."
    def up
      init
      Sequel::Migrator.run(@db, MG_DIR)
    end

    desc "down", "Full migration downgrade (erase all data)."
    def down
      init
      Sequel::Migrator.run(@db, MG_DIR, :target => 0)
    end

    no_tasks do
      def init
        Sequel.extension :migration
        begin
          @db = Sequel.connect(DB_INFOS[:url], DB_INFOS[:options])
        rescue NameError
          puts "Did you configure your config/db.yml file ?"
          abort "Are you in your app directory ?"
        end
      end
    end

  end # Migrate

end ## Cli
{'fraction_non_alphanumeric': 0.10571428571428572, 'fraction_numerical': 0.0019047619047619048, 'mean_word_length': 2.3616, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '7193258', 'n_tokens_mistral': 707, 'n_tokens_neox': 675, 'n_words': 211}