Sha256: b1a78896d82b92604baadcca178244ff3e71b1000dedf009330e623a061ae0bb

Contents?: true

Size: 1.31 KB

Versions: 14

Compression:

Stored size: 1.31 KB

Contents

-*- indent-tabs-mode:nil; -*-

# HoboFields - Migration Generator

Our test requires to prepare the testapp:
{.hidden}

    doctest_require: 'prepare_testapp'

{.hidden}

And requires also that you enter the right choice when prompted. OK we're ready to get going.

## Alternate Primary Keys

### create
   doctest: create table with custom primary_key
   >>
    class Foo < ActiveRecord::Base
      fields do
      end
      self.primary_key="foo_id"
    end
   >> Rails::Generators.invoke 'hobo:migration', %w(-n -m)
   >> Foo.primary_key
   => 'foo_id'

### migrate from
   doctest: rename from custom primary_key
   >>
    class Foo < ActiveRecord::Base
      self.primary_key="id"
    end
    puts "\n\e[45m Please enter 'id' (no quotes) at the next prompt \e[0m"
   >> Rails::Generators.invoke 'hobo:migration', %w(-n -m)
   >> Foo.primary_key
   => 'id'

### migrate to

   doctest: rename to custom primary_key
   >>
    class Foo < ActiveRecord::Base
      self.primary_key="foo_id"
    end
    puts "\n\e[45m Please enter 'drop id' (no quotes) at the next prompt \e[0m"
   >> Rails::Generators.invoke 'hobo:migration', %w(-n -m)
   >> Foo.primary_key
   => 'foo_id'

### ensure it doesn't cause further migrations

   doctest: check no further migrations
   >> up, down = Generators::Hobo::Migration::Migrator.run
   >> up
   => ""

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
hobo_fields-2.2.6 test/interactive_primary_key.rdoctest
hobo_fields-2.2.5 test/interactive_primary_key.rdoctest
hobo_fields-2.2.4 test/interactive_primary_key.rdoctest
hobo_fields-2.2.3 test/interactive_primary_key.rdoctest
hobo_fields-2.2.2 test/interactive_primary_key.rdoctest
hobo_fields-2.2.1 test/interactive_primary_key.rdoctest
hobo_fields-2.2.0 test/interactive_primary_key.rdoctest
hobo_fields-2.1.2 test/interactive_primary_key.rdoctest
hobo_fields-2.1.1 test/interactive_primary_key.rdoctest
hobo_fields-2.1.0 test/interactive_primary_key.rdoctest
hobo_fields-2.1.0.pre4 test/interactive_primary_key.rdoctest
hobo_fields-2.1.0.pre3 test/interactive_primary_key.rdoctest
hobo_fields-2.1.0.pre2 test/interactive_primary_key.rdoctest
hobo_fields-2.1.0.pre1 test/interactive_primary_key.rdoctest