Added new migration to add the user_id column to blog_posts. The madness must end, we must move to EngineInstaller in the next version.

This commit is contained in:
Philip Arndt 2011-03-02 15:32:20 +13:00
parent 2cfc0c142c
commit 559ef9b3cb
3 changed files with 32 additions and 8 deletions

View file

@ -0,0 +1,11 @@
class AddUserIdToBlogPosts < ActiveRecord::Migration
def self.up
add_column :blog_posts, :user_id, :integer
end
def self.down
remove_column :blog_posts, :user_id
end
end

View file

@ -41,14 +41,21 @@ class RefinerycmsBlogGenerator < Rails::Generators::NamedBase
Rails::Generators::GeneratedAttribute.new('blog_post_id', 'integer')
], :id => false
}]
next_migration_number = ActiveRecord::Generators::Base.next_migration_number(File.dirname(__FILE__))
template('db/migrate/migration_number_create_singular_name.rb',
Rails.root.join("db/migrate/#{next_migration_number}_create_#{singular_name}.rb"))
unless Pathname.glob(Rails.root.join('db', 'migrate', "*_create_#{singular_name}.rb")).any?
next_migration_number = ActiveRecord::Generators::Base.next_migration_number(File.dirname(__FILE__))
template('db/migrate/migration_number_create_singular_name.rb',
Rails.root.join("db/migrate/#{next_migration_number}_create_#{singular_name}.rb"))
end
unless Pathname.glob(Rails.root.join('db', 'migrate', "*_add_user_id_to_blog_posts.rb")).any?
next_migration_number = ActiveRecord::Generators::Base.next_migration_number(File.dirname(__FILE__))
template('db/migrate/migration_number_add_user_id_to_blog_posts.rb',
Rails.root.join('db', 'migrate', "#{next_migration_number}_add_user_id_to_blog_posts.rb"))
end
puts "------------------------"
puts "Now run:"
puts "rake db:migrate"
puts "------------------------"
puts "------------------------"
puts "Now run:"
puts "rake db:migrate"
puts "------------------------"
end
end

View file

@ -2,7 +2,7 @@ Gem::Specification.new do |s|
s.name = %q{refinerycms-blog}
s.version = %q{1.2}
s.description = %q{A really straightforward open source Ruby on Rails blog engine designed for integration with RefineryCMS.}
s.date = %q{2011-02-21}
s.date = %q{2011-03-02}
s.summary = %q{Ruby on Rails blogging engine for RefineryCMS.}
s.email = %q{info@refinerycms.com}
s.homepage = %q{http://refinerycms.com}
@ -85,22 +85,27 @@ Gem::Specification.new do |s|
app/views/blog/shared/_rss_feed.html.erb
config
config/locales
config/locales/de.yml
config/locales/en.yml
config/locales/es.yml
config/locales/fr.yml
config/locales/it.yml
config/locales/nb.yml
config/locales/nl.yml
config/locales/pl.yml
config/locales/pt-BR.yml
config/locales/ru.yml
config/routes.rb
features
features/authors.feature
features/support
features/support/factories
features/support/factories/blog_categories.rb
features/support/factories/blog_comments.rb
features/support/factories/blog_posts.rb
features/support/paths.rb
features/support/step_definitions
features/support/step_definitions/authors_steps.rb
generators
generators/refinerycms_blog
generators/refinerycms_blog/refinerycms_blog_generator.rb
@ -117,6 +122,7 @@ Gem::Specification.new do |s|
lib/generators/refinerycms_blog/templates
lib/generators/refinerycms_blog/templates/db
lib/generators/refinerycms_blog/templates/db/migrate
lib/generators/refinerycms_blog/templates/db/migrate/migration_number_add_user_id_to_blog_posts.rb
lib/generators/refinerycms_blog/templates/db/migrate/migration_number_create_singular_name.rb
lib/generators/refinerycms_blog/templates/db/seeds
lib/generators/refinerycms_blog/templates/db/seeds/seed.rb