Module: YeshouaCrm::ActsAsDraftable::Migration
- Defined in:
- lib/yeshoua_crm/acts_as_draftable/rcrm_acts_as_draftable.rb
Overview
InstanceMethods
Instance Method Summary collapse
Instance Method Details
#create_drafts_table ⇒ Object
132 133 134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/yeshoua_crm/acts_as_draftable/rcrm_acts_as_draftable.rb', line 132 def create_drafts_table return if connection.table_exists?(:drafts) connection.create_table :drafts do |t| t.string :target_type, limit: 150, null: false t.references :user t.references :parent, polymorphic: true, index: true t.binary :data, limit: 16777215, null: false t.datetime :updated_at, null: false end connection.add_index :drafts, [:user_id, :target_type] end |
#drop_drafts_table ⇒ Object
146 147 148 |
# File 'lib/yeshoua_crm/acts_as_draftable/rcrm_acts_as_draftable.rb', line 146 def drop_drafts_table connection.drop_table :drafts if connection.table_exists?(:drafts) end |