Sha256: e72adbe25a7b722ef16ff4d6c301e3d4a91a9534c820842f8ccf15203e6bebec

Contents?: true

Size: 872 Bytes

Versions: 3

Compression:

Stored size: 872 Bytes

Contents

class ChangeTablesForCategories < ActiveRecord::Migration
  def change
    if ::Inkwell::Engine::config.respond_to?('category_table')
      create_table :inkwell_blog_item_categories do |t|
        t.integer :blog_item_id
        t.integer :category_id
        t.integer :item_id
        t.string :item_type
        t.datetime :blog_item_created_at

        t.timestamps
      end

      add_column :inkwell_blog_items, :category_ids, :text, :limit => nil, :default => "[]"

      add_column ::Inkwell::Engine::config.category_table, :parent_ids, :text, :limit => nil, :default => "[]"
      add_column ::Inkwell::Engine::config.category_table, :child_ids, :text, :limit => nil, :default => "[]"
      add_column ::Inkwell::Engine::config.category_table, :owner_id, :integer
      add_column ::Inkwell::Engine::config.category_table, :owner_type, :string
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
inkwell-2.0.0 db/migrate/20130212130918_change_tables_for_categories.rb
inkwell-1.5.2 db/migrate/20130212130918_change_tables_for_categories.rb
inkwell-1.5.1 db/migrate/20130212130918_change_tables_for_categories.rb