<commit_before>require "cases/helper"
require 'models/course'

class FirebirdMigrationTest < ActiveRecord::TestCase
  self.use_transactional_fixtures = false

  def setup
    # using Course connection for tests -- need a db that doesn't already have a BOOLEAN domain
    @connection = Course.connection
    @fireruby_connection = @connection.instance_variable_get(:@connection)
  end

  def teardown
    @connection.drop_table :foo rescue nil
    @connection.execute("DROP DOMAIN D_BOOLEAN") rescue nil
  end

  def test_create_table_with_custom_sequence_name
    assert_nothing_raised do
      @connection.create_table(:foo, :sequence => 'foo_custom_seq') do |f|
        f.column :bar, :string
      end
    end
    assert !sequence_exists?('foo_seq')
    assert sequence_exists?('foo_custom_seq')

    assert_nothing_raised { @connection.drop_table(:foo, :sequence => 'foo_custom_seq') }
    assert !sequence_exists?('foo_custom_seq')
  ensure
    FireRuby::Generator.new('foo_custom_seq', @fireruby_connection).drop rescue nil
  end

  def test_create_table_without_sequence
    assert_nothing_raised do
      @connection.create_table(:foo, :sequence => false) do |f|
        f.column :bar, :string
      end
    end
    assert !sequence_exists?('foo_seq')
    assert_nothing_raised { @connection.drop_table :foo }

    assert_nothing_raised do
      @connection.create_table(:foo, :id => false) do |f|
        f.column :bar, :string
      end
    end
    assert !sequence_exists?('foo_seq')
    assert_nothing_raised { @connection.drop_table :foo }
  end

  def test_create_table_with_boolean_column
    assert !boolean_domain_exists?
    assert_nothing_raised do
      @connection.create_table :foo do |f|
        f.column :bar, :string
        f.column :baz, :boolean
      end
    end<commit_msg>#drop_table accepts no options now.<commit_after>require "cases/helper"
require 'models/course'

class FirebirdMigrationTest < ActiveRecord::TestCase
  self.use_transactional_fixtures = false

  def setup
    # using Course connection for tests -- need a db that doesn't already have a BOOLEAN domain
    @connection = Course.connection
    @fireruby_connection = @connection.instance_variable_get(:@connection)
  end

  def teardown
    @connection.drop_table :foo rescue nil
    @connection.execute("DROP DOMAIN D_BOOLEAN") rescue nil
  end

  def test_create_table_with_custom_sequence_name
    assert_nothing_raised do
      @connection.create_table(:foo, :sequence => 'foo_custom_seq') do |f|
        f.column :bar, :string
      end
    end
    assert !sequence_exists?('foo_seq')
    assert sequence_exists?('foo_custom_seq')

    assert_nothing_raised { @connection.drop_table(:foo) }
    assert !sequence_exists?('foo_custom_seq')
  ensure
    FireRuby::Generator.new('foo_custom_seq', @fireruby_connection).drop rescue nil
  end

  def test_create_table_without_sequence
    assert_nothing_raised do
      @connection.create_table(:foo, :sequence => false) do |f|
        f.column :bar, :string
      end
    end
    assert !sequence_exists?('foo_seq')
    assert_nothing_raised { @connection.drop_table :foo }

    assert_nothing_raised do
      @connection.create_table(:foo, :id => false) do |f|
        f.column :bar, :string
      end
    end
    assert !sequence_exists?('foo_seq')
    assert_nothing_raised { @connection.drop_table :foo }
  end

  def test_create_table_with_boolean_column
    assert !boolean_domain_exists?
    assert_nothing_raised do
      @connection.create_table :foo do |f|
        f.column :bar, :string
        f.column :baz, :boolean
      end
    end
{'fraction_non_alphanumeric': 0.08896302474284126, 'fraction_numerical': 0.0, 'mean_word_length': 3.7655629139072846, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 10, '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': '4890375', 'n_tokens_mistral': 1146, 'n_tokens_neox': 1089, 'n_words': 257}