20120101000110_text_module_create.rb 1.1 KB

123456789101112131415161718192021222324252627282930
  1. class TextModuleCreate < ActiveRecord::Migration
  2. def up
  3. create_table :text_modules do |t|
  4. t.references :user, :null => true
  5. t.column :name, :string, :limit => 250, :null => false
  6. t.column :keywords, :string, :limit => 500, :null => true
  7. t.column :content, :string, :limit => 5000, :null => false
  8. t.column :note, :string, :limit => 250, :null => true
  9. t.column :active, :boolean, :null => false, :default => true
  10. t.column :updated_by_id, :integer, :null => false
  11. t.column :created_by_id, :integer, :null => false
  12. t.timestamps
  13. end
  14. add_index :text_modules, [:user_id]
  15. add_index :text_modules, [:name]
  16. create_table :text_modules_groups, :id => false do |t|
  17. t.integer :text_module_id
  18. t.integer :group_id
  19. end
  20. add_index :text_modules_groups, [:text_module_id]
  21. add_index :text_modules_groups, [:group_id]
  22. end
  23. def down
  24. drop_table :text_modules_groups
  25. drop_table :text_modules
  26. end
  27. end