diff options
Diffstat (limited to 'db/migrate')
-rw-r--r-- | db/migrate/1_create_blog_structure.rb | 54 | ||||
-rw-r--r-- | db/migrate/20110803223522_create_blog_structure.rb | 52 | ||||
-rw-r--r-- | db/migrate/20110803223523_add_user_id_to_blog_posts.rb | 7 | ||||
-rw-r--r-- | db/migrate/20110803223524_acts_as_taggable_on_migration.rb (renamed from db/migrate/3_acts_as_taggable_on_migration.rb) | 4 | ||||
-rw-r--r-- | db/migrate/20110803223526_add_cached_slugs.rb | 6 | ||||
-rw-r--r-- | db/migrate/20110803223527_add_custom_url_field_to_blog_posts.rb | 5 | ||||
-rw-r--r-- | db/migrate/20110803223528_add_custom_teaser_field_to_blog_posts.rb | 6 | ||||
-rw-r--r-- | db/migrate/20110803223529_add_primary_key_to_categorizations.rb | 14 | ||||
-rw-r--r-- | db/migrate/2_add_user_id_to_blog_posts.rb | 11 | ||||
-rw-r--r-- | db/migrate/4_create_seo_meta_for_blog.rb | 25 | ||||
-rw-r--r-- | db/migrate/5_add_cached_slugs.rb | 11 | ||||
-rw-r--r-- | db/migrate/6_add_custom_url_field_to_blog_posts.rb | 9 | ||||
-rw-r--r-- | db/migrate/7_add_custom_teaser_field_to_blog_posts.rb | 10 | ||||
-rw-r--r-- | db/migrate/8_add_primary_key_to_categorizations.rb | 12 |
14 files changed, 92 insertions, 134 deletions
diff --git a/db/migrate/1_create_blog_structure.rb b/db/migrate/1_create_blog_structure.rb deleted file mode 100644 index a93d2d4..0000000 --- a/db/migrate/1_create_blog_structure.rb +++ /dev/null @@ -1,54 +0,0 @@ -class CreateBlogStructure < ActiveRecord::Migration - - def self.up - create_table :blog_posts, :id => true do |t| - t.string :title - t.text :body - t.boolean :draft - t.datetime :published_at - t.timestamps - end - - add_index :blog_posts, :id - - create_table :blog_comments, :id => true do |t| - t.integer :blog_post_id - t.boolean :spam - t.string :name - t.string :email - t.text :body - t.string :state - t.timestamps - end - - add_index :blog_comments, :id - - create_table :blog_categories, :id => true do |t| - t.string :title - t.timestamps - end - - add_index :blog_categories, :id - - create_table :blog_categories_blog_posts, :id => true do |t| - t.integer :blog_category_id - t.integer :blog_post_id - end - - add_index :blog_categories_blog_posts, [:blog_category_id, :blog_post_id], :name => 'index_blog_categories_blog_posts_on_bc_and_bp' - - load(Rails.root.join('db', 'seeds', 'refinerycms_blog.rb').to_s) - end - - def self.down - UserPlugin.destroy_all({:name => "refinerycms_blog"}) - - Page.delete_all({:link_url => "/blog"}) - - drop_table :blog_posts - drop_table :blog_comments - drop_table :blog_categories - drop_table :blog_categories_blog_posts - end - -end diff --git a/db/migrate/20110803223522_create_blog_structure.rb b/db/migrate/20110803223522_create_blog_structure.rb new file mode 100644 index 0000000..f828936 --- /dev/null +++ b/db/migrate/20110803223522_create_blog_structure.rb @@ -0,0 +1,52 @@ +class CreateBlogStructure < ActiveRecord::Migration + + def up + create_table Refinery::Blog::Post.table_name, :id => true do |t| + t.string :title + t.text :body + t.boolean :draft + t.datetime :published_at + t.timestamps + end + + add_index Refinery::Blog::Post.table_name, :id + + create_table Refinery::Blog::Comment.table_name, :id => true do |t| + t.integer :blog_post_id + t.boolean :spam + t.string :name + t.string :email + t.text :body + t.string :state + t.timestamps + end + + add_index Refinery::Blog::Comment.table_name, :id + + create_table Refinery::Blog::Category.table_name, :id => true do |t| + t.string :title + t.timestamps + end + + add_index Refinery::Blog::Category.table_name, :id + + create_table Refinery::Categorization.table_name, :id => true do |t| + t.integer :blog_category_id + t.integer :blog_post_id + end + + add_index Refinery::Categorization.table_name, [:blog_category_id, :blog_post_id], :name => 'index_blog_categories_blog_posts_on_bc_and_bp' + end + + def down + Refinery::UserPlugin.destroy_all({:name => "refinerycms_blog"}) + + Refinery::Page.delete_all({:link_url => "/blog"}) + + drop_table Refinery::Blog::Post.table_name + drop_table Refinery::Blog::Comment.table_name + drop_table Refinery::Category.table_name + drop_table Refinery::Categorization.table_name + end + +end diff --git a/db/migrate/20110803223523_add_user_id_to_blog_posts.rb b/db/migrate/20110803223523_add_user_id_to_blog_posts.rb new file mode 100644 index 0000000..2fadb28 --- /dev/null +++ b/db/migrate/20110803223523_add_user_id_to_blog_posts.rb @@ -0,0 +1,7 @@ +class AddUserIdToBlogPosts < ActiveRecord::Migration + + def change + add_column Refinery::Blog::Post.table_name, :user_id, :integer + end + +end
\ No newline at end of file diff --git a/db/migrate/3_acts_as_taggable_on_migration.rb b/db/migrate/20110803223524_acts_as_taggable_on_migration.rb index 1661061..812daf4 100644 --- a/db/migrate/3_acts_as_taggable_on_migration.rb +++ b/db/migrate/20110803223524_acts_as_taggable_on_migration.rb @@ -1,5 +1,5 @@ class ActsAsTaggableOnMigration < ActiveRecord::Migration - def self.up + def up create_table :tags do |t| t.string :name end @@ -21,7 +21,7 @@ class ActsAsTaggableOnMigration < ActiveRecord::Migration add_index :taggings, [:taggable_id, :taggable_type, :context] end - def self.down + def down drop_table :taggings drop_table :tags end diff --git a/db/migrate/20110803223526_add_cached_slugs.rb b/db/migrate/20110803223526_add_cached_slugs.rb new file mode 100644 index 0000000..1024323 --- /dev/null +++ b/db/migrate/20110803223526_add_cached_slugs.rb @@ -0,0 +1,6 @@ +class AddCachedSlugs < ActiveRecord::Migration + def change + add_column Refinery::Blog::Category.table_name, :cached_slug, :string + add_column Refinery::Blog::Post.table_name, :cached_slug, :string + end +end diff --git a/db/migrate/20110803223527_add_custom_url_field_to_blog_posts.rb b/db/migrate/20110803223527_add_custom_url_field_to_blog_posts.rb new file mode 100644 index 0000000..7d3a225 --- /dev/null +++ b/db/migrate/20110803223527_add_custom_url_field_to_blog_posts.rb @@ -0,0 +1,5 @@ +class AddCustomUrlFieldToBlogPosts < ActiveRecord::Migration + def change + add_column Refinery::Blog::Post.table_name, :custom_url, :string + end +end diff --git a/db/migrate/20110803223528_add_custom_teaser_field_to_blog_posts.rb b/db/migrate/20110803223528_add_custom_teaser_field_to_blog_posts.rb new file mode 100644 index 0000000..895acb5 --- /dev/null +++ b/db/migrate/20110803223528_add_custom_teaser_field_to_blog_posts.rb @@ -0,0 +1,6 @@ +class AddCustomTeaserFieldToBlogPosts < ActiveRecord::Migration + def change + add_column Refinery::Blog::Post.table_name, :custom_teaser, :text + end +end + diff --git a/db/migrate/20110803223529_add_primary_key_to_categorizations.rb b/db/migrate/20110803223529_add_primary_key_to_categorizations.rb new file mode 100644 index 0000000..5bbfcf3 --- /dev/null +++ b/db/migrate/20110803223529_add_primary_key_to_categorizations.rb @@ -0,0 +1,14 @@ +class AddPrimaryKeyToCategorizations < ActiveRecord::Migration + def up + unless Refinery::Categorization.column_names.include?("id") + add_column Refinery::Categorization.table_name, :id, :primary_key + end + end + + def down + if Refinery::Categorization.column_names.include?("id") + remove_column Refinery::Categorization.table_name, :id + end + end +end + diff --git a/db/migrate/2_add_user_id_to_blog_posts.rb b/db/migrate/2_add_user_id_to_blog_posts.rb deleted file mode 100644 index cd62524..0000000 --- a/db/migrate/2_add_user_id_to_blog_posts.rb +++ /dev/null @@ -1,11 +0,0 @@ -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
\ No newline at end of file diff --git a/db/migrate/4_create_seo_meta_for_blog.rb b/db/migrate/4_create_seo_meta_for_blog.rb deleted file mode 100644 index baf81a4..0000000 --- a/db/migrate/4_create_seo_meta_for_blog.rb +++ /dev/null @@ -1,25 +0,0 @@ -class CreateSeoMetaForBlog < ActiveRecord::Migration - - def self.up - unless ::SeoMetum.table_exists? - create_table ::SeoMetum.table_name do |t| - t.integer :seo_meta_id - t.string :seo_meta_type - - t.string :browser_title - t.string :meta_keywords - t.text :meta_description - - t.timestamps - end - - add_index ::SeoMetum.table_name, :id - add_index ::SeoMetum.table_name, [:seo_meta_id, :seo_meta_type] - end - end - - def self.down - # can't drop the table because someone else might be using it. - end - -end diff --git a/db/migrate/5_add_cached_slugs.rb b/db/migrate/5_add_cached_slugs.rb deleted file mode 100644 index c189302..0000000 --- a/db/migrate/5_add_cached_slugs.rb +++ /dev/null @@ -1,11 +0,0 @@ -class AddCachedSlugs < ActiveRecord::Migration - def self.up - add_column :blog_categories, :cached_slug, :string - add_column :blog_posts, :cached_slug, :string - end - - def self.down - remove_column :blog_categories, :cached_slug - remove_column :blog_posts, :cached_slug - end -end diff --git a/db/migrate/6_add_custom_url_field_to_blog_posts.rb b/db/migrate/6_add_custom_url_field_to_blog_posts.rb deleted file mode 100644 index 5a8901e..0000000 --- a/db/migrate/6_add_custom_url_field_to_blog_posts.rb +++ /dev/null @@ -1,9 +0,0 @@ -class AddCustomUrlFieldToBlogPosts < ActiveRecord::Migration - def self.up - add_column :blog_posts, :custom_url, :string - end - - def self.down - remove_column :blog_posts, :custom_url - end -end diff --git a/db/migrate/7_add_custom_teaser_field_to_blog_posts.rb b/db/migrate/7_add_custom_teaser_field_to_blog_posts.rb deleted file mode 100644 index daa4d04..0000000 --- a/db/migrate/7_add_custom_teaser_field_to_blog_posts.rb +++ /dev/null @@ -1,10 +0,0 @@ -class AddCustomTeaserFieldToBlogPosts < ActiveRecord::Migration - def self.up - add_column :blog_posts, :custom_teaser, :text - end - - def self.down - remove_column :blog_posts, :custom_teaser - end -end - diff --git a/db/migrate/8_add_primary_key_to_categorizations.rb b/db/migrate/8_add_primary_key_to_categorizations.rb deleted file mode 100644 index efee289..0000000 --- a/db/migrate/8_add_primary_key_to_categorizations.rb +++ /dev/null @@ -1,12 +0,0 @@ -class AddPrimaryKeyToCategorizations < ActiveRecord::Migration - def self.up - unless ::Categorization.column_names.include?("id") - add_column :blog_categories_blog_posts, :id, :primary_key - end - end - - def self.down - remove_column :blog_categories_blog_posts, :id - end -end - |