Sha256: a74e633dd66ac1c321db69e23b86993fc2d5b9693a4b80e31ade22e04ead6b96

Contents?: true

Size: 1.31 KB

Versions: 19

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
      set_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
      set_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
      set_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

19 entries across 19 versions & 1 rubygems

Version Path
hobo_fields-2.0.1 test/interactive_primary_key.rdoctest
hobo_fields-2.0.0 test/interactive_primary_key.rdoctest
hobo_fields-2.0.0.pre10 test/interactive_primary_key.rdoctest
hobo_fields-2.0.0.pre9 test/interactive_primary_key.rdoctest
hobo_fields-2.0.0.pre8 test/interactive_primary_key.rdoctest
hobo_fields-2.0.0.pre7 test/interactive_primary_key.rdoctest
hobo_fields-2.0.0.pre6 test/interactive_primary_key.rdoctest
hobo_fields-2.0.0.pre5 test/interactive_primary_key.rdoctest
hobo_fields-2.0.0.pre4 test/interactive_primary_key.rdoctest
hobo_fields-2.0.0.pre3 test/interactive_primary_key.rdoctest
hobo_fields-2.0.0.pre2 test/interactive_primary_key.rdoctest
hobo_fields-2.0.0.pre1 test/interactive_primary_key.rdoctest
hobo_fields-1.4.0.pre8 test/interactive_primary_key.rdoctest
hobo_fields-1.4.0.pre7 test/interactive_primary_key.rdoctest
hobo_fields-1.4.0.pre6 test/interactive_primary_key.rdoctest
hobo_fields-1.4.0.pre5 test/interactive_primary_key.rdoctest
hobo_fields-1.4.0.pre4 test/interactive_primary_key.rdoctest
hobo_fields-1.4.0.pre3 test/interactive_primary_key.rdoctest
hobo_fields-1.4.0.pre2 test/interactive_primary_key.rdoctest