PageRenderTime 60ms CodeModel.GetById 33ms RepoModel.GetById 1ms app.codeStats 0ms

/db/migrate/001_create_hashar_schema.rb

https://bitbucket.org/torresj/hashar-deep
Ruby | 47 lines | 18 code | 2 blank | 27 comment | 0 complexity | 65d82523716724fda7255adef41bff28 MD5 | raw file
  1. #
  2. # 001_create_hashar_schema.rb
  3. # https://bitbucket.org/torresj/hashar-deep
  4. # Licensed under the terms of the MIT License, as specified below.
  5. #
  6. # Copyright (c) 2012 Jeremy Torres, https://bitbucket.org/torresj/hashar-deep
  7. #
  8. # Permission is hereby granted, free of charge, to any person obtaining
  9. # a copy of this software and associated documentation files (the
  10. # "Software"), to deal in the Software without restriction, including
  11. # without limitation the rights to use, copy, modify, merge, publish,
  12. # distribute, sublicense, and/or sell copies of the Software, and to
  13. # permit persons to whom the Software is furnished to do so, subject to
  14. # the following conditions:
  15. #
  16. # The above copyright notice and this permission notice shall be
  17. # included in all copies or substantial portions of the Software.
  18. #
  19. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  20. # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  21. # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  22. # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  23. # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  24. # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  25. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  26. #
  27. # Active record for the Hashar Schema.
  28. class CreateHasharSchema < ActiveRecord::Migration
  29. def self.up
  30. create_table :hashar_files do |t|
  31. t.string :file_name, :null => false
  32. t.string :file_hash, :null => false
  33. t.datetime :processed_at, :null => false
  34. t.datetime :created_at, :null => false
  35. t.datetime :updated_at, :null => false
  36. end
  37. add_index(:hashar_files, :file_name)
  38. add_index(:hashar_files, :file_hash)
  39. end
  40. def self.down
  41. drop_table :hashar_files
  42. remove_index(:hashar_files, :file_name)
  43. remove_index(:hashar_files, :file_hash)
  44. end
  45. end