db.rb 580 B

12345678910111213141516171819202122232425262728
  1. # Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
  2. class Store
  3. module Provider
  4. class DB < ApplicationModel
  5. self.table_name = 'store_provider_dbs'
  6. def self.add(data, sha)
  7. Store::Provider::DB.create(
  8. data: data,
  9. sha: sha,
  10. )
  11. true
  12. end
  13. def self.get(sha)
  14. file = Store::Provider::DB.find_by(sha: sha)
  15. return if !file
  16. file.data
  17. end
  18. def self.delete(sha)
  19. Store::Provider::DB.where(sha: sha).destroy_all
  20. true
  21. end
  22. end
  23. end
  24. end