Advertisement
Guest User

Untitled

a guest
Feb 7th, 2017
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.86 KB | None | 0 0
  1. ------------------------------------
  2. # database.yml
  3. ------------------------------------
  4. default: &default
  5. adapter: postgresql
  6. encoding: unicode
  7. pool: 5
  8. timeout: 5000
  9. username: user
  10. password:
  11. host: 127.0.0.1
  12. port: 5432
  13. min_messages: WARNING
  14.  
  15. development:
  16. <<: *default
  17. database: database_statistic
  18.  
  19. staging:
  20. <<: *default
  21. database: database_statistic
  22.  
  23. test:
  24. <<: *default
  25. database: database_statistic
  26.  
  27. production:
  28. adapter: postgresql
  29. encoding: unicode
  30. database: database_statistic_production
  31. pool: 5
  32. timeout: 5000
  33. username: deploy
  34. password: (secret)
  35. host: 127.0.0.1
  36. port: 5433
  37. min_messages: WARNING
  38.  
  39. sqlite_default: &sqlite_default
  40. adapter: sqlite3
  41. pool: 5
  42. timeout: 5000
  43.  
  44. sqlite_development:
  45. <<: *sqlite_default
  46. database: /tmp/db_statistic.db
  47.  
  48. sqlite_test:
  49. <<: *sqlite_default
  50. database: /tmp/db_statistic.db
  51.  
  52. sqlite_staging:
  53. <<: *sqlite_default
  54. database: /tmp/db_statistic.db
  55.  
  56. sqlite_production:
  57. <<: *sqlite_default
  58. database: /tmp/db_statistic.db
  59.  
  60.  
  61. ------------------------------------
  62. # app/models/report.rb => postgresql
  63. ------------------------------------
  64. # == Schema Information
  65. #
  66. # Table name: report
  67. #
  68. # id :integer not null, primary key
  69. # session_id :integer not null
  70. # timestamp :text not null
  71.  
  72. class Report < ApplicationRecord
  73. self.table_name = "report"
  74. validates :value, presence: true
  75. end
  76.  
  77.  
  78. ------------------------------------
  79. # app/models/report_statistic.rb => sqlite
  80. ------------------------------------
  81. # == Schema Information
  82. #
  83. # Table name: report_statistic
  84. #
  85. # id :integer not null, primary key
  86. # session_id :integer not null
  87. # timestamp :text not null
  88.  
  89. class ReportStatistic < ApplicationRecord
  90. establish_connection "sqlite_#{Rails.env}".to_sym
  91. self.abstract_class = true
  92. self.table_name = "report_statistic"
  93. validates :value, presence: true
  94. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement