Sha256: 5a9f3ab46bd32f614f484e60450ad3abb2b09d2b517467e7413f98156d93115d
Contents?: true
Size: 2 KB
Versions: 2
Compression:
Stored size: 2 KB
Contents
class CreateBanyanTables < ActiveRecord::Migration def self.up create_table :banyan_categories do |t| t.string :tag t.integer :parent_id t.integer :lft t.integer :rgt end add_index :banyan_categories, :tag add_index :banyan_categories, :parent_id add_index :banyan_categories, :lft add_index :banyan_categories, :rgt create_table :banyan_categories_category_groups, :id => false do |t| t.integer :category_id t.integer :category_group_id end execute "ALTER TABLE banyan_categories_category_groups ADD PRIMARY KEY (category_id, category_group_id);" add_index :banyan_categories_category_groups, :category_group_id create_table :banyan_categorizations do |t| t.integer :category_id t.references :categorizable, :polymorphic => true end add_index :banyan_categorizations, :category_id add_index :banyan_categorizations, [:categorizable_id, :categorizable_type], :name => 'index_banyan_categorizations_on_categorizable' create_table :banyan_category_groups do |t| t.string :tag t.references :group_categorizable, :polymorphic => true t.integer :parent_id t.integer :lft t.integer :rgt end add_index :banyan_category_groups, :tag add_index :banyan_category_groups, [:group_categorizable_id, :group_categorizable_type], :name => 'index_banyan_category_groups_on_group_categorizable' add_index :banyan_category_groups, :parent_id add_index :banyan_category_groups, :lft add_index :banyan_category_groups, :rgt Banyan::Category.create_translation_table! :name => :string Banyan::CategoryGroup.create_translation_table! :name => :string end def self.down drop_table :banyan_category_groups drop_table :banyan_categorizations drop_table :banyan_categories_category_groups drop_table :banyan_categories Banyan::Category.drop_translation_table! Banyan::CategoryGroup.drop_translation_table! end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
banyan-1.1.1 | lib/generators/banyan/templates/migration.rb |
banyan-1.0.1 | lib/generators/banyan/templates/migration.rb |