Guest User

Untitled

a guest
Feb 21st, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. class AddConstraintsToAssets < ActiveRecord::Migration
  2. def self.up
  3. execute "alter table #{Asset.table_name}
  4. add constraint assets_check_kind
  5. check (kind in (#{ Asset::KINDS.collect{|a| "'#{a}'"}.join(',') }));".to_line
  6. end
  7.  
  8. def self.down
  9. execute "alter table #{Asset.table_name}
  10. drop constraint assets_check_kind;".to_line
  11. end
  12. end
Add Comment
Please, Sign In to add comment