db.rb 583 B

1234567891011121314151617181920212223242526272829
  1. # Copyright (C) 2012-2023 Zammad Foundation, https://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