catarse_full 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (865) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +19 -0
  3. data/README.rdoc +3 -0
  4. data/Rakefile +45 -0
  5. data/app/assets/fonts/icomoon.eot +0 -0
  6. data/app/assets/fonts/icomoon.json +1 -0
  7. data/app/assets/fonts/icomoon.svg +30 -0
  8. data/app/assets/fonts/icomoon.ttf +0 -0
  9. data/app/assets/fonts/icomoon.woff +0 -0
  10. data/app/assets/images/.gitkeep +0 -0
  11. data/app/assets/images/auth/facebook_64.png +0 -0
  12. data/app/assets/images/auth/twitter_64.png +0 -0
  13. data/app/assets/images/catarse/ProjectUpdate.jpg +0 -0
  14. data/app/assets/images/catarse/back_icons.png +0 -0
  15. data/app/assets/images/catarse/back_statistics.gif +0 -0
  16. data/app/assets/images/catarse/backed_icon.png +0 -0
  17. data/app/assets/images/catarse/backer_city.png +0 -0
  18. data/app/assets/images/catarse/backer_info.gif +0 -0
  19. data/app/assets/images/catarse/backer_info.png +0 -0
  20. data/app/assets/images/catarse/background.png +0 -0
  21. data/app/assets/images/catarse/background_full.jpg +0 -0
  22. data/app/assets/images/catarse/banner-10-milhoes.png +0 -0
  23. data/app/assets/images/catarse/bg64x64_s3.png +0 -0
  24. data/app/assets/images/catarse/bg_air.jpg +0 -0
  25. data/app/assets/images/catarse/bg_explore.jpg +0 -0
  26. data/app/assets/images/catarse/bg_finish.jpg +0 -0
  27. data/app/assets/images/catarse/bg_guardian.jpg +0 -0
  28. data/app/assets/images/catarse/bg_heartbacker.jpg +0 -0
  29. data/app/assets/images/catarse/bg_money.jpg +0 -0
  30. data/app/assets/images/catarse/bg_moneytag.jpg +0 -0
  31. data/app/assets/images/catarse/bg_requirements.png +0 -0
  32. data/app/assets/images/catarse/bg_rewards.jpg +0 -0
  33. data/app/assets/images/catarse/bg_s3.png +0 -0
  34. data/app/assets/images/catarse/bg_send.png +0 -0
  35. data/app/assets/images/catarse/bg_steps.png +0 -0
  36. data/app/assets/images/catarse/bg_tips.png +0 -0
  37. data/app/assets/images/catarse/bg_tips1.png +0 -0
  38. data/app/assets/images/catarse/bg_tips2.png +0 -0
  39. data/app/assets/images/catarse/bg_tips3.png +0 -0
  40. data/app/assets/images/catarse/bg_tips4.png +0 -0
  41. data/app/assets/images/catarse/bg_tips5.png +0 -0
  42. data/app/assets/images/catarse/bg_tips6.png +0 -0
  43. data/app/assets/images/catarse/bg_tips7.png +0 -0
  44. data/app/assets/images/catarse/bg_tips8.png +0 -0
  45. data/app/assets/images/catarse/blog_icon17x14.png +0 -0
  46. data/app/assets/images/catarse/boleto_icon.png +0 -0
  47. data/app/assets/images/catarse/bot_guidelines.gif +0 -0
  48. data/app/assets/images/catarse/bot_profileUser.png +0 -0
  49. data/app/assets/images/catarse/box_alert.png +0 -0
  50. data/app/assets/images/catarse/box_download.png +0 -0
  51. data/app/assets/images/catarse/box_en.jpg +0 -0
  52. data/app/assets/images/catarse/box_pt.jpg +0 -0
  53. data/app/assets/images/catarse/bullet-green.png +0 -0
  54. data/app/assets/images/catarse/button_explore.png +0 -0
  55. data/app/assets/images/catarse/button_send.png +0 -0
  56. data/app/assets/images/catarse/category_icon14x14.png +0 -0
  57. data/app/assets/images/catarse/cc_icon.png +0 -0
  58. data/app/assets/images/catarse/comments_icon28x18.png +0 -0
  59. data/app/assets/images/catarse/comum_logo127x27.png +0 -0
  60. data/app/assets/images/catarse/confirmed_icon.png +0 -0
  61. data/app/assets/images/catarse/delete_16.png +0 -0
  62. data/app/assets/images/catarse/embed_icon19x9.png +0 -0
  63. data/app/assets/images/catarse/expiring_icon20x22.png +0 -0
  64. data/app/assets/images/catarse/explore_icon21x14.png +0 -0
  65. data/app/assets/images/catarse/explore_icon23x15.png +0 -0
  66. data/app/assets/images/catarse/facebook_black_icon.png +0 -0
  67. data/app/assets/images/catarse/facebook_icon13x26.png +0 -0
  68. data/app/assets/images/catarse/faq_icon18x18.png +0 -0
  69. data/app/assets/images/catarse/faq_video.png +0 -0
  70. data/app/assets/images/catarse/flagCity.png +0 -0
  71. data/app/assets/images/catarse/flagCityMg.png +0 -0
  72. data/app/assets/images/catarse/flagCityPoa.png +0 -0
  73. data/app/assets/images/catarse/flagCityRJ.png +0 -0
  74. data/app/assets/images/catarse/flagName.png +0 -0
  75. data/app/assets/images/catarse/flagNameMg.png +0 -0
  76. data/app/assets/images/catarse/flagNamePoa.png +0 -0
  77. data/app/assets/images/catarse/flagNameRJ.png +0 -0
  78. data/app/assets/images/catarse/flagNameSP.png +0 -0
  79. data/app/assets/images/catarse/gift-reward.png +0 -0
  80. data/app/assets/images/catarse/gift.png +0 -0
  81. data/app/assets/images/catarse/glyphicons-halflings-white.png +0 -0
  82. data/app/assets/images/catarse/glyphicons-halflings.png +0 -0
  83. data/app/assets/images/catarse/goal_icon36x17.png +0 -0
  84. data/app/assets/images/catarse/grey.png +0 -0
  85. data/app/assets/images/catarse/heart_icon17x14.png +0 -0
  86. data/app/assets/images/catarse/icon-fb.png +0 -0
  87. data/app/assets/images/catarse/icon-moip.png +0 -0
  88. data/app/assets/images/catarse/icon-paypal.png +0 -0
  89. data/app/assets/images/catarse/icon-tw.png +0 -0
  90. data/app/assets/images/catarse/icon_about.png +0 -0
  91. data/app/assets/images/catarse/icon_backerstep1.png +0 -0
  92. data/app/assets/images/catarse/icon_backerstep2.png +0 -0
  93. data/app/assets/images/catarse/icon_backerstep3.png +0 -0
  94. data/app/assets/images/catarse/icon_backerstep4.png +0 -0
  95. data/app/assets/images/catarse/icon_backerstep5.png +0 -0
  96. data/app/assets/images/catarse/icon_backersucessfull.png +0 -0
  97. data/app/assets/images/catarse/icon_backproject.png +0 -0
  98. data/app/assets/images/catarse/icon_bold.png +0 -0
  99. data/app/assets/images/catarse/icon_calc.png +0 -0
  100. data/app/assets/images/catarse/icon_colective.png +0 -0
  101. data/app/assets/images/catarse/icon_creative.png +0 -0
  102. data/app/assets/images/catarse/icon_credits.png +0 -0
  103. data/app/assets/images/catarse/icon_creditsmoney.png +0 -0
  104. data/app/assets/images/catarse/icon_datestart.png +0 -0
  105. data/app/assets/images/catarse/icon_donation.png +0 -0
  106. data/app/assets/images/catarse/icon_faq.png +0 -0
  107. data/app/assets/images/catarse/icon_gift.png +0 -0
  108. data/app/assets/images/catarse/icon_guidebacker.png +0 -0
  109. data/app/assets/images/catarse/icon_guidelinesstart.png +0 -0
  110. data/app/assets/images/catarse/icon_heart.png +0 -0
  111. data/app/assets/images/catarse/icon_italic.png +0 -0
  112. data/app/assets/images/catarse/icon_licosts.png +0 -0
  113. data/app/assets/images/catarse/icon_limagic.png +0 -0
  114. data/app/assets/images/catarse/icon_limoney.png +0 -0
  115. data/app/assets/images/catarse/icon_link.png +0 -0
  116. data/app/assets/images/catarse/icon_linktext.png +0 -0
  117. data/app/assets/images/catarse/icon_liwork.png +0 -0
  118. data/app/assets/images/catarse/icon_logo.png +0 -0
  119. data/app/assets/images/catarse/icon_media.png +0 -0
  120. data/app/assets/images/catarse/icon_new.png +0 -0
  121. data/app/assets/images/catarse/icon_nonprofit.png +0 -0
  122. data/app/assets/images/catarse/icon_projectnotfunded.png +0 -0
  123. data/app/assets/images/catarse/icon_projectsuccess.png +0 -0
  124. data/app/assets/images/catarse/icon_refreshproject.png +0 -0
  125. data/app/assets/images/catarse/icon_rewards.png +0 -0
  126. data/app/assets/images/catarse/icon_social.png +0 -0
  127. data/app/assets/images/catarse/icon_soldout.png +0 -0
  128. data/app/assets/images/catarse/icon_step1.png +0 -0
  129. data/app/assets/images/catarse/icon_step2.png +0 -0
  130. data/app/assets/images/catarse/icon_step3.png +0 -0
  131. data/app/assets/images/catarse/icon_step4.png +0 -0
  132. data/app/assets/images/catarse/icon_submitbacker.png +0 -0
  133. data/app/assets/images/catarse/icon_tag.png +0 -0
  134. data/app/assets/images/catarse/icon_time.png +0 -0
  135. data/app/assets/images/catarse/icon_url.png +0 -0
  136. data/app/assets/images/catarse/icon_video.png +0 -0
  137. data/app/assets/images/catarse/icon_vimeo.png +0 -0
  138. data/app/assets/images/catarse/institutional_video_icon16x16.png +0 -0
  139. data/app/assets/images/catarse/label_green.png +0 -0
  140. data/app/assets/images/catarse/label_green_list.png +0 -0
  141. data/app/assets/images/catarse/label_orange.png +0 -0
  142. data/app/assets/images/catarse/label_orange_list.png +0 -0
  143. data/app/assets/images/catarse/link_icon14x14.png +0 -0
  144. data/app/assets/images/catarse/logo-fb.jpg +0 -0
  145. data/app/assets/images/catarse/logo.png +0 -0
  146. data/app/assets/images/catarse/min_star12x11.png +0 -0
  147. data/app/assets/images/catarse/moip-choice.png +0 -0
  148. data/app/assets/images/catarse/multide_logo55x36.png +0 -0
  149. data/app/assets/images/catarse/newsletter_icon18x15.png +0 -0
  150. data/app/assets/images/catarse/opendata_icon26x26.png +0 -0
  151. data/app/assets/images/catarse/partners_icon26x26.png +0 -0
  152. data/app/assets/images/catarse/payment_account.jpg +0 -0
  153. data/app/assets/images/catarse/payment_boleto.jpg +0 -0
  154. data/app/assets/images/catarse/payment_cards.jpg +0 -0
  155. data/app/assets/images/catarse/paypal-choice.png +0 -0
  156. data/app/assets/images/catarse/pencil_16.png +0 -0
  157. data/app/assets/images/catarse/play89x89.png +0 -0
  158. data/app/assets/images/catarse/post_title_image.png +0 -0
  159. data/app/assets/images/catarse/power_logo200x43.png +0 -0
  160. data/app/assets/images/catarse/profile_icon19x14.png +0 -0
  161. data/app/assets/images/catarse/project_about.png +0 -0
  162. data/app/assets/images/catarse/recents_icon18x23.png +0 -0
  163. data/app/assets/images/catarse/recents_icon31x17.png +0 -0
  164. data/app/assets/images/catarse/recompensa24x20.png +0 -0
  165. data/app/assets/images/catarse/reward_box.png +0 -0
  166. data/app/assets/images/catarse/reward_count_icon18x17.png +0 -0
  167. data/app/assets/images/catarse/reward_icon.png +0 -0
  168. data/app/assets/images/catarse/schedule_icon19x22.png +0 -0
  169. data/app/assets/images/catarse/search_submit15x15.png +0 -0
  170. data/app/assets/images/catarse/sidebar_backers_icon26x19.png +0 -0
  171. data/app/assets/images/catarse/social_big_icons.png +0 -0
  172. data/app/assets/images/catarse/social_icons.png +0 -0
  173. data/app/assets/images/catarse/submit_back_icon25x22.png +0 -0
  174. data/app/assets/images/catarse/submit_project_icon25x13.png +0 -0
  175. data/app/assets/images/catarse/team_adriano.jpg +0 -0
  176. data/app/assets/images/catarse/team_diego.jpg +0 -0
  177. data/app/assets/images/catarse/team_diogo.jpg +0 -0
  178. data/app/assets/images/catarse/team_evelise.jpg +0 -0
  179. data/app/assets/images/catarse/team_luciana.jpg +0 -0
  180. data/app/assets/images/catarse/team_luis.jpg +0 -0
  181. data/app/assets/images/catarse/team_renato.jpg +0 -0
  182. data/app/assets/images/catarse/team_rodrigo.jpg +0 -0
  183. data/app/assets/images/catarse/team_ton.jpg +0 -0
  184. data/app/assets/images/catarse/thumb_step.jpg +0 -0
  185. data/app/assets/images/catarse/thumbs_up_icon16x16.png +0 -0
  186. data/app/assets/images/catarse/tick_16.png +0 -0
  187. data/app/assets/images/catarse/time_icon19x30.png +0 -0
  188. data/app/assets/images/catarse/title_component149x40.png +0 -0
  189. data/app/assets/images/catarse/title_component241x40.png +0 -0
  190. data/app/assets/images/catarse/twitter_black_icon.png +0 -0
  191. data/app/assets/images/catarse/twitter_icon28x24.png +0 -0
  192. data/app/assets/images/catarse/video_sample_cover477x330.jpg +0 -0
  193. data/app/assets/images/catarse_bootstrap/botao_bemvindo_EN_big.png +0 -0
  194. data/app/assets/images/catarse_bootstrap/botao_bemvindo_PT_big.png +0 -0
  195. data/app/assets/images/catarse_bootstrap/catarse-assets.png +0 -0
  196. data/app/assets/images/catarse_bootstrap/feedback-close.png +0 -0
  197. data/app/assets/images/catarse_bootstrap/feedback-key.png +0 -0
  198. data/app/assets/images/catarse_bootstrap/feedback-open.png +0 -0
  199. data/app/assets/images/catarse_bootstrap/logo_icon_catarse.png +0 -0
  200. data/app/assets/images/catarse_full/.gitkeep +0 -0
  201. data/app/assets/images/channels/avatar.png +0 -0
  202. data/app/assets/images/channels/banner.png +0 -0
  203. data/app/assets/images/channels/banner_tile.jpg +0 -0
  204. data/app/assets/images/channels/capa_asas.jpg +0 -0
  205. data/app/assets/images/channels/header_system.png +0 -0
  206. data/app/assets/images/channels/logo_asas_notificacao.png +0 -0
  207. data/app/assets/images/channels/successful.png +0 -0
  208. data/app/assets/images/delete_16.png +0 -0
  209. data/app/assets/images/dropdown.png +0 -0
  210. data/app/assets/images/facebook_share.png +0 -0
  211. data/app/assets/images/favicon.ico +0 -0
  212. data/app/assets/images/gravatar.png +0 -0
  213. data/app/assets/images/icon_alertheader.png +0 -0
  214. data/app/assets/images/jquery-ui/ui-bg_diagonals-small_0_aaaaaa_40x40.png +0 -0
  215. data/app/assets/images/jquery-ui/ui-bg_diagonals-thick_15_444444_40x40.png +0 -0
  216. data/app/assets/images/jquery-ui/ui-bg_diagonals-thick_95_ffdc2e_40x40.png +0 -0
  217. data/app/assets/images/jquery-ui/ui-bg_glass_55_fbf5d0_1x400.png +0 -0
  218. data/app/assets/images/jquery-ui/ui-bg_highlight-hard_30_285c00_1x100.png +0 -0
  219. data/app/assets/images/jquery-ui/ui-bg_highlight-soft_33_3a8104_1x100.png +0 -0
  220. data/app/assets/images/jquery-ui/ui-bg_highlight-soft_50_4eb305_1x100.png +0 -0
  221. data/app/assets/images/jquery-ui/ui-bg_highlight-soft_60_4ca20b_1x100.png +0 -0
  222. data/app/assets/images/jquery-ui/ui-bg_inset-soft_10_285c00_1x100.png +0 -0
  223. data/app/assets/images/jquery-ui/ui-icons_4eb305_256x240.png +0 -0
  224. data/app/assets/images/jquery-ui/ui-icons_72b42d_256x240.png +0 -0
  225. data/app/assets/images/jquery-ui/ui-icons_cd0a0a_256x240.png +0 -0
  226. data/app/assets/images/jquery-ui/ui-icons_ffffff_256x240.png +0 -0
  227. data/app/assets/images/list_cards.jpg +0 -0
  228. data/app/assets/images/loading.gif +0 -0
  229. data/app/assets/images/locales/en.png +0 -0
  230. data/app/assets/images/locales/es.png +0 -0
  231. data/app/assets/images/locales/list.txt +278 -0
  232. data/app/assets/images/locales/pt.png +0 -0
  233. data/app/assets/images/login_with_facebook_button310x60.png +0 -0
  234. data/app/assets/images/login_with_facebook_button356x60.png +0 -0
  235. data/app/assets/images/logo.png +0 -0
  236. data/app/assets/images/not_successful.en.png +0 -0
  237. data/app/assets/images/not_successful.es.png +0 -0
  238. data/app/assets/images/not_successful.pt.png +0 -0
  239. data/app/assets/images/pencil_16.png +0 -0
  240. data/app/assets/images/project_about.png +0 -0
  241. data/app/assets/images/project_menu_selected.png +0 -0
  242. data/app/assets/images/rewards_left_border.png +0 -0
  243. data/app/assets/images/rewards_right_border.png +0 -0
  244. data/app/assets/images/successful.en.png +0 -0
  245. data/app/assets/images/successful.es.png +0 -0
  246. data/app/assets/images/successful.pt.png +0 -0
  247. data/app/assets/images/tick_16.png +0 -0
  248. data/app/assets/images/tick_32.png +0 -0
  249. data/app/assets/images/twitter_share.png +0 -0
  250. data/app/assets/images/user.png +0 -0
  251. data/app/assets/images/waiting_confirmation.en.png +0 -0
  252. data/app/assets/images/waiting_confirmation.es.png +0 -0
  253. data/app/assets/images/waiting_confirmation.pt.png +0 -0
  254. data/app/assets/javascripts/.gitkeep +0 -0
  255. data/app/assets/javascripts/app/.gitkeep +1 -0
  256. data/app/assets/javascripts/app/adm/users.js +50 -0
  257. data/app/assets/javascripts/app/app.js +50 -0
  258. data/app/assets/javascripts/app/backer.js +60 -0
  259. data/app/assets/javascripts/app/devise/feedback_support.js +23 -0
  260. data/app/assets/javascripts/app/explore.js +65 -0
  261. data/app/assets/javascripts/app/mix_panel.js +76 -0
  262. data/app/assets/javascripts/app/payment.js +23 -0
  263. data/app/assets/javascripts/app/project.js +47 -0
  264. data/app/assets/javascripts/app/project/project_backers.js +27 -0
  265. data/app/assets/javascripts/app/project/project_comments.js +14 -0
  266. data/app/assets/javascripts/app/project/project_sidebar.js +74 -0
  267. data/app/assets/javascripts/app/project/updates.js +44 -0
  268. data/app/assets/javascripts/app/project_form.js +60 -0
  269. data/app/assets/javascripts/app/registration.js +23 -0
  270. data/app/assets/javascripts/app/review_form.js +48 -0
  271. data/app/assets/javascripts/app/user.js +21 -0
  272. data/app/assets/javascripts/app/user/user_backers.js +15 -0
  273. data/app/assets/javascripts/app/user/user_projects.js +20 -0
  274. data/app/assets/javascripts/application.js +23 -0
  275. data/app/assets/javascripts/catarse_full/.gitkeep +0 -0
  276. data/app/assets/javascripts/lib/backbone.js +1571 -0
  277. data/app/assets/javascripts/lib/bootstrap.min.js +7 -0
  278. data/app/assets/javascripts/lib/form.js +24 -0
  279. data/app/assets/javascripts/lib/infinite_scroll.js +43 -0
  280. data/app/assets/javascripts/lib/jquery-ui.js +2252 -0
  281. data/app/assets/javascripts/lib/jquery.js +8842 -0
  282. data/app/assets/javascripts/lib/jquery.maskedinput.js +338 -0
  283. data/app/assets/javascripts/lib/modal.js +43 -0
  284. data/app/assets/javascripts/lib/skull.js +78 -0
  285. data/app/assets/javascripts/lib/tabs.js +27 -0
  286. data/app/assets/javascripts/lib/timed_input.js +18 -0
  287. data/app/assets/javascripts/lib/twitter.js +1 -0
  288. data/app/assets/javascripts/lib/underscore.js +1227 -0
  289. data/app/assets/stylesheets/.gitkeep +0 -0
  290. data/app/assets/stylesheets/animate.min.css +1 -0
  291. data/app/assets/stylesheets/application.css.sass +47 -0
  292. data/app/assets/stylesheets/catarse.css.sass +26 -0
  293. data/app/assets/stylesheets/catarse.sass +26 -0
  294. data/app/assets/stylesheets/catarse_bootstrap/_alerts.sass +16 -0
  295. data/app/assets/stylesheets/catarse_bootstrap/_buttons.sass +35 -0
  296. data/app/assets/stylesheets/catarse_bootstrap/_colors.sass +39 -0
  297. data/app/assets/stylesheets/catarse_bootstrap/_dropdown.sass +29 -0
  298. data/app/assets/stylesheets/catarse_bootstrap/_elements.sass +43 -0
  299. data/app/assets/stylesheets/catarse_bootstrap/_fonts.sass +46 -0
  300. data/app/assets/stylesheets/catarse_bootstrap/_header.sass +101 -0
  301. data/app/assets/stylesheets/catarse_bootstrap/_main_sidebar.sass +91 -0
  302. data/app/assets/stylesheets/catarse_bootstrap/_notices.sass +27 -0
  303. data/app/assets/stylesheets/catarse_bootstrap/_project_box.sass +104 -0
  304. data/app/assets/stylesheets/catarse_bootstrap/_settings.sass +72 -0
  305. data/app/assets/stylesheets/catarse_bootstrap/grid/foundation.sass +667 -0
  306. data/app/assets/stylesheets/catarse_bootstrap/grid/normalize.sass +327 -0
  307. data/app/assets/stylesheets/catarse_bootstrap/pages/devise.sass +102 -0
  308. data/app/assets/stylesheets/catarse_bootstrap/pages/passwords/new.sass +3 -0
  309. data/app/assets/stylesheets/catarse_full/.gitkeep +0 -0
  310. data/app/assets/stylesheets/content/_body.sass +82 -0
  311. data/app/assets/stylesheets/content/_explore.sass +68 -0
  312. data/app/assets/stylesheets/content/_footer.sass +88 -0
  313. data/app/assets/stylesheets/content/_header.sass +102 -0
  314. data/app/assets/stylesheets/content/_recommended_header.sass +174 -0
  315. data/app/assets/stylesheets/content/_sessions.sass +111 -0
  316. data/app/assets/stylesheets/content/_sidebar.sass +179 -0
  317. data/app/assets/stylesheets/jquery-ui.css.scss +572 -0
  318. data/app/assets/stylesheets/miv/_alert.scss +57 -0
  319. data/app/assets/stylesheets/miv/_bootstrap.scss +4652 -0
  320. data/app/assets/stylesheets/miv/_buttons.sass +41 -0
  321. data/app/assets/stylesheets/miv/_colors.sass +75 -0
  322. data/app/assets/stylesheets/miv/_dropdown.sass +28 -0
  323. data/app/assets/stylesheets/miv/_embed.sass +112 -0
  324. data/app/assets/stylesheets/miv/_flash.sass +18 -0
  325. data/app/assets/stylesheets/miv/_form.scss +626 -0
  326. data/app/assets/stylesheets/miv/_index.sass +151 -0
  327. data/app/assets/stylesheets/miv/_locales.sass +34 -0
  328. data/app/assets/stylesheets/miv/_modal.sass +38 -0
  329. data/app/assets/stylesheets/miv/_overlay.sass +10 -0
  330. data/app/assets/stylesheets/miv/_projects.sass +159 -0
  331. data/app/assets/stylesheets/miv/_projects_land.sass +177 -0
  332. data/app/assets/stylesheets/miv/_table.scss +134 -0
  333. data/app/assets/stylesheets/miv/_tabs.sass +31 -0
  334. data/app/assets/stylesheets/resources/adm/adm.sass +109 -0
  335. data/app/assets/stylesheets/resources/backers/_create.sass +432 -0
  336. data/app/assets/stylesheets/resources/backers/_new.sass +237 -0
  337. data/app/assets/stylesheets/resources/backers/_thank_you.sass +83 -0
  338. data/app/assets/stylesheets/resources/channels/_about.sass +67 -0
  339. data/app/assets/stylesheets/resources/channels/_general.sass +60 -0
  340. data/app/assets/stylesheets/resources/channels/_icomoon.sass +47 -0
  341. data/app/assets/stylesheets/resources/channels/_profile.sass +120 -0
  342. data/app/assets/stylesheets/resources/projects/_index.sass +43 -0
  343. data/app/assets/stylesheets/resources/projects/_new.sass +117 -0
  344. data/app/assets/stylesheets/resources/projects/_pending_backers.sass +80 -0
  345. data/app/assets/stylesheets/resources/projects/_rewards.sass +22 -0
  346. data/app/assets/stylesheets/resources/projects/_show.sass +749 -0
  347. data/app/assets/stylesheets/resources/projects/_start.sass +191 -0
  348. data/app/assets/stylesheets/resources/static/_about.sass +125 -0
  349. data/app/assets/stylesheets/resources/static/_default.sass +576 -0
  350. data/app/assets/stylesheets/resources/users/_show.sass +284 -0
  351. data/app/controllers/.gitkeep +0 -0
  352. data/app/controllers/adm/backers_controller.rb +40 -0
  353. data/app/controllers/adm/base_controller.rb +37 -0
  354. data/app/controllers/adm/financials_controller.rb +49 -0
  355. data/app/controllers/adm/projects_controller.rb +32 -0
  356. data/app/controllers/adm/reports/backer_reports_controller.rb +6 -0
  357. data/app/controllers/adm/reports/base_controller.rb +6 -0
  358. data/app/controllers/adm/statistics_controller.rb +6 -0
  359. data/app/controllers/adm/users_controller.rb +26 -0
  360. data/app/controllers/application_controller.rb +118 -0
  361. data/app/controllers/channels/adm/projects_controller.rb +36 -0
  362. data/app/controllers/channels/adm/reports/subscriber_reports_controller.rb +7 -0
  363. data/app/controllers/channels/adm/statistics_controller.rb +13 -0
  364. data/app/controllers/channels/base_controller.rb +6 -0
  365. data/app/controllers/channels/channels_subscribers_controller.rb +35 -0
  366. data/app/controllers/channels/profiles_controller.rb +11 -0
  367. data/app/controllers/channels/projects_controller.rb +22 -0
  368. data/app/controllers/explore_controller.rb +6 -0
  369. data/app/controllers/omniauth_callbacks_controller.rb +28 -0
  370. data/app/controllers/passwords_controller.rb +21 -0
  371. data/app/controllers/projects/backers_controller.rb +85 -0
  372. data/app/controllers/projects/updates_controller.rb +28 -0
  373. data/app/controllers/projects_controller.rb +84 -0
  374. data/app/controllers/reports/backer_reports_for_project_owners_controller.rb +36 -0
  375. data/app/controllers/reports/base_controller.rb +6 -0
  376. data/app/controllers/rewards_controller.rb +36 -0
  377. data/app/controllers/static_controller.rb +28 -0
  378. data/app/controllers/unsubscribes_controller.rb +18 -0
  379. data/app/controllers/users/backers_controller.rb +29 -0
  380. data/app/controllers/users/projects_controller.rb +13 -0
  381. data/app/controllers/users_controller.rb +63 -0
  382. data/app/decorators/channel_decorator.rb +7 -0
  383. data/app/decorators/project_decorator.rb +69 -0
  384. data/app/decorators/user_decorator.rb +34 -0
  385. data/app/helpers/.gitkeep +0 -0
  386. data/app/helpers/channels/base_helper.rb +2 -0
  387. data/app/mailers/.gitkeep +0 -0
  388. data/app/mailers/credits_mailer.rb +9 -0
  389. data/app/mailers/notifications_mailer.rb +21 -0
  390. data/app/models/.gitkeep +0 -0
  391. data/app/models/ability.rb +129 -0
  392. data/app/models/authorization.rb +4 -0
  393. data/app/models/backer.rb +242 -0
  394. data/app/models/backer_report.rb +3 -0
  395. data/app/models/backer_reports_for_project_owner.rb +2 -0
  396. data/app/models/backers_by_period.rb +9 -0
  397. data/app/models/category.rb +17 -0
  398. data/app/models/channel.rb +22 -0
  399. data/app/models/channels_subscriber.rb +5 -0
  400. data/app/models/configuration.rb +36 -0
  401. data/app/models/notification.rb +35 -0
  402. data/app/models/notification_type.rb +4 -0
  403. data/app/models/oauth_provider.rb +6 -0
  404. data/app/models/payment_notification.rb +4 -0
  405. data/app/models/project.rb +335 -0
  406. data/app/models/project_total.rb +2 -0
  407. data/app/models/projects_by_period.rb +9 -0
  408. data/app/models/projects_for_home.rb +11 -0
  409. data/app/models/reward.rb +70 -0
  410. data/app/models/state.rb +13 -0
  411. data/app/models/statistics.rb +2 -0
  412. data/app/models/subscriber_report.rb +3 -0
  413. data/app/models/unsubscribe.rb +10 -0
  414. data/app/models/update.rb +57 -0
  415. data/app/models/user.rb +250 -0
  416. data/app/models/user_total.rb +3 -0
  417. data/app/observers/backer_observer.rb +61 -0
  418. data/app/observers/notification_observer.rb +7 -0
  419. data/app/observers/payment_notification_observer.rb +16 -0
  420. data/app/observers/project_observer.rb +113 -0
  421. data/app/observers/update_observer.rb +7 -0
  422. data/app/observers/user_observer.rb +16 -0
  423. data/app/uploaders/image_uploader.rb +24 -0
  424. data/app/uploaders/project_uploader.rb +29 -0
  425. data/app/uploaders/user_uploader.rb +12 -0
  426. data/app/views/.gitkeep +0 -0
  427. data/app/views/adm/backers/index.html.slim +170 -0
  428. data/app/views/adm/financials/index.html.slim +99 -0
  429. data/app/views/adm/projects/index.html.slim +128 -0
  430. data/app/views/adm/statistics/index.html.slim +40 -0
  431. data/app/views/adm/users/index.html.slim +74 -0
  432. data/app/views/catarse_bootstrap/devise/mailer/reset_password_instructions.en.html.slim +15 -0
  433. data/app/views/catarse_bootstrap/devise/mailer/reset_password_instructions.pt.html.slim +16 -0
  434. data/app/views/catarse_bootstrap/devise/mailer/unlock_instructions.html.erb +7 -0
  435. data/app/views/catarse_bootstrap/devise/passwords/edit.html.slim +26 -0
  436. data/app/views/catarse_bootstrap/devise/passwords/new.html.slim +21 -0
  437. data/app/views/catarse_bootstrap/devise/registrations/new.html.slim +48 -0
  438. data/app/views/catarse_bootstrap/devise/sessions/new.html.slim +40 -0
  439. data/app/views/catarse_bootstrap/devise/shared/_alert.html.slim +11 -0
  440. data/app/views/catarse_bootstrap/devise/shared/_header.html.slim +5 -0
  441. data/app/views/catarse_bootstrap/layouts/_login_feedback_support.html.slim +16 -0
  442. data/app/views/catarse_bootstrap/layouts/_mailer_styles.html.erb +22 -0
  443. data/app/views/catarse_bootstrap/layouts/_uservoice.html.slim +2 -0
  444. data/app/views/catarse_bootstrap/layouts/catarse_bootstrap.html.slim +21 -0
  445. data/app/views/catarse_bootstrap/layouts/email.html.slim +39 -0
  446. data/app/views/catarse_bootstrap/notifications_mailer/new_user_registration.en.html.slim +44 -0
  447. data/app/views/catarse_bootstrap/notifications_mailer/new_user_registration.pt.html.slim +45 -0
  448. data/app/views/catarse_bootstrap/notifications_mailer/updates.en.html.slim +4 -0
  449. data/app/views/catarse_bootstrap/notifications_mailer/updates.pt.html.slim +4 -0
  450. data/app/views/channels/adm/projects/index.html.slim +121 -0
  451. data/app/views/channels/adm/statistics/index.html.slim +21 -0
  452. data/app/views/channels/base/index.html.slim +2 -0
  453. data/app/views/channels/profiles/_footer.html.slim +13 -0
  454. data/app/views/channels/profiles/how_it_works.html.slim +67 -0
  455. data/app/views/channels/profiles/show.html.slim +47 -0
  456. data/app/views/channels/projects/_banner.html.slim +8 -0
  457. data/app/views/channels/projects/_project.html.slim +12 -0
  458. data/app/views/channels/projects/new.html.slim +128 -0
  459. data/app/views/credits_mailer/request_refund_from.text.erb +11 -0
  460. data/app/views/custom/.gitkeep +0 -0
  461. data/app/views/explore/index.html.slim +47 -0
  462. data/app/views/layouts/_analytics.html.slim +9 -0
  463. data/app/views/layouts/_announcement.html.slim +4 -0
  464. data/app/views/layouts/_catarse_bootstrap_notices.html.slim +4 -0
  465. data/app/views/layouts/_classic_uservoice.html.slim +31 -0
  466. data/app/views/layouts/_facebook_like.html.slim +2 -0
  467. data/app/views/layouts/_facebook_sdk.html.slim +20 -0
  468. data/app/views/layouts/_flash.html.slim +6 -0
  469. data/app/views/layouts/_header.html.slim +49 -0
  470. data/app/views/layouts/_locales.html.slim +7 -0
  471. data/app/views/layouts/_new_uservoice.html.slim +20 -0
  472. data/app/views/layouts/_twitter.html.erb +1 -0
  473. data/app/views/layouts/application.html.slim +71 -0
  474. data/app/views/layouts/channel_email.html.slim +23 -0
  475. data/app/views/layouts/email.html.slim +26 -0
  476. data/app/views/layouts/embed.html.slim +13 -0
  477. data/app/views/notifications_mailer/adm_project_deadline.en.html.slim +3 -0
  478. data/app/views/notifications_mailer/adm_project_deadline.pt.html.slim +3 -0
  479. data/app/views/notifications_mailer/backer_canceled_after_confirmed.html.slim +12 -0
  480. data/app/views/notifications_mailer/backer_confirmed_after_project_was_closed.en.html.slim +8 -0
  481. data/app/views/notifications_mailer/backer_confirmed_after_project_was_closed.pt.html.slim +8 -0
  482. data/app/views/notifications_mailer/backer_project_successful.en.html.slim +48 -0
  483. data/app/views/notifications_mailer/backer_project_successful.pt.html.slim +50 -0
  484. data/app/views/notifications_mailer/backer_project_unsuccessful.en.html.slim +39 -0
  485. data/app/views/notifications_mailer/backer_project_unsuccessful.pt.html.slim +41 -0
  486. data/app/views/notifications_mailer/confirm_backer.en.html.slim +43 -0
  487. data/app/views/notifications_mailer/confirm_backer.pt.html.slim +45 -0
  488. data/app/views/notifications_mailer/credits_warning.en.html.slim +41 -0
  489. data/app/views/notifications_mailer/credits_warning.pt.html.slim +40 -0
  490. data/app/views/notifications_mailer/new_draft_project.en.html.slim +34 -0
  491. data/app/views/notifications_mailer/new_draft_project.pt.html.slim +34 -0
  492. data/app/views/notifications_mailer/new_draft_project_channel.en.html.slim +34 -0
  493. data/app/views/notifications_mailer/new_draft_project_channel.pt.html.slim +34 -0
  494. data/app/views/notifications_mailer/new_features.en.html.slim +30 -0
  495. data/app/views/notifications_mailer/new_features.pt.html.slim +30 -0
  496. data/app/views/notifications_mailer/payment_slip.en.html.slim +19 -0
  497. data/app/views/notifications_mailer/payment_slip.pt.html.slim +24 -0
  498. data/app/views/notifications_mailer/pending_backer_project_unsuccessful.en.html.slim +44 -0
  499. data/app/views/notifications_mailer/pending_backer_project_unsuccessful.pt.html.slim +44 -0
  500. data/app/views/notifications_mailer/processing_payment.en.html.slim +24 -0
  501. data/app/views/notifications_mailer/processing_payment.pt.html.slim +29 -0
  502. data/app/views/notifications_mailer/project_in_wainting_funds.en.html.slim +35 -0
  503. data/app/views/notifications_mailer/project_in_wainting_funds.pt.html.slim +35 -0
  504. data/app/views/notifications_mailer/project_owner_backer_confirmed.en.html.slim +33 -0
  505. data/app/views/notifications_mailer/project_owner_backer_confirmed.pt.html.slim +34 -0
  506. data/app/views/notifications_mailer/project_received.en.html.slim +38 -0
  507. data/app/views/notifications_mailer/project_received.pt.html.slim +50 -0
  508. data/app/views/notifications_mailer/project_received_channel.en.html.slim +52 -0
  509. data/app/views/notifications_mailer/project_received_channel.pt.html.slim +52 -0
  510. data/app/views/notifications_mailer/project_rejected.en.html.slim +33 -0
  511. data/app/views/notifications_mailer/project_rejected.pt.html.slim +33 -0
  512. data/app/views/notifications_mailer/project_success.en.html.slim +30 -0
  513. data/app/views/notifications_mailer/project_success.pt.html.slim +30 -0
  514. data/app/views/notifications_mailer/project_unsuccessful.en.html.slim +42 -0
  515. data/app/views/notifications_mailer/project_unsuccessful.pt.html.slim +42 -0
  516. data/app/views/notifications_mailer/project_visible.en.html.slim +65 -0
  517. data/app/views/notifications_mailer/project_visible.pt.html.slim +65 -0
  518. data/app/views/projects/_admin_fields.html.slim +15 -0
  519. data/app/views/projects/_draft_warning.html.slim +23 -0
  520. data/app/views/projects/_failed_warning.html.slim +21 -0
  521. data/app/views/projects/_formatting_tips.en.html.slim +19 -0
  522. data/app/views/projects/_formatting_tips.pt.html.slim +20 -0
  523. data/app/views/projects/_online_warning.html.slim +33 -0
  524. data/app/views/projects/_project.html.slim +23 -0
  525. data/app/views/projects/_project_about.html.slim +20 -0
  526. data/app/views/projects/_project_edit.html.slim +32 -0
  527. data/app/views/projects/_project_header.html.slim +34 -0
  528. data/app/views/projects/_project_reports.html.slim +22 -0
  529. data/app/views/projects/_project_templates.html.slim +3 -0
  530. data/app/views/projects/_recommended_header.html.slim +19 -0
  531. data/app/views/projects/_rejected_warning.html.slim +10 -0
  532. data/app/views/projects/_successful_warning.html.slim +29 -0
  533. data/app/views/projects/_twitter_timeline.html.slim +2 -0
  534. data/app/views/projects/_waiting_funds_warning.html.slim +34 -0
  535. data/app/views/projects/backers/_anonymous_warning.en.html.slim +5 -0
  536. data/app/views/projects/backers/_anonymous_warning.pt.html.slim +5 -0
  537. data/app/views/projects/backers/_back_text.en.html.slim +11 -0
  538. data/app/views/projects/backers/_back_text.pt.html.slim +11 -0
  539. data/app/views/projects/backers/_backer.html.slim +42 -0
  540. data/app/views/projects/backers/create.html.slim +75 -0
  541. data/app/views/projects/backers/new.html.slim +40 -0
  542. data/app/views/projects/backers/show.html.slim +26 -0
  543. data/app/views/projects/embed.html.slim +2 -0
  544. data/app/views/projects/embed_panel.html.slim +11 -0
  545. data/app/views/projects/index.html.slim +70 -0
  546. data/app/views/projects/new.html.slim +134 -0
  547. data/app/views/projects/show.html.slim +169 -0
  548. data/app/views/projects/start.html.slim +121 -0
  549. data/app/views/projects/updates/_update.html.slim +17 -0
  550. data/app/views/projects/updates/new.html.slim +22 -0
  551. data/app/views/projects/video_embed.html.slim +8 -0
  552. data/app/views/projects_mailer/start_project_email.html.slim +29 -0
  553. data/app/views/rewards/_form.html.slim +19 -0
  554. data/app/views/rewards/edit.html.slim +1 -0
  555. data/app/views/rewards/index.html.slim +55 -0
  556. data/app/views/rewards/new.html.slim +1 -0
  557. data/app/views/static/_guidelines_text.pt.html.slim +17 -0
  558. data/app/views/static/_how_it_works.en.html.slim +11 -0
  559. data/app/views/static/_how_it_works.pt.html.slim +11 -0
  560. data/app/views/static/_more_tips.pt.html.slim +20 -0
  561. data/app/views/static/about.html.slim +79 -0
  562. data/app/views/static/guidelines.html.slim +22 -0
  563. data/app/views/static/guidelines_backers.html.slim +94 -0
  564. data/app/views/static/guidelines_start.html.slim +90 -0
  565. data/app/views/static/guidelines_tips.html.slim +68 -0
  566. data/app/views/static/sitemap.builder +61 -0
  567. data/app/views/users/_credits.html.slim +44 -0
  568. data/app/views/users/_current_user_fields.html.slim +76 -0
  569. data/app/views/users/_project.html.slim +60 -0
  570. data/app/views/users/_unsubscribes.html.slim +23 -0
  571. data/app/views/users/backers/index.html.slim +2 -0
  572. data/app/views/users/projects/index.html.slim +3 -0
  573. data/app/views/users/set_email.html.slim +16 -0
  574. data/app/views/users/show.html.slim +72 -0
  575. data/app/views/users/uservoice_gadget.html.slim +45 -0
  576. data/app/workers/notify_update_worker.rb +9 -0
  577. data/config/boot.rb +13 -0
  578. data/config/compass.rb +5 -0
  579. data/config/environment.rb +5 -0
  580. data/config/environments/development.rb +46 -0
  581. data/config/environments/production.rb +70 -0
  582. data/config/environments/test.rb +44 -0
  583. data/config/initializers/backtrace_silencers.rb +7 -0
  584. data/config/initializers/capybara.rb +5 -0
  585. data/config/initializers/carrierwave.rb +13 -0
  586. data/config/initializers/default_url_options.rb +6 -0
  587. data/config/initializers/devise.rb +252 -0
  588. data/config/initializers/formtastic.rb +9 -0
  589. data/config/initializers/google_analytics.rb +3 -0
  590. data/config/initializers/http_accept_language.rb +7 -0
  591. data/config/initializers/inflections.rb +13 -0
  592. data/config/initializers/locale.rb +9 -0
  593. data/config/initializers/mailchimp.rb +1 -0
  594. data/config/initializers/mime_types.rb +5 -0
  595. data/config/initializers/pluralize.rb +5 -0
  596. data/config/initializers/schema_associations.rb +3 -0
  597. data/config/initializers/secret_token.rb +16 -0
  598. data/config/initializers/sendgrid.rb +15 -0
  599. data/config/initializers/session_store.rb +15 -0
  600. data/config/initializers/statistics_loader_development.rb +4 -0
  601. data/config/initializers/timeout.rb +1 -0
  602. data/config/initializers/wrap_parameters.rb +14 -0
  603. data/config/locales/.wti.sample +14 -0
  604. data/config/locales/adm.en.yml +107 -0
  605. data/config/locales/adm.pt.yml +150 -0
  606. data/config/locales/catarse_bootstrap/models/user.en.yml +13 -0
  607. data/config/locales/catarse_bootstrap/models/user.pt.yml +13 -0
  608. data/config/locales/catarse_bootstrap/pages/forgot_password.en.yml +14 -0
  609. data/config/locales/catarse_bootstrap/pages/forgot_password.pt.yml +14 -0
  610. data/config/locales/catarse_bootstrap/pages/login.en.yml +16 -0
  611. data/config/locales/catarse_bootstrap/pages/login.pt.yml +16 -0
  612. data/config/locales/catarse_bootstrap/pages/reset_password.en.yml +14 -0
  613. data/config/locales/catarse_bootstrap/pages/reset_password.pt.yml +14 -0
  614. data/config/locales/catarse_bootstrap/pages/sign_up.en.yml +18 -0
  615. data/config/locales/catarse_bootstrap/pages/sign_up.pt.yml +17 -0
  616. data/config/locales/channels.pt.yml +100 -0
  617. data/config/locales/devise.en.yml +99 -0
  618. data/config/locales/devise.pt.yml +98 -0
  619. data/config/locales/en.yml +872 -0
  620. data/config/locales/notifications.en.yml +74 -0
  621. data/config/locales/notifications.pt.yml +74 -0
  622. data/config/locales/pt.yml +896 -0
  623. data/config/locales/rails.en.yml +209 -0
  624. data/config/locales/rails.pt.yml +211 -0
  625. data/config/locales/will_paginate.en.yml +5 -0
  626. data/config/locales/will_paginate.pt.yml +5 -0
  627. data/config/newrelic.yml +227 -0
  628. data/config/routes.rb +150 -0
  629. data/config/sidekiq.yml +1 -0
  630. data/config/unicorn.rb +38 -0
  631. data/db/migrate/20121226120921_initial_schema.rb +1836 -0
  632. data/db/migrate/20121227012003_user_totals_back_to_state_machine.rb +53 -0
  633. data/db/migrate/20121227012324_statistics_back_to_state_machine.rb +47 -0
  634. data/db/migrate/20121230111351_add_online_date_to_projects.rb +5 -0
  635. data/db/migrate/20130102180139_update_projects_to_state_machine_again.rb +25 -0
  636. data/db/migrate/20130104005632_add_moip_login_to_users.rb +5 -0
  637. data/db/migrate/20130104104501_add_how_know_and_more_links_to_projects.rb +6 -0
  638. data/db/migrate/20130105123546_add_first_backers_to_projects.rb +5 -0
  639. data/db/migrate/20130110191750_add_uploaded_image_to_projects.rb +5 -0
  640. data/db/migrate/20130117205659_alter_projects_drop_video_url_constraint.rb +15 -0
  641. data/db/migrate/20130118193907_fix_statistics_view.rb +45 -0
  642. data/db/migrate/20130121162447_create_backer_reports.rb +41 -0
  643. data/db/migrate/20130121204224_fix_projects_states.rb +11 -0
  644. data/db/migrate/20130121212325_fix_statistcs_again.rb +45 -0
  645. data/db/migrate/20130131121553_add_cpf_to_backer_report.rb +75 -0
  646. data/db/migrate/20130201200604_remove_curated_pages.rb +9 -0
  647. data/db/migrate/20130201202648_remove_projects_managers.rb +9 -0
  648. data/db/migrate/20130201202829_remove_active_admin_comments.rb +9 -0
  649. data/db/migrate/20130201205659_remove_institutional_videos.rb +9 -0
  650. data/db/migrate/20130204192704_create_backer_reports_for_project_owner.rb +33 -0
  651. data/db/migrate/20130205143533_remove_credits_from_users.rb +9 -0
  652. data/db/migrate/20130206121758_fix_view_backer_reports_for_project_owner.rb +34 -0
  653. data/db/migrate/20130211174609_add_name_en_to_categories.rb +5 -0
  654. data/db/migrate/20130212145115_rename_name_to_name_pt.rb +5 -0
  655. data/db/migrate/20130213184141_change_permalink_to_not_null.rb +17 -0
  656. data/db/migrate/20130218201312_create_users_oauth_providers.rb +10 -0
  657. data/db/migrate/20130218201751_migrate_user_data_to_users_oath_providers.rb +12 -0
  658. data/db/migrate/20130221171018_rename_users_oath_providers.rb +21 -0
  659. data/db/migrate/20130221172840_populate_authorizations.rb +12 -0
  660. data/db/migrate/20130221175717_remove_static_contents.rb +13 -0
  661. data/db/migrate/20130221184144_update_oauth_provider_name_to_lower.rb +8 -0
  662. data/db/migrate/20130221185532_recreate_statistics_with_new_users.rb +62 -0
  663. data/db/migrate/20130221201732_remove_secondary_users.rb +82 -0
  664. data/db/migrate/20130222163633_add_state_inscription_to_user.rb +5 -0
  665. data/db/migrate/20130225135512_update_user_emails_from_backers.rb +15 -0
  666. data/db/migrate/20130225141802_alter_user_drop_provider_uid_constraints.rb +15 -0
  667. data/db/migrate/20130228141234_add_unique_index_to_configuration.rb +5 -0
  668. data/db/migrate/20130304193806_create_channel_profiles.rb +12 -0
  669. data/db/migrate/20130307074614_create_versions.rb +24 -0
  670. data/db/migrate/20130307090153_add_reindex_versions_to_rewards.rb +5 -0
  671. data/db/migrate/20130308200907_add_user_name_on_backer_report_for_project_owner.rb +62 -0
  672. data/db/migrate/20130311191444_drop_uid_and_provider_constraint_on_users.rb +13 -0
  673. data/db/migrate/20130311192846_remove_unnecessary_user_indexes.rb +14 -0
  674. data/db/migrate/20130312001021_fix_duplicate_emails.rb +26 -0
  675. data/db/migrate/20130313032607_rename_channels_profiles_to_channels.rb +9 -0
  676. data/db/migrate/20130313034356_create_channels_projects.rb +8 -0
  677. data/db/migrate/20130319131919_create_channels_trustees.rb +12 -0
  678. data/db/migrate/20130410181958_add_twitter_and_facebook_and_email_to_channels.rb +7 -0
  679. data/db/migrate/20130410190247_add_image_to_channels.rb +5 -0
  680. data/db/migrate/20130410191240_add_website_to_channels.rb +5 -0
  681. data/db/migrate/20130411193016_create_channels_subscribers.rb +13 -0
  682. data/db/migrate/20130419184530_add_state_to_backers.rb +5 -0
  683. data/db/migrate/20130422071805_add_notification_type_draft_channel.rb +13 -0
  684. data/db/migrate/20130422072051_add_notification_type_project_received_channel.rb +13 -0
  685. data/db/migrate/20130423162359_update_user_total_to_backer_state_machine.rb +59 -0
  686. data/db/migrate/20130424173128_add_backer_state_machine_into_statistics.rb +61 -0
  687. data/db/migrate/20130426204503_add_row_order_to_rewards.rb +7 -0
  688. data/db/migrate/20130429142823_rename_categories.rb +12 -0
  689. data/db/migrate/20130429144749_add_new_categories.rb +27 -0
  690. data/db/migrate/20130429153115_move_projects_to_art_and_remove_old_categories.rb +15 -0
  691. data/db/migrate/20130430203333_add_layout_to_notification_type.rb +5 -0
  692. data/db/migrate/20130502175814_add_anonymous_to_reports_to_project_owner.rb +37 -0
  693. data/db/migrate/20130505013655_update_backers_state_machine.rb +35 -0
  694. data/db/migrate/20130506191243_update_backer_reports_to_project_owner_view_to_backer_state_machine.rb +65 -0
  695. data/db/migrate/20130506191508_update_backer_reports_to_backer_state_machine.rb +74 -0
  696. data/db/migrate/20130514132519_add_waiting_confirmation_on_statistics_view.rb +63 -0
  697. data/db/migrate/20130514185010_drop_views.rb +35 -0
  698. data/db/migrate/20130514185116_fix_project_owner_view.rb +66 -0
  699. data/db/migrate/20130514185926_remove_boolean_fields_from_projects.rb +18 -0
  700. data/db/migrate/20130515192404_remove_boolean_fields_from_backers.rb +14 -0
  701. data/db/migrate/20130523144013_fix_project_total_to_use_refunded_and_requested_refund_too.rb +15 -0
  702. data/db/migrate/20130523173609_fix_project_total_again_some_regex_error.rb +15 -0
  703. data/db/migrate/20130527204639_add_video_embed_url_to_projects.rb +5 -0
  704. data/db/migrate/20130529171845_update_backers_that_are_in_refunded_when_project_is_online.rb +17 -0
  705. data/db/migrate/20130604171730_add_index_to_payment_notification_on_backer_id.rb +5 -0
  706. data/db/migrate/20130604172253_update_online_date_for_legacy_projects.rb +10 -0
  707. data/db/migrate/20130604175953_remove_expires_at_from_views.rb +11 -0
  708. data/db/migrate/20130604180503_remove_expires_at_from_projects.rb +11 -0
  709. data/db/migrate/20130607222330_remove_image_url_from_projects.rb +9 -0
  710. data/db/migrate/20130617175402_create_projects_chart_view.rb +51 -0
  711. data/db/migrate/20130618175432_create_backers_by_period_view.rb +57 -0
  712. data/db/migrate/20130626122439_add_expires_at_function.rb +12 -0
  713. data/db/migrate/20130626124055_drop_payment_logs.rb +8 -0
  714. data/db/migrate/20130702192659_update_backers_by_period_view_with_deleted_backer_state.rb +107 -0
  715. data/db/migrate/20130703171547_add_exclusive_to_updates.rb +5 -0
  716. data/db/migrate/20130705131825_replace_expires_at_to_include_timezone.rb +18 -0
  717. data/db/migrate/20130705184845_alter_statistics_view_add_deleted_backer_state.rb +61 -0
  718. data/db/migrate/20130710122804_add_days_to_delivery_into_rewards.rb +5 -0
  719. data/db/migrate/20130722222945_remove_legacy_columns_from_users.rb +10 -0
  720. data/db/migrate/20130730232043_add_total_payments_service_fee_into_project_totals.rb +27 -0
  721. data/db/migrate/20130805230126_add_total_backed_projects_to_user_total.rb +60 -0
  722. data/db/migrate/20130812191450_show_refunded_on_backers_report.rb +74 -0
  723. data/db/migrate/20130814174329_alter_timestamp_to_include_timezone.rb +17 -0
  724. data/db/migrate/20130815161926_create_recommendations_view.rb +64 -0
  725. data/db/migrate/20130818015857_add_projects_home_view.rb +37 -0
  726. data/db/migrate/20130822215532_fix_credits_into_user_totals_view.rb +67 -0
  727. data/db/migrate/20130827210414_revert_expires_at.rb +12 -0
  728. data/db/migrate/20130828160026_use_expires_at_in_view.rb +11 -0
  729. data/db/migrate/20130829180232_use_timezone_instead_of_hardcoded_3.rb +12 -0
  730. data/db/migrate/20130905153553_add_sessions_table.rb +12 -0
  731. data/db/migrate/20130911180657_create_subscriber_reports.rb +8 -0
  732. data/db/seeds.rb +122 -0
  733. data/db/seeds/add-users.rb +40 -0
  734. data/db/seeds/my-seeds-local.example.rb +85 -0
  735. data/lib/blog.rb +14 -0
  736. data/lib/calendar.rb +19 -0
  737. data/lib/catarse_auto_html.rb +23 -0
  738. data/lib/catarse_full.rb +4 -0
  739. data/lib/catarse_full/engine.rb +77 -0
  740. data/lib/catarse_full/version.rb +3 -0
  741. data/lib/payment_engines.rb +26 -0
  742. data/lib/tasks/.gitkeep +0 -0
  743. data/lib/tasks/catarse_full_tasks.rake +4 -0
  744. data/lib/tasks/config.rake +56 -0
  745. data/lib/tasks/cron.rake +76 -0
  746. data/lib/tasks/db_seed.rake +15 -0
  747. data/lib/tasks/jasmine.rake +8 -0
  748. data/lib/tasks/send_old_posts_to_tumblr.rake +14 -0
  749. data/lib/tasks/users.rake +82 -0
  750. data/lib/uservoice_sso.rb +20 -0
  751. data/spec/abilities/trustee_ability_spec.rb +53 -0
  752. data/spec/config/initializers/secret_token_spec.rb +19 -0
  753. data/spec/controllers/adm/backers_controller_spec.rb +119 -0
  754. data/spec/controllers/adm/statistics_controller.rb +17 -0
  755. data/spec/controllers/adm/users_controller_spec.rb +29 -0
  756. data/spec/controllers/channels/adm/reports/subscriber_reports_controller_spec.rb +24 -0
  757. data/spec/controllers/channels/base_controller_spec.rb +5 -0
  758. data/spec/controllers/channels/channels_subscribers_controller_spec.rb +59 -0
  759. data/spec/controllers/channels/profiles_controller_spec.rb +16 -0
  760. data/spec/controllers/omniauth_callbacks_controller_spec.rb +113 -0
  761. data/spec/controllers/projects/backers_controller_spec.rb +198 -0
  762. data/spec/controllers/projects/updates_controller_spec.rb +57 -0
  763. data/spec/controllers/projects_controller_spec.rb +178 -0
  764. data/spec/controllers/rewards_controller_spec.rb +107 -0
  765. data/spec/controllers/static_controller_spec.rb +37 -0
  766. data/spec/controllers/unsubscribes_controller_spec.rb +31 -0
  767. data/spec/controllers/users/backers_controller_spec.rb +86 -0
  768. data/spec/controllers/users/projects_controller_spec.rb +19 -0
  769. data/spec/controllers/users_controller_spec.rb +92 -0
  770. data/spec/decorators/project_decorator_spec.rb +146 -0
  771. data/spec/decorators/user_decorator_spec.rb +87 -0
  772. data/spec/dummy/README.rdoc +261 -0
  773. data/spec/dummy/Rakefile +7 -0
  774. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  775. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  776. data/spec/dummy/app/mailers/.gitkeep +0 -0
  777. data/spec/dummy/app/models/.gitkeep +0 -0
  778. data/spec/dummy/config.ru +4 -0
  779. data/spec/dummy/config/application.rb +69 -0
  780. data/spec/dummy/config/boot.rb +10 -0
  781. data/spec/dummy/config/database.sample.yml +50 -0
  782. data/spec/dummy/config/environment.rb +5 -0
  783. data/spec/dummy/config/environments/development.rb +37 -0
  784. data/spec/dummy/config/environments/production.rb +67 -0
  785. data/spec/dummy/config/environments/test.rb +37 -0
  786. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  787. data/spec/dummy/config/initializers/devise_secret_key.rb +3 -0
  788. data/spec/dummy/config/initializers/inflections.rb +15 -0
  789. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  790. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  791. data/spec/dummy/config/initializers/session_store.rb +8 -0
  792. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  793. data/spec/dummy/config/locales/en.yml +5 -0
  794. data/spec/dummy/config/routes.rb +58 -0
  795. data/spec/dummy/db/structure.sql +2434 -0
  796. data/spec/dummy/lib/assets/.gitkeep +0 -0
  797. data/spec/dummy/log/.gitkeep +0 -0
  798. data/spec/dummy/public/404.html +26 -0
  799. data/spec/dummy/public/422.html +26 -0
  800. data/spec/dummy/public/500.html +25 -0
  801. data/spec/dummy/public/favicon.ico +0 -0
  802. data/spec/dummy/script/rails +6 -0
  803. data/spec/factories.rb +125 -0
  804. data/spec/factories/users_oauth_providers.rb +9 -0
  805. data/spec/features/channel_moderation_spec.rb +27 -0
  806. data/spec/features/projects_spec.rb +95 -0
  807. data/spec/features/users_spec.rb +43 -0
  808. data/spec/fixtures/image.png +0 -0
  809. data/spec/helpers/channels/base_helper_spec.rb +15 -0
  810. data/spec/javascripts/app_spec.js +85 -0
  811. data/spec/javascripts/backer_spec.js +74 -0
  812. data/spec/javascripts/explore_spec.js +211 -0
  813. data/spec/javascripts/feedback_support_spec.js +41 -0
  814. data/spec/javascripts/helpers/.gitkeep +0 -0
  815. data/spec/javascripts/mix_panel_spec.js +101 -0
  816. data/spec/javascripts/permalink_spec.js +50 -0
  817. data/spec/javascripts/project_comments_spec.js +66 -0
  818. data/spec/javascripts/project_sidebar_spec.js +105 -0
  819. data/spec/javascripts/project_spec.js +175 -0
  820. data/spec/javascripts/registration_spec.js +38 -0
  821. data/spec/javascripts/review_form_spec.js +140 -0
  822. data/spec/javascripts/skull_spec.js +103 -0
  823. data/spec/javascripts/support/jasmine.yml +93 -0
  824. data/spec/javascripts/timed_input_spec.js +64 -0
  825. data/spec/javascripts/updates_spec.js +49 -0
  826. data/spec/javascripts/video_url_spec.js +42 -0
  827. data/spec/lib/blog_spec.rb +12 -0
  828. data/spec/lib/payment_engines_spec.rb +61 -0
  829. data/spec/mailers/notifications_mailer_spec.rb +20 -0
  830. data/spec/models/ability_spec.rb +123 -0
  831. data/spec/models/authorizations_spec.rb +6 -0
  832. data/spec/models/backer_report_spec.rb +5 -0
  833. data/spec/models/backer_spec.rb +459 -0
  834. data/spec/models/category_spec.rb +13 -0
  835. data/spec/models/channel_spec.rb +47 -0
  836. data/spec/models/channels_subscriber_spec.rb +13 -0
  837. data/spec/models/configuration_spec.rb +31 -0
  838. data/spec/models/notification_spec.rb +105 -0
  839. data/spec/models/oauth_provider_spec.rb +7 -0
  840. data/spec/models/payment_notification_spec.rb +17 -0
  841. data/spec/models/project_spec.rb +771 -0
  842. data/spec/models/project_total_spec.rb +26 -0
  843. data/spec/models/projects_for_home_spec.rb +44 -0
  844. data/spec/models/reward_spec.rb +141 -0
  845. data/spec/models/statistics_spec.rb +46 -0
  846. data/spec/models/subscriber_report_spec.rb +42 -0
  847. data/spec/models/unsubscribe_spec.rb +27 -0
  848. data/spec/models/update_spec.rb +95 -0
  849. data/spec/models/user_spec.rb +357 -0
  850. data/spec/models/user_total_spec.rb +5 -0
  851. data/spec/observers/backer_observer_spec.rb +119 -0
  852. data/spec/observers/notification_observer_spec.rb +13 -0
  853. data/spec/observers/payment_notification_observer_spec.rb +34 -0
  854. data/spec/observers/project_observer_spec.rb +224 -0
  855. data/spec/observers/update_observer_spec.rb +17 -0
  856. data/spec/observers/user_observer_spec.rb +23 -0
  857. data/spec/spec_helper.rb +82 -0
  858. data/spec/support/devise.rb +3 -0
  859. data/spec/support/factory_girl.rb +2 -0
  860. data/spec/support/feature_helpers.rb +19 -0
  861. data/spec/uploaders/image_uploader_spec.rb +58 -0
  862. data/spec/uploaders/project_uploader_spec.rb +37 -0
  863. data/spec/uploaders/user_uploader_spec.rb +23 -0
  864. data/spec/views/channels/base/index.html.slim_spec.rb +5 -0
  865. metadata +1915 -0
@@ -0,0 +1,150 @@
1
+ require 'sidekiq/web'
2
+
3
+ Rails.application.routes.draw do
4
+
5
+ devise_for :users, path: '',
6
+ path_names: { sign_in: :login, sign_out: :logout, sign_up: :sign_up },
7
+ controllers: { omniauth_callbacks: :omniauth_callbacks, passwords: :passwords }
8
+
9
+ devise_scope :user do
10
+ post '/sign_up', to: 'devise/registrations#create', as: :sign_up
11
+ end
12
+
13
+ match '/thank_you' => "static#thank_you"
14
+
15
+ check_user_admin = lambda { |request| request.env["warden"].authenticate? and request.env['warden'].user.admin }
16
+
17
+ filter :locale, exclude: /\/auth\//
18
+
19
+ # Mountable engines
20
+ constraints check_user_admin do
21
+ mount Sidekiq::Web => '/sidekiq'
22
+ end
23
+
24
+ mount CatarsePaypalExpress::Engine => "/", as: :catarse_paypal_express
25
+ mount CatarseMoip::Engine => "/", as: :catarse_moip
26
+
27
+ # Channels
28
+ constraints subdomain: 'asas' do
29
+ namespace :channels, path: '' do
30
+ namespace :adm do
31
+ namespace :reports do
32
+ resources :subscriber_reports, only: [ :index ]
33
+ end
34
+ resources :statistics, only: [ :index ]
35
+ resources :projects, only: [ :index, :update] do
36
+ member do
37
+ put 'approve'
38
+ put 'reject'
39
+ put 'push_to_draft'
40
+ end
41
+ end
42
+ end
43
+ get '/', to: 'profiles#show', as: :profile
44
+ get '/how-it-works', to: 'profiles#how_it_works', as: :about
45
+ resources :projects, only: [:new, :create, :show] do
46
+ collection do
47
+ get 'video'
48
+ end
49
+ end
50
+ resources :channels_subscribers, only: [:index, :create, :destroy]
51
+ end
52
+ end
53
+
54
+ # Root path should be after channel constraints
55
+ root to: 'projects#index'
56
+
57
+ # Static Pages
58
+ get '/sitemap', to: 'static#sitemap', as: :sitemap
59
+ get '/guidelines', to: 'static#guidelines', as: :guidelines
60
+ get "/guidelines_tips", to: "static#guidelines_tips", as: :guidelines_tips
61
+ get "/guidelines_backers", to: "static#guidelines_backers", as: :guidelines_backers
62
+ get "/guidelines_start", to: "static#guidelines_start", as: :guidelines_start
63
+ get "/about", to: "static#about", as: :about
64
+
65
+
66
+ match "/explore" => "explore#index", as: :explore
67
+
68
+ resources :posts, only: [:index, :create]
69
+
70
+ namespace :reports do
71
+ resources :backer_reports_for_project_owners, only: [:index]
72
+ end
73
+
74
+ resources :projects do
75
+ resources :updates, controller: 'projects/updates', only: [ :index, :create, :destroy ]
76
+ resources :rewards, only: [ :index, :create, :update, :destroy, :new, :edit ] do
77
+ member do
78
+ post 'sort'
79
+ end
80
+ end
81
+ resources :backers, controller: 'projects/backers', only: [ :index, :show, :new, :create ] do
82
+ member do
83
+ match 'credits_checkout'
84
+ post 'update_info'
85
+ end
86
+ end
87
+ collection do
88
+ get 'video'
89
+ end
90
+ member do
91
+ put 'pay'
92
+ get 'embed'
93
+ get 'video_embed'
94
+ get 'embed_panel'
95
+ end
96
+ end
97
+ resources :users do
98
+ resources :projects, controller: 'users/projects', only: [ :index ]
99
+ collection do
100
+ get :uservoice_gadget
101
+ end
102
+ resources :backers, controller: 'users/backers', only: [:index] do
103
+ member do
104
+ match :request_refund
105
+ end
106
+ end
107
+
108
+ resources :unsubscribes, only: [:create]
109
+ member do
110
+ get 'projects'
111
+ put 'unsubscribe_update'
112
+ put 'update_email'
113
+ put 'update_password'
114
+ end
115
+ end
116
+
117
+ namespace :adm do
118
+ resources :projects, only: [ :index, :update, :destroy ] do
119
+ member do
120
+ put 'approve'
121
+ put 'reject'
122
+ put 'push_to_draft'
123
+ end
124
+ end
125
+
126
+ resources :statistics, only: [ :index ]
127
+ resources :financials, only: [ :index ]
128
+
129
+ resources :backers, only: [ :index, :update ] do
130
+ member do
131
+ put 'confirm'
132
+ put 'pendent'
133
+ put 'change_reward'
134
+ put 'refund'
135
+ put 'hide'
136
+ put 'cancel'
137
+ put 'push_to_trash'
138
+ end
139
+ end
140
+ resources :users, only: [ :index ]
141
+
142
+ namespace :reports do
143
+ resources :backer_reports, only: [ :index ]
144
+ end
145
+ end
146
+
147
+ match "/mudancadelogin" => "users#set_email", as: :set_email_users
148
+ match "/:permalink" => "projects#show", as: :project_by_slug
149
+
150
+ end
@@ -0,0 +1 @@
1
+ :concurrency: 3
@@ -0,0 +1,38 @@
1
+ # Due to catarse's heavy page load, we are setting it to 4 workers
2
+ # 1024/4 = 240MB for each web worker
3
+ # 512/4 = 128MB for each web worker (in this case, make it 3 worker processes)
4
+ worker_processes 4
5
+
6
+ # Requests with more than 30 sec will be killed
7
+ timeout 30
8
+
9
+
10
+ # Preload entire app for fast forking.
11
+ preload_app true
12
+
13
+
14
+ before_fork do |server, worker|
15
+
16
+ Signal.trap 'TERM' do
17
+ puts 'Unicorn master intercepting TERM and sending myself QUIT instead'
18
+ Process.kill 'QUIT', Process.pid
19
+ end
20
+
21
+ defined?(ActiveRecord::Base) and
22
+ ActiveRecord::Base.connection.disconnect!
23
+ end
24
+
25
+ after_fork do |server, worker|
26
+
27
+ Signal.trap 'TERM' do
28
+ puts 'Unicorn worker intercepting TERM and doing nothing. Wait for master to sent QUIT'
29
+ end
30
+
31
+ defined?(ActiveRecord::Base) and
32
+ ActiveRecord::Base.establish_connection
33
+ end
34
+
35
+
36
+ # Please, run it like this `bundle exec unicorn_rails -c config/unicorn.rb -p 3000`
37
+ # And change port or other params as you'd like.
38
+
@@ -0,0 +1,1836 @@
1
+ # encoding: utf-8
2
+
3
+ class InitialSchema < ActiveRecord::Migration
4
+ def up
5
+ execute <<-SQL
6
+ --
7
+ -- PostgreSQL database dump
8
+ --
9
+
10
+ SET statement_timeout = 0;
11
+ SET client_encoding = 'UTF8';
12
+ SET standard_conforming_strings = on;
13
+ SET check_function_bodies = false;
14
+ SET client_min_messages = warning;
15
+
16
+ --
17
+ -- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: -
18
+ --
19
+
20
+ CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
21
+
22
+
23
+ --
24
+ -- Name: pg_trgm; Type: EXTENSION; Schema: -; Owner: -
25
+ --
26
+
27
+ CREATE EXTENSION IF NOT EXISTS pg_trgm WITH SCHEMA public;
28
+
29
+
30
+ --
31
+ -- Name: EXTENSION pg_trgm; Type: COMMENT; Schema: -; Owner: -
32
+ --
33
+
34
+ COMMENT ON EXTENSION pg_trgm IS 'text similarity measurement and index searching based on trigrams';
35
+
36
+
37
+ --
38
+ -- Name: unaccent; Type: EXTENSION; Schema: -; Owner: -
39
+ --
40
+
41
+ CREATE EXTENSION IF NOT EXISTS unaccent WITH SCHEMA public;
42
+
43
+
44
+ --
45
+ -- Name: EXTENSION unaccent; Type: COMMENT; Schema: -; Owner: -
46
+ --
47
+
48
+ COMMENT ON EXTENSION unaccent IS 'text search dictionary that removes accents';
49
+
50
+
51
+ SET search_path = public, pg_catalog;
52
+
53
+ SET default_tablespace = '';
54
+
55
+ SET default_with_oids = false;
56
+
57
+ --
58
+ -- Name: active_admin_comments; Type: TABLE; Schema: public; Owner: -; Tablespace:
59
+ --
60
+
61
+ CREATE TABLE active_admin_comments (
62
+ id integer NOT NULL,
63
+ resource_id integer NOT NULL,
64
+ resource_type character varying(255) NOT NULL,
65
+ author_id integer,
66
+ author_type character varying(255),
67
+ body text,
68
+ created_at timestamp without time zone,
69
+ updated_at timestamp without time zone,
70
+ namespace character varying(255)
71
+ );
72
+
73
+
74
+ --
75
+ -- Name: admin_notes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
76
+ --
77
+
78
+ CREATE SEQUENCE admin_notes_id_seq
79
+ START WITH 1
80
+ INCREMENT BY 1
81
+ NO MINVALUE
82
+ NO MAXVALUE
83
+ CACHE 1;
84
+
85
+
86
+ --
87
+ -- Name: admin_notes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
88
+ --
89
+
90
+ ALTER SEQUENCE admin_notes_id_seq OWNED BY active_admin_comments.id;
91
+
92
+
93
+ --
94
+ -- Name: institutional_videos; Type: TABLE; Schema: public; Owner: -; Tablespace:
95
+ --
96
+
97
+ CREATE TABLE institutional_videos (
98
+ id integer NOT NULL,
99
+ title character varying(255),
100
+ description text,
101
+ video_url character varying(255),
102
+ visible boolean,
103
+ created_at timestamp without time zone,
104
+ updated_at timestamp without time zone
105
+ );
106
+
107
+
108
+ --
109
+ -- Name: advert_videos_id_seq; Type: SEQUENCE; Schema: public; Owner: -
110
+ --
111
+
112
+ CREATE SEQUENCE advert_videos_id_seq
113
+ START WITH 1
114
+ INCREMENT BY 1
115
+ NO MINVALUE
116
+ NO MAXVALUE
117
+ CACHE 1;
118
+
119
+
120
+ --
121
+ -- Name: advert_videos_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
122
+ --
123
+
124
+ ALTER SEQUENCE advert_videos_id_seq OWNED BY institutional_videos.id;
125
+
126
+
127
+ --
128
+ -- Name: backers; Type: TABLE; Schema: public; Owner: -; Tablespace:
129
+ --
130
+
131
+ CREATE TABLE backers (
132
+ id integer NOT NULL,
133
+ project_id integer NOT NULL,
134
+ user_id integer NOT NULL,
135
+ reward_id integer,
136
+ value numeric NOT NULL,
137
+ confirmed boolean DEFAULT false NOT NULL,
138
+ confirmed_at timestamp without time zone,
139
+ created_at timestamp without time zone,
140
+ updated_at timestamp without time zone,
141
+ anonymous boolean DEFAULT false,
142
+ key text,
143
+ requested_refund boolean DEFAULT false,
144
+ refunded boolean DEFAULT false,
145
+ credits boolean DEFAULT false,
146
+ notified_finish boolean DEFAULT false,
147
+ payment_method text,
148
+ payment_token text,
149
+ payment_id character varying(255),
150
+ payer_name text,
151
+ payer_email text,
152
+ payer_document text,
153
+ address_street text,
154
+ address_number text,
155
+ address_complement text,
156
+ address_neighbourhood text,
157
+ address_zip_code text,
158
+ address_city text,
159
+ address_state text,
160
+ address_phone_number text,
161
+ payment_choice text,
162
+ payment_service_fee numeric,
163
+ CONSTRAINT backers_value_positive CHECK ((value >= (0)::numeric))
164
+ );
165
+
166
+
167
+ --
168
+ -- Name: categories; Type: TABLE; Schema: public; Owner: -; Tablespace:
169
+ --
170
+
171
+ CREATE TABLE categories (
172
+ id integer NOT NULL,
173
+ name text NOT NULL,
174
+ created_at timestamp without time zone,
175
+ updated_at timestamp without time zone,
176
+ CONSTRAINT categories_name_not_blank CHECK ((length(btrim(name)) > 0))
177
+ );
178
+
179
+
180
+ --
181
+ -- Name: projects; Type: TABLE; Schema: public; Owner: -; Tablespace:
182
+ --
183
+
184
+ CREATE TABLE projects (
185
+ id integer NOT NULL,
186
+ name text NOT NULL,
187
+ user_id integer NOT NULL,
188
+ category_id integer NOT NULL,
189
+ goal numeric NOT NULL,
190
+ expires_at timestamp without time zone NOT NULL,
191
+ about text NOT NULL,
192
+ headline text NOT NULL,
193
+ video_url text NOT NULL,
194
+ image_url text,
195
+ short_url text,
196
+ created_at timestamp without time zone,
197
+ updated_at timestamp without time zone,
198
+ can_finish boolean DEFAULT false,
199
+ finished boolean DEFAULT false,
200
+ about_html text,
201
+ visible boolean DEFAULT false,
202
+ rejected boolean DEFAULT false,
203
+ recommended boolean DEFAULT false,
204
+ home_page_comment text,
205
+ successful boolean DEFAULT false,
206
+ permalink character varying(255),
207
+ video_thumbnail text,
208
+ state character varying(255),
209
+ online_days integer DEFAULT 0,
210
+ CONSTRAINT projects_about_not_blank CHECK ((length(btrim(about)) > 0)),
211
+ CONSTRAINT projects_headline_length_within CHECK (((length(headline) >= 1) AND (length(headline) <= 140))),
212
+ CONSTRAINT projects_headline_not_blank CHECK ((length(btrim(headline)) > 0)),
213
+ CONSTRAINT projects_video_url_not_blank CHECK ((length(btrim(video_url)) > 0))
214
+ );
215
+
216
+
217
+ --
218
+ -- Name: backers_by_category; Type: VIEW; Schema: public; Owner: -
219
+ --
220
+
221
+ CREATE OR REPLACE VIEW backers_by_category AS
222
+ SELECT to_char(p.expires_at, 'yyyy'::text) AS year, c.name AS category, sum(b.value) AS total_backed, count(DISTINCT b.user_id) AS total_backers
223
+ FROM backers b
224
+ JOIN projects p ON p.id = b.project_id
225
+ JOIN categories c ON c.id = p.category_id
226
+ WHERE b.confirmed
227
+ GROUP BY to_char(p.expires_at, 'yyyy'::text), c.name
228
+ ORDER BY to_char(p.expires_at, 'yyyy'::text), c.name;
229
+
230
+ --
231
+ -- Name: backers_by_payment_choice; Type: VIEW; Schema: public; Owner: -
232
+ --
233
+
234
+ CREATE OR REPLACE VIEW backers_by_payment_choice AS
235
+ SELECT to_char(p.expires_at, 'yyyy-mm'::text) AS month, backers.payment_method, backers.payment_choice, sum(backers.value) AS total_backed, sum(backers.value) / bbm.total_month_backed AS payment_choice_ratio, sum(
236
+ CASE
237
+ WHEN backers.refunded THEN backers.value
238
+ ELSE NULL::numeric
239
+ END) AS total_refunded, sum(
240
+ CASE
241
+ WHEN backers.refunded THEN backers.value
242
+ ELSE NULL::numeric
243
+ END) / bbm.total_month_backed AS refunded_ratio
244
+ FROM projects p
245
+ JOIN backers ON backers.project_id = p.id
246
+ JOIN ( SELECT to_char(b2.created_at, 'yyyy-mm'::text) AS b2month, sum(b2.value) AS total_month_backed
247
+ FROM backers b2
248
+ WHERE b2.confirmed
249
+ GROUP BY to_char(b2.created_at, 'yyyy-mm'::text)) bbm ON bbm.b2month = to_char(backers.created_at, 'yyyy-mm'::text)
250
+ WHERE backers.confirmed
251
+ GROUP BY to_char(p.expires_at, 'yyyy-mm'::text), bbm.total_month_backed, backers.payment_method, backers.payment_choice
252
+ ORDER BY to_char(p.expires_at, 'yyyy-mm'::text), backers.payment_method, backers.payment_choice;
253
+
254
+ --
255
+ -- Name: backers_by_project; Type: VIEW; Schema: public; Owner: -
256
+ --
257
+
258
+ CREATE OR REPLACE VIEW backers_by_project AS
259
+ SELECT backers.project_id, sum(backers.value) AS total_backed, max(backers.value) AS max_backed, count(DISTINCT backers.user_id) AS total_backers
260
+ FROM backers
261
+ WHERE backers.confirmed
262
+ GROUP BY backers.project_id;
263
+
264
+ --
265
+ -- Name: users; Type: TABLE; Schema: public; Owner: -; Tablespace:
266
+ --
267
+
268
+ CREATE TABLE users (
269
+ id integer NOT NULL,
270
+ primary_user_id integer,
271
+ provider text NOT NULL,
272
+ uid text NOT NULL,
273
+ email text,
274
+ name text,
275
+ nickname text,
276
+ bio text,
277
+ image_url text,
278
+ newsletter boolean DEFAULT false,
279
+ project_updates boolean DEFAULT false,
280
+ created_at timestamp without time zone,
281
+ updated_at timestamp without time zone,
282
+ admin boolean DEFAULT false,
283
+ full_name text,
284
+ address_street text,
285
+ address_number text,
286
+ address_complement text,
287
+ address_neighbourhood text,
288
+ address_city text,
289
+ address_state text,
290
+ address_zip_code text,
291
+ phone_number text,
292
+ credits numeric DEFAULT 0,
293
+ locale text DEFAULT 'pt'::text NOT NULL,
294
+ cpf text,
295
+ encrypted_password character varying(128) DEFAULT ''::character varying NOT NULL,
296
+ reset_password_token character varying(255),
297
+ reset_password_sent_at timestamp without time zone,
298
+ remember_created_at timestamp without time zone,
299
+ sign_in_count integer DEFAULT 0,
300
+ current_sign_in_at timestamp without time zone,
301
+ last_sign_in_at timestamp without time zone,
302
+ current_sign_in_ip character varying(255),
303
+ last_sign_in_ip character varying(255),
304
+ twitter character varying(255),
305
+ facebook_link character varying(255),
306
+ other_link character varying(255),
307
+ uploaded_image text,
308
+ CONSTRAINT users_bio_length_within CHECK (((length(bio) >= 0) AND (length(bio) <= 140))),
309
+ CONSTRAINT users_provider_not_blank CHECK ((length(btrim(provider)) > 0)),
310
+ CONSTRAINT users_uid_not_blank CHECK ((length(btrim(uid)) > 0))
311
+ );
312
+
313
+
314
+ --
315
+ -- Name: backers_by_state; Type: VIEW; Schema: public; Owner: -
316
+ --
317
+
318
+ CREATE OR REPLACE VIEW backers_by_state AS
319
+ SELECT to_char(p.expires_at, 'yyyy'::text) AS year, NULLIF(u.address_state, ''::text) AS state, sum(b.value) AS total_backed, count(DISTINCT b.user_id) AS total_backers
320
+ FROM backers b
321
+ JOIN projects p ON b.project_id = p.id
322
+ JOIN users u ON u.id = b.user_id
323
+ WHERE b.confirmed
324
+ GROUP BY to_char(p.expires_at, 'yyyy'::text), NULLIF(u.address_state, ''::text)
325
+ ORDER BY to_char(p.expires_at, 'yyyy'::text), NULLIF(u.address_state, ''::text);
326
+
327
+ --
328
+ -- Name: backers_by_year; Type: VIEW; Schema: public; Owner: -
329
+ --
330
+
331
+ CREATE OR REPLACE VIEW backers_by_year AS
332
+ SELECT to_char(p.expires_at, 'yyyy'::text) AS year, sum(backers.value) AS total_backed, count(DISTINCT backers.user_id) AS total_backers, count(DISTINCT
333
+ CASE
334
+ WHEN backers.reward_id IS NULL THEN backers.user_id
335
+ ELSE NULL::integer
336
+ END) AS total_backers_without_reward, count(DISTINCT
337
+ CASE
338
+ WHEN backers.reward_id IS NULL THEN backers.user_id
339
+ ELSE NULL::integer
340
+ END)::numeric / count(DISTINCT backers.user_id)::numeric AS backers_without_reward_ratio, max(backers.value) AS maximum_back
341
+ FROM backers
342
+ JOIN projects p ON backers.project_id = p.id
343
+ WHERE backers.confirmed
344
+ GROUP BY to_char(p.expires_at, 'yyyy'::text);
345
+
346
+ --
347
+ -- Name: backers_id_seq; Type: SEQUENCE; Schema: public; Owner: -
348
+ --
349
+
350
+ CREATE SEQUENCE backers_id_seq
351
+ START WITH 1
352
+ INCREMENT BY 1
353
+ NO MINVALUE
354
+ NO MAXVALUE
355
+ CACHE 1;
356
+
357
+
358
+ --
359
+ -- Name: backers_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
360
+ --
361
+
362
+ ALTER SEQUENCE backers_id_seq OWNED BY backers.id;
363
+
364
+
365
+ --
366
+ -- Name: categories_id_seq; Type: SEQUENCE; Schema: public; Owner: -
367
+ --
368
+
369
+ CREATE SEQUENCE categories_id_seq
370
+ START WITH 1
371
+ INCREMENT BY 1
372
+ NO MINVALUE
373
+ NO MAXVALUE
374
+ CACHE 1;
375
+
376
+
377
+ --
378
+ -- Name: categories_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
379
+ --
380
+
381
+ ALTER SEQUENCE categories_id_seq OWNED BY categories.id;
382
+
383
+
384
+ --
385
+ -- Name: comments; Type: TABLE; Schema: public; Owner: -; Tablespace:
386
+ --
387
+
388
+ CREATE TABLE comments (
389
+ id integer NOT NULL,
390
+ title text,
391
+ comment text NOT NULL,
392
+ comment_html text,
393
+ commentable_id integer NOT NULL,
394
+ commentable_type character varying(255) NOT NULL,
395
+ user_id integer NOT NULL,
396
+ project_update boolean DEFAULT false,
397
+ created_at timestamp without time zone,
398
+ updated_at timestamp without time zone,
399
+ CONSTRAINT comments_comment_not_blank CHECK ((length(btrim(comment)) > 0))
400
+ );
401
+
402
+
403
+ --
404
+ -- Name: comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
405
+ --
406
+
407
+ CREATE SEQUENCE comments_id_seq
408
+ START WITH 1
409
+ INCREMENT BY 1
410
+ NO MINVALUE
411
+ NO MAXVALUE
412
+ CACHE 1;
413
+
414
+
415
+ --
416
+ -- Name: comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
417
+ --
418
+
419
+ ALTER SEQUENCE comments_id_seq OWNED BY comments.id;
420
+
421
+
422
+ --
423
+ -- Name: configurations; Type: TABLE; Schema: public; Owner: -; Tablespace:
424
+ --
425
+
426
+ CREATE TABLE configurations (
427
+ id integer NOT NULL,
428
+ name text NOT NULL,
429
+ value text,
430
+ created_at timestamp without time zone,
431
+ updated_at timestamp without time zone,
432
+ CONSTRAINT configurations_name_not_blank CHECK ((length(btrim(name)) > 0))
433
+ );
434
+
435
+
436
+ --
437
+ -- Name: configurations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
438
+ --
439
+
440
+ CREATE SEQUENCE configurations_id_seq
441
+ START WITH 1
442
+ INCREMENT BY 1
443
+ NO MINVALUE
444
+ NO MAXVALUE
445
+ CACHE 1;
446
+
447
+
448
+ --
449
+ -- Name: configurations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
450
+ --
451
+
452
+ ALTER SEQUENCE configurations_id_seq OWNED BY configurations.id;
453
+
454
+
455
+ --
456
+ -- Name: curated_pages; Type: TABLE; Schema: public; Owner: -; Tablespace:
457
+ --
458
+
459
+ CREATE TABLE curated_pages (
460
+ id integer NOT NULL,
461
+ name character varying(255),
462
+ description text,
463
+ analytics_id character varying(255),
464
+ logo character varying(255),
465
+ video_url character varying(255),
466
+ created_at timestamp without time zone,
467
+ updated_at timestamp without time zone,
468
+ permalink character varying(255),
469
+ visible boolean DEFAULT false,
470
+ site_url character varying(255)
471
+ );
472
+
473
+
474
+ --
475
+ -- Name: curated_pages_id_seq; Type: SEQUENCE; Schema: public; Owner: -
476
+ --
477
+
478
+ CREATE SEQUENCE curated_pages_id_seq
479
+ START WITH 1
480
+ INCREMENT BY 1
481
+ NO MINVALUE
482
+ NO MAXVALUE
483
+ CACHE 1;
484
+
485
+
486
+ --
487
+ -- Name: curated_pages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
488
+ --
489
+
490
+ ALTER SEQUENCE curated_pages_id_seq OWNED BY curated_pages.id;
491
+
492
+
493
+ --
494
+ -- Name: notification_types; Type: TABLE; Schema: public; Owner: -; Tablespace:
495
+ --
496
+
497
+ CREATE TABLE notification_types (
498
+ id integer NOT NULL,
499
+ name text NOT NULL,
500
+ created_at timestamp without time zone NOT NULL,
501
+ updated_at timestamp without time zone NOT NULL
502
+ );
503
+
504
+
505
+ --
506
+ -- Name: notification_types_id_seq; Type: SEQUENCE; Schema: public; Owner: -
507
+ --
508
+
509
+ CREATE SEQUENCE notification_types_id_seq
510
+ START WITH 1
511
+ INCREMENT BY 1
512
+ NO MINVALUE
513
+ NO MAXVALUE
514
+ CACHE 1;
515
+
516
+
517
+ --
518
+ -- Name: notification_types_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
519
+ --
520
+
521
+ ALTER SEQUENCE notification_types_id_seq OWNED BY notification_types.id;
522
+
523
+
524
+ --
525
+ -- Name: notifications; Type: TABLE; Schema: public; Owner: -; Tablespace:
526
+ --
527
+
528
+ CREATE TABLE notifications (
529
+ id integer NOT NULL,
530
+ user_id integer NOT NULL,
531
+ project_id integer,
532
+ dismissed boolean DEFAULT false NOT NULL,
533
+ created_at timestamp without time zone,
534
+ updated_at timestamp without time zone,
535
+ notification_type_id integer NOT NULL,
536
+ backer_id integer,
537
+ update_id integer
538
+ );
539
+
540
+
541
+ --
542
+ -- Name: notifications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
543
+ --
544
+
545
+ CREATE SEQUENCE notifications_id_seq
546
+ START WITH 1
547
+ INCREMENT BY 1
548
+ NO MINVALUE
549
+ NO MAXVALUE
550
+ CACHE 1;
551
+
552
+
553
+ --
554
+ -- Name: notifications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
555
+ --
556
+
557
+ ALTER SEQUENCE notifications_id_seq OWNED BY notifications.id;
558
+
559
+
560
+ --
561
+ -- Name: oauth_providers; Type: TABLE; Schema: public; Owner: -; Tablespace:
562
+ --
563
+
564
+ CREATE TABLE oauth_providers (
565
+ id integer NOT NULL,
566
+ name text NOT NULL,
567
+ key text NOT NULL,
568
+ secret text NOT NULL,
569
+ scope text,
570
+ "order" integer,
571
+ created_at timestamp without time zone,
572
+ updated_at timestamp without time zone,
573
+ strategy text,
574
+ path text,
575
+ CONSTRAINT oauth_providers_key_not_blank CHECK ((length(btrim(key)) > 0)),
576
+ CONSTRAINT oauth_providers_name_not_blank CHECK ((length(btrim(name)) > 0)),
577
+ CONSTRAINT oauth_providers_secret_not_blank CHECK ((length(btrim(secret)) > 0))
578
+ );
579
+
580
+
581
+ --
582
+ -- Name: oauth_providers_id_seq; Type: SEQUENCE; Schema: public; Owner: -
583
+ --
584
+
585
+ CREATE SEQUENCE oauth_providers_id_seq
586
+ START WITH 1
587
+ INCREMENT BY 1
588
+ NO MINVALUE
589
+ NO MAXVALUE
590
+ CACHE 1;
591
+
592
+
593
+ --
594
+ -- Name: oauth_providers_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
595
+ --
596
+
597
+ ALTER SEQUENCE oauth_providers_id_seq OWNED BY oauth_providers.id;
598
+
599
+
600
+ --
601
+ -- Name: payment_logs; Type: TABLE; Schema: public; Owner: -; Tablespace:
602
+ --
603
+
604
+ CREATE TABLE payment_logs (
605
+ id integer NOT NULL,
606
+ backer_id integer,
607
+ status integer,
608
+ amount double precision,
609
+ payment_status integer,
610
+ moip_id integer,
611
+ payment_method integer,
612
+ payment_type character varying(255),
613
+ consumer_email character varying(255),
614
+ created_at timestamp without time zone,
615
+ updated_at timestamp without time zone
616
+ );
617
+
618
+
619
+ --
620
+ -- Name: payment_logs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
621
+ --
622
+
623
+ CREATE SEQUENCE payment_logs_id_seq
624
+ START WITH 1
625
+ INCREMENT BY 1
626
+ NO MINVALUE
627
+ NO MAXVALUE
628
+ CACHE 1;
629
+
630
+
631
+ --
632
+ -- Name: payment_logs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
633
+ --
634
+
635
+ ALTER SEQUENCE payment_logs_id_seq OWNED BY payment_logs.id;
636
+
637
+
638
+ --
639
+ -- Name: payment_notifications; Type: TABLE; Schema: public; Owner: -; Tablespace:
640
+ --
641
+
642
+ CREATE TABLE payment_notifications (
643
+ id integer NOT NULL,
644
+ backer_id integer NOT NULL,
645
+ extra_data text,
646
+ created_at timestamp without time zone NOT NULL,
647
+ updated_at timestamp without time zone NOT NULL
648
+ );
649
+
650
+
651
+ --
652
+ -- Name: payment_notifications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
653
+ --
654
+
655
+ CREATE SEQUENCE payment_notifications_id_seq
656
+ START WITH 1
657
+ INCREMENT BY 1
658
+ NO MINVALUE
659
+ NO MAXVALUE
660
+ CACHE 1;
661
+
662
+
663
+ --
664
+ -- Name: payment_notifications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
665
+ --
666
+
667
+ ALTER SEQUENCE payment_notifications_id_seq OWNED BY payment_notifications.id;
668
+
669
+
670
+ --
671
+ -- Name: paypal_payments; Type: TABLE; Schema: public; Owner: -; Tablespace:
672
+ --
673
+
674
+ CREATE TABLE paypal_payments (
675
+ data text,
676
+ hora text,
677
+ fusohorario text,
678
+ nome text,
679
+ tipo text,
680
+ status text,
681
+ moeda text,
682
+ valorbruto text,
683
+ tarifa text,
684
+ liquido text,
685
+ doe_mail text,
686
+ parae_mail text,
687
+ iddatransacao text,
688
+ statusdoequivalente text,
689
+ statusdoendereco text,
690
+ titulodoitem text,
691
+ iddoitem text,
692
+ valordoenvioemanuseio text,
693
+ valordoseguro text,
694
+ impostosobrevendas text,
695
+ opcao1nome text,
696
+ opcao1valor text,
697
+ opcao2nome text,
698
+ opcao2valor text,
699
+ sitedoleilao text,
700
+ iddocomprador text,
701
+ urldoitem text,
702
+ datadetermino text,
703
+ iddaescritura text,
704
+ iddafatura text,
705
+ "idtxn_dereferência" text,
706
+ numerodafatura text,
707
+ numeropersonalizado text,
708
+ iddorecibo text,
709
+ saldo text,
710
+ enderecolinha1 text,
711
+ enderecolinha2_distrito_bairro text,
712
+ cidade text,
713
+ "estado_regiao_território_prefeitura_republica" text,
714
+ cep text,
715
+ pais text,
716
+ numerodotelefoneparacontato text,
717
+ extra text
718
+ );
719
+
720
+
721
+ --
722
+ -- Name: paypal_pending; Type: VIEW; Schema: public; Owner: -
723
+ --
724
+
725
+ CREATE VIEW paypal_pending AS
726
+ SELECT string_agg((b.id)::text, ','::text) AS string_agg FROM (backers b JOIN paypal_payments p ON ((lower(p.doe_mail) = b.payer_email))) WHERE ((((b.payment_method = 'PayPal'::text) AND (p.status = 'Concluído'::text)) AND (NOT b.confirmed)) AND (to_number(p.valorbruto, '9,99'::text) = b.value));
727
+
728
+
729
+ --
730
+ -- Name: project_totals; Type: VIEW; Schema: public; Owner: -
731
+ --
732
+
733
+ CREATE VIEW project_totals AS
734
+ SELECT backers.project_id, sum(backers.value) AS pledged, count(*) AS total_backers FROM backers WHERE (backers.confirmed = true) GROUP BY backers.project_id;
735
+
736
+
737
+ --
738
+ -- Name: projects_by_category; Type: VIEW; Schema: public; Owner: -
739
+ --
740
+
741
+ CREATE OR REPLACE VIEW projects_by_category AS
742
+ SELECT to_char(p.expires_at, 'yyyy'::text) AS year, c.name AS category, count(*) AS total_projects, count(NULLIF(p.successful, false)) AS successful_projects
743
+ FROM projects p
744
+ JOIN categories c ON c.id = p.category_id
745
+ WHERE p.finished
746
+ GROUP BY to_char(p.expires_at, 'yyyy'::text), c.name
747
+ ORDER BY to_char(p.expires_at, 'yyyy'::text), c.name;
748
+
749
+ --
750
+ -- Name: projects_by_state; Type: VIEW; Schema: public; Owner: -
751
+ --
752
+
753
+ CREATE OR REPLACE VIEW projects_by_state AS
754
+ SELECT to_char(p.expires_at, 'yyyy'::text) AS year, NULLIF(btrim(u.address_state), ''::text) AS uf, count(*) AS total_projects, count(NULLIF(p.successful, false)) AS successful_projects
755
+ FROM projects p
756
+ JOIN users u ON u.id = p.user_id
757
+ WHERE p.finished
758
+ GROUP BY to_char(p.expires_at, 'yyyy'::text), NULLIF(btrim(u.address_state), ''::text)
759
+ ORDER BY to_char(p.expires_at, 'yyyy'::text), NULLIF(btrim(u.address_state), ''::text);
760
+
761
+ --
762
+ -- Name: total_backed_ranges; Type: TABLE; Schema: public; Owner: -; Tablespace:
763
+ --
764
+
765
+ CREATE TABLE total_backed_ranges (
766
+ name text NOT NULL,
767
+ lower numeric,
768
+ upper numeric
769
+ );
770
+
771
+
772
+ --
773
+ -- Name: projects_by_total_backed_ranges; Type: VIEW; Schema: public; Owner: -
774
+ --
775
+
776
+ CREATE OR REPLACE VIEW projects_by_total_backed_ranges AS
777
+ SELECT tbr.lower, tbr.upper, count(*) AS count, count(*)::numeric / (( SELECT count(*) AS count
778
+ FROM backers_by_project))::numeric AS ratio
779
+ FROM backers_by_project bp
780
+ JOIN total_backed_ranges tbr ON bp.total_backed >= tbr.lower AND bp.total_backed <= tbr.upper
781
+ GROUP BY tbr.lower, tbr.upper
782
+ ORDER BY tbr.lower;
783
+
784
+ --
785
+ -- Name: projects_by_year; Type: VIEW; Schema: public; Owner: -
786
+ --
787
+
788
+ CREATE OR REPLACE VIEW projects_by_year AS
789
+ SELECT to_char(p.expires_at, 'yyyy'::text) AS year, count(*) AS total_projects, count(NULLIF(p.successful, false)) AS successful_projects, sum(
790
+ CASE
791
+ WHEN p.successful THEN b.total_backed
792
+ ELSE NULL::numeric
793
+ END) AS successful_total_backed, max(b.total_backed) AS max_total_backed, max(b.max_backed) AS max_backed, max(b.total_backers) AS max_total_backers
794
+ FROM projects p
795
+ LEFT JOIN backers_by_project b ON b.project_id = p.id
796
+ WHERE p.finished
797
+ GROUP BY to_char(p.expires_at, 'yyyy'::text)
798
+ ORDER BY to_char(p.expires_at, 'yyyy'::text);
799
+
800
+
801
+ --
802
+ -- Name: projects_curated_pages; Type: TABLE; Schema: public; Owner: -; Tablespace:
803
+ --
804
+
805
+ CREATE TABLE projects_curated_pages (
806
+ id integer NOT NULL,
807
+ project_id integer,
808
+ curated_page_id integer,
809
+ description text,
810
+ created_at timestamp without time zone,
811
+ updated_at timestamp without time zone,
812
+ description_html text
813
+ );
814
+
815
+
816
+ --
817
+ -- Name: projects_curated_pages_id_seq; Type: SEQUENCE; Schema: public; Owner: -
818
+ --
819
+
820
+ CREATE SEQUENCE projects_curated_pages_id_seq
821
+ START WITH 1
822
+ INCREMENT BY 1
823
+ NO MINVALUE
824
+ NO MAXVALUE
825
+ CACHE 1;
826
+
827
+
828
+ --
829
+ -- Name: projects_curated_pages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
830
+ --
831
+
832
+ ALTER SEQUENCE projects_curated_pages_id_seq OWNED BY projects_curated_pages.id;
833
+
834
+
835
+ --
836
+ -- Name: projects_id_seq; Type: SEQUENCE; Schema: public; Owner: -
837
+ --
838
+
839
+ CREATE SEQUENCE projects_id_seq
840
+ START WITH 1
841
+ INCREMENT BY 1
842
+ NO MINVALUE
843
+ NO MAXVALUE
844
+ CACHE 1;
845
+
846
+
847
+ --
848
+ -- Name: projects_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
849
+ --
850
+
851
+ ALTER SEQUENCE projects_id_seq OWNED BY projects.id;
852
+
853
+
854
+ --
855
+ -- Name: projects_managers; Type: TABLE; Schema: public; Owner: -; Tablespace:
856
+ --
857
+
858
+ CREATE TABLE projects_managers (
859
+ user_id integer,
860
+ project_id integer
861
+ );
862
+
863
+
864
+ --
865
+ -- Name: recurring_backers_by_year; Type: VIEW; Schema: public; Owner: -
866
+ --
867
+
868
+ CREATE OR REPLACE VIEW recurring_backers_by_year AS
869
+ SELECT bby.year, trb.total_recurring_backed, bby.total_backed, trb.total_recurring_backed / bby.total_backed AS recurring_backed_ratio, trb.total_recurring_backers, bby.total_backers, trb.total_recurring_backers / bby.total_backers::numeric AS recurring_backers_ratio
870
+ FROM ( SELECT rb.year, sum(rb.total_recurring_backed) AS total_recurring_backed, sum(rb.total_recurring_backers) AS total_recurring_backers
871
+ FROM ( SELECT to_char(backers.created_at, 'yyyy'::text) AS year, sum(backers.value) AS total_recurring_backed, count(DISTINCT backers.user_id) AS total_recurring_backers
872
+ FROM backers
873
+ WHERE backers.confirmed
874
+ GROUP BY to_char(backers.created_at, 'yyyy'::text), backers.user_id
875
+ HAVING count(*) > 1) rb
876
+ GROUP BY rb.year) trb
877
+ JOIN backers_by_year bby USING (year);
878
+
879
+ --
880
+ -- Name: reward_ranges; Type: TABLE; Schema: public; Owner: -; Tablespace:
881
+ --
882
+
883
+ CREATE TABLE reward_ranges (
884
+ name text NOT NULL,
885
+ lower numeric,
886
+ upper numeric
887
+ );
888
+
889
+
890
+ --
891
+ -- Name: rewards; Type: TABLE; Schema: public; Owner: -; Tablespace:
892
+ --
893
+
894
+ CREATE TABLE rewards (
895
+ id integer NOT NULL,
896
+ project_id integer NOT NULL,
897
+ minimum_value numeric NOT NULL,
898
+ maximum_backers integer,
899
+ description text NOT NULL,
900
+ created_at timestamp without time zone,
901
+ updated_at timestamp without time zone,
902
+ CONSTRAINT rewards_maximum_backers_positive CHECK ((maximum_backers >= 0)),
903
+ CONSTRAINT rewards_minimum_value_positive CHECK ((minimum_value >= (0)::numeric))
904
+ );
905
+
906
+
907
+ --
908
+ -- Name: rewards_by_range; Type: VIEW; Schema: public; Owner: -
909
+ --
910
+
911
+ CREATE OR REPLACE VIEW rewards_by_range AS
912
+ SELECT rr.name AS range, count(*) AS count, count(*)::numeric / (( SELECT count(*) AS count
913
+ FROM backers
914
+ WHERE backers.confirmed AND backers.reward_id IS NOT NULL))::numeric AS ratio
915
+ FROM reward_ranges rr
916
+ JOIN rewards r ON r.minimum_value >= rr.lower AND r.minimum_value <= rr.upper
917
+ JOIN backers b ON b.reward_id = r.id
918
+ WHERE b.confirmed
919
+ GROUP BY rr.name, rr.lower
920
+ ORDER BY rr.lower;
921
+
922
+
923
+ --
924
+ -- Name: rewards_id_seq; Type: SEQUENCE; Schema: public; Owner: -
925
+ --
926
+
927
+ CREATE SEQUENCE rewards_id_seq
928
+ START WITH 1
929
+ INCREMENT BY 1
930
+ NO MINVALUE
931
+ NO MAXVALUE
932
+ CACHE 1;
933
+
934
+
935
+ --
936
+ -- Name: rewards_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
937
+ --
938
+
939
+ ALTER SEQUENCE rewards_id_seq OWNED BY rewards.id;
940
+
941
+ --
942
+ -- Name: states; Type: TABLE; Schema: public; Owner: -; Tablespace:
943
+ --
944
+
945
+ CREATE TABLE states (
946
+ id integer NOT NULL,
947
+ name character varying(255) NOT NULL,
948
+ acronym character varying(255) NOT NULL,
949
+ created_at timestamp without time zone,
950
+ updated_at timestamp without time zone,
951
+ CONSTRAINT states_acronym_not_blank CHECK ((length(btrim((acronym)::text)) > 0)),
952
+ CONSTRAINT states_name_not_blank CHECK ((length(btrim((name)::text)) > 0))
953
+ );
954
+
955
+
956
+ --
957
+ -- Name: states_id_seq; Type: SEQUENCE; Schema: public; Owner: -
958
+ --
959
+
960
+ CREATE SEQUENCE states_id_seq
961
+ START WITH 1
962
+ INCREMENT BY 1
963
+ NO MINVALUE
964
+ NO MAXVALUE
965
+ CACHE 1;
966
+
967
+
968
+ --
969
+ -- Name: states_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
970
+ --
971
+
972
+ ALTER SEQUENCE states_id_seq OWNED BY states.id;
973
+
974
+
975
+ --
976
+ -- Name: static_contents; Type: TABLE; Schema: public; Owner: -; Tablespace:
977
+ --
978
+
979
+ CREATE TABLE static_contents (
980
+ id integer NOT NULL,
981
+ title character varying(255),
982
+ body text,
983
+ body_html text,
984
+ created_at timestamp without time zone,
985
+ updated_at timestamp without time zone
986
+ );
987
+
988
+
989
+ --
990
+ -- Name: static_contents_id_seq; Type: SEQUENCE; Schema: public; Owner: -
991
+ --
992
+
993
+ CREATE SEQUENCE static_contents_id_seq
994
+ START WITH 1
995
+ INCREMENT BY 1
996
+ NO MINVALUE
997
+ NO MAXVALUE
998
+ CACHE 1;
999
+
1000
+
1001
+ --
1002
+ -- Name: static_contents_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1003
+ --
1004
+
1005
+ ALTER SEQUENCE static_contents_id_seq OWNED BY static_contents.id;
1006
+
1007
+
1008
+ --
1009
+ -- Name: statistics; Type: VIEW; Schema: public; Owner: -
1010
+ --
1011
+
1012
+ CREATE VIEW statistics AS
1013
+ SELECT (SELECT count(*) AS count FROM users WHERE (users.primary_user_id IS NULL)) AS total_users, backers_totals.total_backs, backers_totals.total_backers, backers_totals.total_backed, projects_totals.total_projects, projects_totals.total_projects_success, projects_totals.total_projects_online FROM (SELECT count(*) AS total_backs, count(DISTINCT backers.user_id) AS total_backers, sum(backers.value) AS total_backed FROM backers WHERE backers.confirmed) backers_totals, (SELECT count(*) AS total_projects, count(CASE WHEN projects.successful THEN 1 ELSE NULL::integer END) AS total_projects_success, count(CASE WHEN ((projects.finished = false) AND (projects.expires_at >= now())) THEN 1 ELSE NULL::integer END) AS total_projects_online FROM projects WHERE projects.visible) projects_totals;
1014
+
1015
+
1016
+ --
1017
+ -- Name: unsubscribes; Type: TABLE; Schema: public; Owner: -; Tablespace:
1018
+ --
1019
+
1020
+ CREATE TABLE unsubscribes (
1021
+ id integer NOT NULL,
1022
+ user_id integer NOT NULL,
1023
+ notification_type_id integer NOT NULL,
1024
+ project_id integer,
1025
+ created_at timestamp without time zone NOT NULL,
1026
+ updated_at timestamp without time zone NOT NULL
1027
+ );
1028
+
1029
+
1030
+ --
1031
+ -- Name: unsubscribes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1032
+ --
1033
+
1034
+ CREATE SEQUENCE unsubscribes_id_seq
1035
+ START WITH 1
1036
+ INCREMENT BY 1
1037
+ NO MINVALUE
1038
+ NO MAXVALUE
1039
+ CACHE 1;
1040
+
1041
+
1042
+ --
1043
+ -- Name: unsubscribes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1044
+ --
1045
+
1046
+ ALTER SEQUENCE unsubscribes_id_seq OWNED BY unsubscribes.id;
1047
+
1048
+
1049
+ --
1050
+ -- Name: updates; Type: TABLE; Schema: public; Owner: -; Tablespace:
1051
+ --
1052
+
1053
+ CREATE TABLE updates (
1054
+ id integer NOT NULL,
1055
+ user_id integer NOT NULL,
1056
+ project_id integer NOT NULL,
1057
+ title text,
1058
+ comment text NOT NULL,
1059
+ comment_html text NOT NULL,
1060
+ created_at timestamp without time zone,
1061
+ updated_at timestamp without time zone
1062
+ );
1063
+
1064
+
1065
+ --
1066
+ -- Name: updates_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1067
+ --
1068
+
1069
+ CREATE SEQUENCE updates_id_seq
1070
+ START WITH 1
1071
+ INCREMENT BY 1
1072
+ NO MINVALUE
1073
+ NO MAXVALUE
1074
+ CACHE 1;
1075
+
1076
+
1077
+ --
1078
+ -- Name: updates_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1079
+ --
1080
+
1081
+ ALTER SEQUENCE updates_id_seq OWNED BY updates.id;
1082
+
1083
+
1084
+ --
1085
+ -- Name: user_totals; Type: VIEW; Schema: public; Owner: -
1086
+ --
1087
+
1088
+ CREATE VIEW user_totals AS
1089
+ SELECT b.user_id AS id, b.user_id, sum(b.value) AS sum, count(*) AS count, sum(CASE WHEN (((NOT p.finished) OR p.successful) AND (NOT b.credits)) THEN (0)::numeric WHEN ((p.finished AND (NOT p.successful)) AND ((b.requested_refund AND (NOT b.credits)) OR (b.credits AND (NOT b.requested_refund)))) THEN (0)::numeric WHEN (((p.finished AND (NOT p.successful)) AND (NOT b.credits)) AND (NOT b.requested_refund)) THEN b.value ELSE (b.value * ((-1))::numeric) END) AS credits FROM (backers b JOIN projects p ON ((b.project_id = p.id))) WHERE (b.confirmed = true) GROUP BY b.user_id;
1090
+
1091
+
1092
+ --
1093
+ -- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1094
+ --
1095
+
1096
+ CREATE SEQUENCE users_id_seq
1097
+ START WITH 1
1098
+ INCREMENT BY 1
1099
+ NO MINVALUE
1100
+ NO MAXVALUE
1101
+ CACHE 1;
1102
+
1103
+
1104
+ --
1105
+ -- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1106
+ --
1107
+
1108
+ ALTER SEQUENCE users_id_seq OWNED BY users.id;
1109
+
1110
+
1111
+ --
1112
+ -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1113
+ --
1114
+
1115
+ ALTER TABLE ONLY active_admin_comments ALTER COLUMN id SET DEFAULT nextval('admin_notes_id_seq'::regclass);
1116
+
1117
+
1118
+ --
1119
+ -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1120
+ --
1121
+
1122
+ ALTER TABLE ONLY backers ALTER COLUMN id SET DEFAULT nextval('backers_id_seq'::regclass);
1123
+
1124
+
1125
+ --
1126
+ -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1127
+ --
1128
+
1129
+ ALTER TABLE ONLY categories ALTER COLUMN id SET DEFAULT nextval('categories_id_seq'::regclass);
1130
+
1131
+
1132
+ --
1133
+ -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1134
+ --
1135
+
1136
+ ALTER TABLE ONLY comments ALTER COLUMN id SET DEFAULT nextval('comments_id_seq'::regclass);
1137
+
1138
+
1139
+ --
1140
+ -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1141
+ --
1142
+
1143
+ ALTER TABLE ONLY configurations ALTER COLUMN id SET DEFAULT nextval('configurations_id_seq'::regclass);
1144
+
1145
+
1146
+ --
1147
+ -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1148
+ --
1149
+
1150
+ ALTER TABLE ONLY curated_pages ALTER COLUMN id SET DEFAULT nextval('curated_pages_id_seq'::regclass);
1151
+
1152
+
1153
+ --
1154
+ -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1155
+ --
1156
+
1157
+ ALTER TABLE ONLY institutional_videos ALTER COLUMN id SET DEFAULT nextval('advert_videos_id_seq'::regclass);
1158
+
1159
+
1160
+ --
1161
+ -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1162
+ --
1163
+
1164
+ ALTER TABLE ONLY notification_types ALTER COLUMN id SET DEFAULT nextval('notification_types_id_seq'::regclass);
1165
+
1166
+
1167
+ --
1168
+ -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1169
+ --
1170
+
1171
+ ALTER TABLE ONLY notifications ALTER COLUMN id SET DEFAULT nextval('notifications_id_seq'::regclass);
1172
+
1173
+
1174
+ --
1175
+ -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1176
+ --
1177
+
1178
+ ALTER TABLE ONLY oauth_providers ALTER COLUMN id SET DEFAULT nextval('oauth_providers_id_seq'::regclass);
1179
+
1180
+
1181
+ --
1182
+ -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1183
+ --
1184
+
1185
+ ALTER TABLE ONLY payment_logs ALTER COLUMN id SET DEFAULT nextval('payment_logs_id_seq'::regclass);
1186
+
1187
+
1188
+ --
1189
+ -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1190
+ --
1191
+
1192
+ ALTER TABLE ONLY payment_notifications ALTER COLUMN id SET DEFAULT nextval('payment_notifications_id_seq'::regclass);
1193
+
1194
+
1195
+ --
1196
+ -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1197
+ --
1198
+
1199
+ ALTER TABLE ONLY projects ALTER COLUMN id SET DEFAULT nextval('projects_id_seq'::regclass);
1200
+
1201
+
1202
+ --
1203
+ -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1204
+ --
1205
+
1206
+ ALTER TABLE ONLY projects_curated_pages ALTER COLUMN id SET DEFAULT nextval('projects_curated_pages_id_seq'::regclass);
1207
+
1208
+
1209
+ --
1210
+ -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1211
+ --
1212
+
1213
+ ALTER TABLE ONLY rewards ALTER COLUMN id SET DEFAULT nextval('rewards_id_seq'::regclass);
1214
+
1215
+
1216
+ --
1217
+ -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1218
+ --
1219
+
1220
+ ALTER TABLE ONLY states ALTER COLUMN id SET DEFAULT nextval('states_id_seq'::regclass);
1221
+
1222
+
1223
+ --
1224
+ -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1225
+ --
1226
+
1227
+ ALTER TABLE ONLY static_contents ALTER COLUMN id SET DEFAULT nextval('static_contents_id_seq'::regclass);
1228
+
1229
+
1230
+ --
1231
+ -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1232
+ --
1233
+
1234
+ ALTER TABLE ONLY unsubscribes ALTER COLUMN id SET DEFAULT nextval('unsubscribes_id_seq'::regclass);
1235
+
1236
+
1237
+ --
1238
+ -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1239
+ --
1240
+
1241
+ ALTER TABLE ONLY updates ALTER COLUMN id SET DEFAULT nextval('updates_id_seq'::regclass);
1242
+
1243
+
1244
+ --
1245
+ -- Name: id; Type: DEFAULT; Schema: public; Owner: -
1246
+ --
1247
+
1248
+ ALTER TABLE ONLY users ALTER COLUMN id SET DEFAULT nextval('users_id_seq'::regclass);
1249
+
1250
+
1251
+ --
1252
+ -- Name: admin_notes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1253
+ --
1254
+
1255
+ ALTER TABLE ONLY active_admin_comments
1256
+ ADD CONSTRAINT admin_notes_pkey PRIMARY KEY (id);
1257
+
1258
+
1259
+ --
1260
+ -- Name: advert_videos_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1261
+ --
1262
+
1263
+ ALTER TABLE ONLY institutional_videos
1264
+ ADD CONSTRAINT advert_videos_pkey PRIMARY KEY (id);
1265
+
1266
+
1267
+ --
1268
+ -- Name: backers_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1269
+ --
1270
+
1271
+ ALTER TABLE ONLY backers
1272
+ ADD CONSTRAINT backers_pkey PRIMARY KEY (id);
1273
+
1274
+
1275
+ --
1276
+ -- Name: categories_name_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1277
+ --
1278
+
1279
+ ALTER TABLE ONLY categories
1280
+ ADD CONSTRAINT categories_name_unique UNIQUE (name);
1281
+
1282
+
1283
+ --
1284
+ -- Name: categories_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1285
+ --
1286
+
1287
+ ALTER TABLE ONLY categories
1288
+ ADD CONSTRAINT categories_pkey PRIMARY KEY (id);
1289
+
1290
+
1291
+ --
1292
+ -- Name: comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1293
+ --
1294
+
1295
+ ALTER TABLE ONLY comments
1296
+ ADD CONSTRAINT comments_pkey PRIMARY KEY (id);
1297
+
1298
+
1299
+ --
1300
+ -- Name: configurations_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1301
+ --
1302
+
1303
+ ALTER TABLE ONLY configurations
1304
+ ADD CONSTRAINT configurations_pkey PRIMARY KEY (id);
1305
+
1306
+
1307
+ --
1308
+ -- Name: curated_pages_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1309
+ --
1310
+
1311
+ ALTER TABLE ONLY curated_pages
1312
+ ADD CONSTRAINT curated_pages_pkey PRIMARY KEY (id);
1313
+
1314
+
1315
+ --
1316
+ -- Name: notification_types_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1317
+ --
1318
+
1319
+ ALTER TABLE ONLY notification_types
1320
+ ADD CONSTRAINT notification_types_pkey PRIMARY KEY (id);
1321
+
1322
+
1323
+ --
1324
+ -- Name: notifications_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1325
+ --
1326
+
1327
+ ALTER TABLE ONLY notifications
1328
+ ADD CONSTRAINT notifications_pkey PRIMARY KEY (id);
1329
+
1330
+
1331
+ --
1332
+ -- Name: oauth_providers_name_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1333
+ --
1334
+
1335
+ ALTER TABLE ONLY oauth_providers
1336
+ ADD CONSTRAINT oauth_providers_name_unique UNIQUE (name);
1337
+
1338
+
1339
+ --
1340
+ -- Name: oauth_providers_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1341
+ --
1342
+
1343
+ ALTER TABLE ONLY oauth_providers
1344
+ ADD CONSTRAINT oauth_providers_pkey PRIMARY KEY (id);
1345
+
1346
+
1347
+ --
1348
+ -- Name: payment_logs_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1349
+ --
1350
+
1351
+ ALTER TABLE ONLY payment_logs
1352
+ ADD CONSTRAINT payment_logs_pkey PRIMARY KEY (id);
1353
+
1354
+
1355
+ --
1356
+ -- Name: payment_notifications_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1357
+ --
1358
+
1359
+ ALTER TABLE ONLY payment_notifications
1360
+ ADD CONSTRAINT payment_notifications_pkey PRIMARY KEY (id);
1361
+
1362
+
1363
+ --
1364
+ -- Name: projects_curated_pages_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1365
+ --
1366
+
1367
+ ALTER TABLE ONLY projects_curated_pages
1368
+ ADD CONSTRAINT projects_curated_pages_pkey PRIMARY KEY (id);
1369
+
1370
+
1371
+ --
1372
+ -- Name: projects_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1373
+ --
1374
+
1375
+ ALTER TABLE ONLY projects
1376
+ ADD CONSTRAINT projects_pkey PRIMARY KEY (id);
1377
+
1378
+
1379
+ --
1380
+ -- Name: reward_ranges_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1381
+ --
1382
+
1383
+ ALTER TABLE ONLY reward_ranges
1384
+ ADD CONSTRAINT reward_ranges_pkey PRIMARY KEY (name);
1385
+
1386
+
1387
+ --
1388
+ -- Name: rewards_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1389
+ --
1390
+
1391
+ ALTER TABLE ONLY rewards
1392
+ ADD CONSTRAINT rewards_pkey PRIMARY KEY (id);
1393
+
1394
+
1395
+ --
1396
+ -- Name: states_acronym_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1397
+ --
1398
+
1399
+ ALTER TABLE ONLY states
1400
+ ADD CONSTRAINT states_acronym_unique UNIQUE (acronym);
1401
+
1402
+
1403
+ --
1404
+ -- Name: states_name_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1405
+ --
1406
+
1407
+ ALTER TABLE ONLY states
1408
+ ADD CONSTRAINT states_name_unique UNIQUE (name);
1409
+
1410
+
1411
+ --
1412
+ -- Name: states_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1413
+ --
1414
+
1415
+ ALTER TABLE ONLY states
1416
+ ADD CONSTRAINT states_pkey PRIMARY KEY (id);
1417
+
1418
+
1419
+ --
1420
+ -- Name: static_contents_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1421
+ --
1422
+
1423
+ ALTER TABLE ONLY static_contents
1424
+ ADD CONSTRAINT static_contents_pkey PRIMARY KEY (id);
1425
+
1426
+
1427
+ --
1428
+ -- Name: total_backed_ranges_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1429
+ --
1430
+
1431
+ ALTER TABLE ONLY total_backed_ranges
1432
+ ADD CONSTRAINT total_backed_ranges_pkey PRIMARY KEY (name);
1433
+
1434
+
1435
+ --
1436
+ -- Name: unsubscribes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1437
+ --
1438
+
1439
+ ALTER TABLE ONLY unsubscribes
1440
+ ADD CONSTRAINT unsubscribes_pkey PRIMARY KEY (id);
1441
+
1442
+
1443
+ --
1444
+ -- Name: updates_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1445
+ --
1446
+
1447
+ ALTER TABLE ONLY updates
1448
+ ADD CONSTRAINT updates_pkey PRIMARY KEY (id);
1449
+
1450
+
1451
+ --
1452
+ -- Name: users_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1453
+ --
1454
+
1455
+ ALTER TABLE ONLY users
1456
+ ADD CONSTRAINT users_pkey PRIMARY KEY (id);
1457
+
1458
+
1459
+ --
1460
+ -- Name: users_provider_uid_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1461
+ --
1462
+
1463
+ ALTER TABLE ONLY users
1464
+ ADD CONSTRAINT users_provider_uid_unique UNIQUE (provider, uid);
1465
+
1466
+
1467
+ --
1468
+ -- Name: index_active_admin_comments_on_author_type_and_author_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
1469
+ --
1470
+
1471
+ CREATE INDEX index_active_admin_comments_on_author_type_and_author_id ON active_admin_comments USING btree (author_type, author_id);
1472
+
1473
+
1474
+ --
1475
+ -- Name: index_active_admin_comments_on_namespace; Type: INDEX; Schema: public; Owner: -; Tablespace:
1476
+ --
1477
+
1478
+ CREATE INDEX index_active_admin_comments_on_namespace ON active_admin_comments USING btree (namespace);
1479
+
1480
+
1481
+ --
1482
+ -- Name: index_backers_on_confirmed; Type: INDEX; Schema: public; Owner: -; Tablespace:
1483
+ --
1484
+
1485
+ CREATE INDEX index_backers_on_confirmed ON backers USING btree (confirmed);
1486
+
1487
+
1488
+ --
1489
+ -- Name: index_backers_on_key; Type: INDEX; Schema: public; Owner: -; Tablespace:
1490
+ --
1491
+
1492
+ CREATE INDEX index_backers_on_key ON backers USING btree (key);
1493
+
1494
+
1495
+ --
1496
+ -- Name: index_backers_on_project_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
1497
+ --
1498
+
1499
+ CREATE INDEX index_backers_on_project_id ON backers USING btree (project_id);
1500
+
1501
+
1502
+ --
1503
+ -- Name: index_backers_on_reward_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
1504
+ --
1505
+
1506
+ CREATE INDEX index_backers_on_reward_id ON backers USING btree (reward_id);
1507
+
1508
+
1509
+ --
1510
+ -- Name: index_backers_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
1511
+ --
1512
+
1513
+ CREATE INDEX index_backers_on_user_id ON backers USING btree (user_id);
1514
+
1515
+
1516
+ --
1517
+ -- Name: index_categories_on_name; Type: INDEX; Schema: public; Owner: -; Tablespace:
1518
+ --
1519
+
1520
+ CREATE INDEX index_categories_on_name ON categories USING btree (name);
1521
+
1522
+
1523
+ --
1524
+ -- Name: index_comments_on_commentable_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
1525
+ --
1526
+
1527
+ CREATE INDEX index_comments_on_commentable_id ON comments USING btree (commentable_id);
1528
+
1529
+
1530
+ --
1531
+ -- Name: index_comments_on_commentable_type; Type: INDEX; Schema: public; Owner: -; Tablespace:
1532
+ --
1533
+
1534
+ CREATE INDEX index_comments_on_commentable_type ON comments USING btree (commentable_type);
1535
+
1536
+
1537
+ --
1538
+ -- Name: index_comments_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
1539
+ --
1540
+
1541
+ CREATE INDEX index_comments_on_user_id ON comments USING btree (user_id);
1542
+
1543
+
1544
+ --
1545
+ -- Name: index_confirmed_backers_on_project_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
1546
+ --
1547
+
1548
+ CREATE INDEX index_confirmed_backers_on_project_id ON backers USING btree (project_id) WHERE confirmed;
1549
+
1550
+
1551
+ --
1552
+ -- Name: index_curated_pages_on_permalink; Type: INDEX; Schema: public; Owner: -; Tablespace:
1553
+ --
1554
+
1555
+ CREATE INDEX index_curated_pages_on_permalink ON curated_pages USING btree (permalink);
1556
+
1557
+
1558
+ --
1559
+ -- Name: index_notification_types_on_name; Type: INDEX; Schema: public; Owner: -; Tablespace:
1560
+ --
1561
+
1562
+ CREATE UNIQUE INDEX index_notification_types_on_name ON notification_types USING btree (name);
1563
+
1564
+
1565
+ --
1566
+ -- Name: index_notifications_on_update_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
1567
+ --
1568
+
1569
+ CREATE INDEX index_notifications_on_update_id ON notifications USING btree (update_id);
1570
+
1571
+
1572
+ --
1573
+ -- Name: index_projects_on_category_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
1574
+ --
1575
+
1576
+ CREATE INDEX index_projects_on_category_id ON projects USING btree (category_id);
1577
+
1578
+
1579
+ --
1580
+ -- Name: index_projects_on_name; Type: INDEX; Schema: public; Owner: -; Tablespace:
1581
+ --
1582
+
1583
+ CREATE INDEX index_projects_on_name ON projects USING btree (name);
1584
+
1585
+
1586
+ --
1587
+ -- Name: index_projects_on_permalink; Type: INDEX; Schema: public; Owner: -; Tablespace:
1588
+ --
1589
+
1590
+ CREATE UNIQUE INDEX index_projects_on_permalink ON projects USING btree (permalink);
1591
+
1592
+
1593
+ --
1594
+ -- Name: index_projects_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
1595
+ --
1596
+
1597
+ CREATE INDEX index_projects_on_user_id ON projects USING btree (user_id);
1598
+
1599
+
1600
+ --
1601
+ -- Name: index_rewards_on_project_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
1602
+ --
1603
+
1604
+ CREATE INDEX index_rewards_on_project_id ON rewards USING btree (project_id);
1605
+
1606
+
1607
+ --
1608
+ -- Name: index_unsubscribes_on_notification_type_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
1609
+ --
1610
+
1611
+ CREATE INDEX index_unsubscribes_on_notification_type_id ON unsubscribes USING btree (notification_type_id);
1612
+
1613
+
1614
+ --
1615
+ -- Name: index_unsubscribes_on_project_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
1616
+ --
1617
+
1618
+ CREATE INDEX index_unsubscribes_on_project_id ON unsubscribes USING btree (project_id);
1619
+
1620
+
1621
+ --
1622
+ -- Name: index_unsubscribes_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
1623
+ --
1624
+
1625
+ CREATE INDEX index_unsubscribes_on_user_id ON unsubscribes USING btree (user_id);
1626
+
1627
+
1628
+ --
1629
+ -- Name: index_updates_on_project_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
1630
+ --
1631
+
1632
+ CREATE INDEX index_updates_on_project_id ON updates USING btree (project_id);
1633
+
1634
+
1635
+ --
1636
+ -- Name: index_users_on_email; Type: INDEX; Schema: public; Owner: -; Tablespace:
1637
+ --
1638
+
1639
+ CREATE INDEX index_users_on_email ON users USING btree (email);
1640
+
1641
+
1642
+ --
1643
+ -- Name: index_users_on_name; Type: INDEX; Schema: public; Owner: -; Tablespace:
1644
+ --
1645
+
1646
+ CREATE INDEX index_users_on_name ON users USING btree (name);
1647
+
1648
+
1649
+ --
1650
+ -- Name: index_users_on_primary_user_id_and_provider; Type: INDEX; Schema: public; Owner: -; Tablespace:
1651
+ --
1652
+
1653
+ CREATE INDEX index_users_on_primary_user_id_and_provider ON users USING btree (primary_user_id, provider);
1654
+
1655
+
1656
+ --
1657
+ -- Name: index_users_on_reset_password_token; Type: INDEX; Schema: public; Owner: -; Tablespace:
1658
+ --
1659
+
1660
+ CREATE UNIQUE INDEX index_users_on_reset_password_token ON users USING btree (reset_password_token);
1661
+
1662
+
1663
+ --
1664
+ -- Name: index_users_on_uid; Type: INDEX; Schema: public; Owner: -; Tablespace:
1665
+ --
1666
+
1667
+ CREATE INDEX index_users_on_uid ON users USING btree (uid);
1668
+
1669
+
1670
+ --
1671
+ -- Name: users_email; Type: INDEX; Schema: public; Owner: -; Tablespace:
1672
+ --
1673
+
1674
+ CREATE UNIQUE INDEX users_email ON users USING btree (email) WHERE (provider = 'devise'::text);
1675
+
1676
+
1677
+ --
1678
+ -- Name: backers_project_id_reference; Type: FK CONSTRAINT; Schema: public; Owner: -
1679
+ --
1680
+
1681
+ ALTER TABLE ONLY backers
1682
+ ADD CONSTRAINT backers_project_id_reference FOREIGN KEY (project_id) REFERENCES projects(id);
1683
+
1684
+
1685
+ --
1686
+ -- Name: backers_reward_id_reference; Type: FK CONSTRAINT; Schema: public; Owner: -
1687
+ --
1688
+
1689
+ ALTER TABLE ONLY backers
1690
+ ADD CONSTRAINT backers_reward_id_reference FOREIGN KEY (reward_id) REFERENCES rewards(id);
1691
+
1692
+
1693
+ --
1694
+ -- Name: backers_user_id_reference; Type: FK CONSTRAINT; Schema: public; Owner: -
1695
+ --
1696
+
1697
+ ALTER TABLE ONLY backers
1698
+ ADD CONSTRAINT backers_user_id_reference FOREIGN KEY (user_id) REFERENCES users(id);
1699
+
1700
+
1701
+ --
1702
+ -- Name: comments_user_id_reference; Type: FK CONSTRAINT; Schema: public; Owner: -
1703
+ --
1704
+
1705
+ ALTER TABLE ONLY comments
1706
+ ADD CONSTRAINT comments_user_id_reference FOREIGN KEY (user_id) REFERENCES users(id);
1707
+
1708
+
1709
+ --
1710
+ -- Name: notifications_backer_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
1711
+ --
1712
+
1713
+ ALTER TABLE ONLY notifications
1714
+ ADD CONSTRAINT notifications_backer_id_fk FOREIGN KEY (backer_id) REFERENCES backers(id);
1715
+
1716
+
1717
+ --
1718
+ -- Name: notifications_notification_type_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
1719
+ --
1720
+
1721
+ ALTER TABLE ONLY notifications
1722
+ ADD CONSTRAINT notifications_notification_type_id_fk FOREIGN KEY (notification_type_id) REFERENCES notification_types(id);
1723
+
1724
+
1725
+ --
1726
+ -- Name: notifications_project_id_reference; Type: FK CONSTRAINT; Schema: public; Owner: -
1727
+ --
1728
+
1729
+ ALTER TABLE ONLY notifications
1730
+ ADD CONSTRAINT notifications_project_id_reference FOREIGN KEY (project_id) REFERENCES projects(id);
1731
+
1732
+
1733
+ --
1734
+ -- Name: notifications_update_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
1735
+ --
1736
+
1737
+ ALTER TABLE ONLY notifications
1738
+ ADD CONSTRAINT notifications_update_id_fk FOREIGN KEY (update_id) REFERENCES updates(id);
1739
+
1740
+
1741
+ --
1742
+ -- Name: notifications_user_id_reference; Type: FK CONSTRAINT; Schema: public; Owner: -
1743
+ --
1744
+
1745
+ ALTER TABLE ONLY notifications
1746
+ ADD CONSTRAINT notifications_user_id_reference FOREIGN KEY (user_id) REFERENCES users(id);
1747
+
1748
+
1749
+ --
1750
+ -- Name: payment_notifications_backer_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
1751
+ --
1752
+
1753
+ ALTER TABLE ONLY payment_notifications
1754
+ ADD CONSTRAINT payment_notifications_backer_id_fk FOREIGN KEY (backer_id) REFERENCES backers(id);
1755
+
1756
+
1757
+ --
1758
+ -- Name: projects_category_id_reference; Type: FK CONSTRAINT; Schema: public; Owner: -
1759
+ --
1760
+
1761
+ ALTER TABLE ONLY projects
1762
+ ADD CONSTRAINT projects_category_id_reference FOREIGN KEY (category_id) REFERENCES categories(id);
1763
+
1764
+
1765
+ --
1766
+ -- Name: projects_user_id_reference; Type: FK CONSTRAINT; Schema: public; Owner: -
1767
+ --
1768
+
1769
+ ALTER TABLE ONLY projects
1770
+ ADD CONSTRAINT projects_user_id_reference FOREIGN KEY (user_id) REFERENCES users(id);
1771
+
1772
+
1773
+ --
1774
+ -- Name: rewards_project_id_reference; Type: FK CONSTRAINT; Schema: public; Owner: -
1775
+ --
1776
+
1777
+ ALTER TABLE ONLY rewards
1778
+ ADD CONSTRAINT rewards_project_id_reference FOREIGN KEY (project_id) REFERENCES projects(id);
1779
+
1780
+
1781
+ --
1782
+ -- Name: unsubscribes_notification_type_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
1783
+ --
1784
+
1785
+ ALTER TABLE ONLY unsubscribes
1786
+ ADD CONSTRAINT unsubscribes_notification_type_id_fk FOREIGN KEY (notification_type_id) REFERENCES notification_types(id);
1787
+
1788
+
1789
+ --
1790
+ -- Name: unsubscribes_project_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
1791
+ --
1792
+
1793
+ ALTER TABLE ONLY unsubscribes
1794
+ ADD CONSTRAINT unsubscribes_project_id_fk FOREIGN KEY (project_id) REFERENCES projects(id);
1795
+
1796
+
1797
+ --
1798
+ -- Name: unsubscribes_user_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
1799
+ --
1800
+
1801
+ ALTER TABLE ONLY unsubscribes
1802
+ ADD CONSTRAINT unsubscribes_user_id_fk FOREIGN KEY (user_id) REFERENCES users(id);
1803
+
1804
+
1805
+ --
1806
+ -- Name: updates_project_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
1807
+ --
1808
+
1809
+ ALTER TABLE ONLY updates
1810
+ ADD CONSTRAINT updates_project_id_fk FOREIGN KEY (project_id) REFERENCES projects(id);
1811
+
1812
+
1813
+ --
1814
+ -- Name: updates_user_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
1815
+ --
1816
+
1817
+ ALTER TABLE ONLY updates
1818
+ ADD CONSTRAINT updates_user_id_fk FOREIGN KEY (user_id) REFERENCES users(id);
1819
+
1820
+
1821
+ --
1822
+ -- Name: users_primary_user_id_reference; Type: FK CONSTRAINT; Schema: public; Owner: -
1823
+ --
1824
+
1825
+ ALTER TABLE ONLY users
1826
+ ADD CONSTRAINT users_primary_user_id_reference FOREIGN KEY (primary_user_id) REFERENCES users(id);
1827
+
1828
+ --
1829
+ -- PostgreSQL database dump complete
1830
+ --
1831
+ SQL
1832
+ end
1833
+
1834
+ def down
1835
+ end
1836
+ end