Sha256: 76250cb4d916e4fd8259956ee11609cca0b7716b1e34ecbda90d78f6ea062dd4

Contents?: true

Size: 1.66 KB

Versions: 28

Compression:

Stored size: 1.66 KB

Contents

require 'jdbc_common'
require 'db/derby'

class CreateDummies < ActiveRecord::Migration
  def self.up
    create_table :dummies, :force => true do |t|
      t.string :year, :default => "", :null => false
    end
    add_index :dummies, :year, :unique => true
  end

end

class ChangeColumn < ActiveRecord::Migration
  def self.up
    create_table :people, :id => false, :force => true do |t|
      t.string :id, :limit => 22, :null => false
      t.string :name, :null => false
    end
    change_column(:people, :name, :string, {:limit=>22})
    execute("SELECT id FROM people WHERE id = 'some string'")
  end

  def self.down
  end

end

class CreateIndex < ActiveRecord::Migration
  def self.up
    create_table :people, :id => false, :force => true do |t|
      t.string :id, :limit => 22, :null => false
      t.string :first_name, :null => false
      t.string :last_name, :null => false
      t.string :nickname, :null => false
      t.string :long_name, :null => false
      t.string :very_long_name, :null => false
      t.string :extremely_long_name, :null => false
    end

    add_index(:people, [:first_name, :last_name, :nickname, :long_name, :very_long_name, :extremely_long_name], :unique => true)

    remove_index(:people, [:first_name, :last_name, :nickname, :long_name, :very_long_name, :extremely_long_name])
  end

  def self.down
  end

end

class DerbyMigrationTest < Test::Unit::TestCase
  include FixtureSetup

  def test_create_table_column_quoting_vs_keywords
    CreateDummies.up
  end

  def test_migrate_change_column_for_non_standard_id
    ChangeColumn.up
    ChangeColumn.down
  end

  def test_migrate_create_index
    CreateIndex.up
    CreateIndex.down
  end

end

Version data entries

28 entries across 28 versions & 8 rubygems

Version Path
cmoran92-activerecord-jdbc-adapter-1.2.1.2 test/derby_migration_test.rb
tgbyte-activerecord-jdbc-adapter-1.2.2.5 test/derby_migration_test.rb
tgbyte-activerecord-jdbc-adapter-1.2.2.4 test/derby_migration_test.rb
tgbyte-activerecord-jdbc-adapter-1.2.2.3 test/derby_migration_test.rb
tgbyte-activerecord-jdbc-adapter-1.2.2.2 test/derby_migration_test.rb
activerecord-jdbc-adapter-1.2.2.1 test/derby_migration_test.rb
activerecord-jdbc-adapter-onsite-1.2.2 test/derby_migration_test.rb
cmoran92-activerecord-jdbc-adapter-1.2.1.1 test/derby_migration_test.rb
intentmedia-activerecord-jdbc-adapter-1.1.1.1 test/derby_migration_test.rb
activerecord-jdbc-adapter-1.2.2 test/derby_migration_test.rb
cmoran92-activerecord-jdbc-adapter-1.2.1 test/derby_migration_test.rb
activerecord-jdbc-adapter-1.2.1 test/derby_migration_test.rb
c3-activerecord-jdbc-adapter-1.1.3.1 test/derby_migration_test.rb
activerecord-jdbc-adapter-1.2.0 test/derby_migration_test.rb
c3-activerecord-jdbc-adapter-1.1.3 test/derby_migration_test.rb
jashmenn-activerecord-jdbc-adapter-1.2.0.0 test/derby_migration_test.rb
jashmenn-activerecord-jdbc-adapter-1.2.0 test/derby_migration_test.rb
activerecord-jdbc-adapter-1.1.3 test/derby_migration_test.rb
activerecord-jdbc-adapter-1.1.2 test/derby_migration_test.rb
activerecord-jdbc-adapter-1.1.1 test/derby_migration_test.rb