Class: SocialStream::Migrations::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/social_stream/migrations/base.rb

Direct Known Subclasses

Components

Instance Method Summary collapse

Constructor Details

#initializeBase

Returns a new instance of Base.



4
5
6
7
8
# File 'lib/social_stream/migrations/base.rb', line 4

def initialize
  require_old_migration 'acts-as-taggable-on', 'lib/generators/acts_as_taggable_on/migration/templates/active_record/migration'
  @mailboxer_migration = find_migration 'mailboxer'
  @base_migration = find_migration 'social_stream-base'
end

Instance Method Details

#downObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/social_stream/migrations/base.rb', line 19

def down
  begin
    ActiveRecord::Migrator.migrate @base_migration, 0
  rescue
    puts "WARNING: Social Stream Base failed to rollback"
  end

  begin
    ActiveRecord::Migrator.migrate @mailboxer_migration, 0
  rescue
    puts "WARNING: Mailboxer migration failed to rollback"
  end

  begin
    ActsAsTaggableOnMigration.down
  rescue
    puts "WARNING: ActsAsTaggableOnMigration failed to rollback"
  end
end

#upObject



10
11
12
13
14
15
16
17
# File 'lib/social_stream/migrations/base.rb', line 10

def up
  ActsAsTaggableOnMigration.up

  ActiveRecord::Migrator.migrate @mailboxer_migration

  # Run any available migration
  ActiveRecord::Migrator.migrate @base_migration
end