diff --git a/Gemfile b/Gemfile index b4d8587..091004b 100644 --- a/Gemfile +++ b/Gemfile @@ -13,6 +13,7 @@ gem 'sidekiq' gem 'skylight' gem 'stripe', :source => 'https://code.stripe.com/' gem 'uglifier', '>= 1.3.0' +gem 'simple_captcha2', require: 'simple_captcha' group :development, :test do gem 'foreman' diff --git a/Gemfile.lock b/Gemfile.lock index fa662c7..7bafdc5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,193 +2,200 @@ GEM remote: https://rubygems.org/ remote: https://code.stripe.com/ specs: - actioncable (5.1.6) - actionpack (= 5.1.6) + actioncable (5.1.7) + actionpack (= 5.1.7) nio4r (~> 2.0) websocket-driver (~> 0.6.1) - actionmailer (5.1.6) - actionpack (= 5.1.6) - actionview (= 5.1.6) - activejob (= 5.1.6) + actionmailer (5.1.7) + actionpack (= 5.1.7) + actionview (= 5.1.7) + activejob (= 5.1.7) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.1.6) - actionview (= 5.1.6) - activesupport (= 5.1.6) + actionpack (5.1.7) + actionview (= 5.1.7) + activesupport (= 5.1.7) rack (~> 2.0) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.1.6) - activesupport (= 5.1.6) + actionview (5.1.7) + activesupport (= 5.1.7) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (5.1.6) - activesupport (= 5.1.6) + activejob (5.1.7) + activesupport (= 5.1.7) globalid (>= 0.3.6) - activemodel (5.1.6) - activesupport (= 5.1.6) - activerecord (5.1.6) - activemodel (= 5.1.6) - activesupport (= 5.1.6) + activemodel (5.1.7) + activesupport (= 5.1.7) + activerecord (5.1.7) + activemodel (= 5.1.7) + activesupport (= 5.1.7) arel (~> 8.0) - activesupport (5.1.6) + activesupport (5.1.7) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) arel (8.0.0) ast (2.4.0) - autoprefixer-rails (7.1.6) + autoprefixer-rails (9.5.1.1) execjs - binding_of_caller (0.7.3) + binding_of_caller (0.8.0) debug_inspector (>= 0.0.1) builder (3.2.3) coderay (1.1.2) - concurrent-ruby (1.0.5) - connection_pool (2.2.1) + concurrent-ruby (1.1.5) + connection_pool (2.2.2) crass (1.0.4) debug_inspector (0.0.3) diff-lcs (1.3) - dotenv (2.2.1) - dotenv-rails (2.2.1) - dotenv (= 2.2.1) - railties (>= 3.2, < 5.2) - erubi (1.7.1) + dotenv (2.7.2) + dotenv-rails (2.7.2) + dotenv (= 2.7.2) + railties (>= 3.2, < 6.1) + erubi (1.8.0) execjs (2.7.0) - factory_bot (4.10.0) - activesupport (>= 3.0.0) - factory_bot_rails (4.10.0) - factory_bot (~> 4.10.0) - railties (>= 3.0.0) - faraday (0.13.1) + factory_bot (5.0.2) + activesupport (>= 4.2.0) + factory_bot_rails (5.0.2) + factory_bot (~> 5.0.2) + railties (>= 4.2.0) + faraday (0.15.4) multipart-post (>= 1.2, < 3) - ffi (1.9.25) - foreman (0.84.0) + ffi (1.11.1) + foreman (0.85.0) thor (~> 0.19.1) - globalid (0.4.1) + globalid (0.4.2) activesupport (>= 4.2.0) - httparty (0.15.6) + httparty (0.17.0) + mime-types (~> 3.0) multi_xml (>= 0.5.2) - i18n (1.1.0) + i18n (1.6.0) concurrent-ruby (~> 1.0) - jaro_winkler (1.5.1) - jquery-rails (4.3.1) + jaro_winkler (1.5.2) + jquery-rails (4.3.3) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) - loofah (2.2.2) + loofah (2.2.3) crass (~> 1.0.2) nokogiri (>= 1.5.9) - mail (2.7.0) + mail (2.7.1) mini_mime (>= 0.1.1) - method_source (0.9.0) + method_source (0.9.2) + mime-types (3.2.2) + mime-types-data (~> 3.2015) + mime-types-data (3.2019.0331) mini_mime (1.0.1) - mini_portile2 (2.3.0) + mini_portile2 (2.4.0) minitest (5.11.3) multi_xml (0.6.0) - multipart-post (2.0.0) + multipart-post (2.1.1) + net-http-persistent (3.0.1) + connection_pool (~> 2.2) nio4r (2.3.1) - nokogiri (1.8.5) - mini_portile2 (~> 2.3.0) - parallel (1.12.1) - parser (2.5.1.2) + nokogiri (1.10.3) + mini_portile2 (~> 2.4.0) + parallel (1.17.0) + parser (2.6.3.0) ast (~> 2.4.0) - pg (0.21.0) - powerpack (0.1.2) - pry (0.11.2) + pg (1.1.4) + pry (0.12.2) coderay (~> 1.1.0) method_source (~> 0.9.0) - rack (2.0.5) - rack-protection (2.0.0) + rack (2.0.7) + rack-protection (2.0.5) rack rack-test (1.1.0) rack (>= 1.0, < 3) - rails (5.1.6) - actioncable (= 5.1.6) - actionmailer (= 5.1.6) - actionpack (= 5.1.6) - actionview (= 5.1.6) - activejob (= 5.1.6) - activemodel (= 5.1.6) - activerecord (= 5.1.6) - activesupport (= 5.1.6) + rails (5.1.7) + actioncable (= 5.1.7) + actionmailer (= 5.1.7) + actionpack (= 5.1.7) + actionview (= 5.1.7) + activejob (= 5.1.7) + activemodel (= 5.1.7) + activerecord (= 5.1.7) + activesupport (= 5.1.7) bundler (>= 1.3.0) - railties (= 5.1.6) + railties (= 5.1.7) sprockets-rails (>= 2.0.0) - rails-controller-testing (1.0.2) - actionpack (~> 5.x, >= 5.0.1) - actionview (~> 5.x, >= 5.0.1) - activesupport (~> 5.x) + rails-controller-testing (1.0.4) + actionpack (>= 5.0.1.x) + actionview (>= 5.0.1.x) + activesupport (>= 5.0.1.x) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) rails-html-sanitizer (1.0.4) loofah (~> 2.2, >= 2.2.2) - railties (5.1.6) - actionpack (= 5.1.6) - activesupport (= 5.1.6) + railties (5.1.7) + actionpack (= 5.1.7) + activesupport (= 5.1.7) method_source rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rainbow (3.0.0) - rake (12.3.1) - rb-fsevent (0.10.2) - rb-inotify (0.9.10) - ffi (>= 0.5.0, < 2) - redis (4.0.1) - rspec-core (3.7.0) - rspec-support (~> 3.7.0) - rspec-expectations (3.7.0) + rake (12.3.2) + rb-fsevent (0.10.3) + rb-inotify (0.10.0) + ffi (~> 1.0) + redis (4.1.1) + rspec-core (3.8.0) + rspec-support (~> 3.8.0) + rspec-expectations (3.8.3) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.7.0) - rspec-mocks (3.7.0) + rspec-support (~> 3.8.0) + rspec-mocks (3.8.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.7.0) - rspec-rails (3.7.1) + rspec-support (~> 3.8.0) + rspec-rails (3.8.2) actionpack (>= 3.0) activesupport (>= 3.0) railties (>= 3.0) - rspec-core (~> 3.7.0) - rspec-expectations (~> 3.7.0) - rspec-mocks (~> 3.7.0) - rspec-support (~> 3.7.0) - rspec-support (3.7.0) - rubocop (0.58.2) + rspec-core (~> 3.8.0) + rspec-expectations (~> 3.8.0) + rspec-mocks (~> 3.8.0) + rspec-support (~> 3.8.0) + rspec-support (3.8.0) + rubocop (0.70.0) jaro_winkler (~> 1.5.1) parallel (~> 1.10) - parser (>= 2.5, != 2.5.1.1) - powerpack (~> 0.1) + parser (>= 2.6) rainbow (>= 2.2.2, < 4.0) ruby-progressbar (~> 1.7) - unicode-display_width (~> 1.0, >= 1.0.1) - ruby-progressbar (1.10.0) - sass (3.5.3) + unicode-display_width (>= 1.4.0, < 1.7) + ruby-progressbar (1.10.1) + sass (3.7.4) sass-listen (~> 4.0.0) sass-listen (4.0.0) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) - sass-rails (5.0.6) + sass-rails (5.0.7) railties (>= 4.0.0, < 6) sass (~> 3.1) sprockets (>= 2.8, < 4.0) sprockets-rails (>= 2.0, < 4.0) tilt (>= 1.1, < 3) - secure_headers (5.0.1) - useragent (>= 0.15.0) - sentry-raven (2.7.1) + secure_headers (6.1.0) + sentry-raven (2.9.0) faraday (>= 0.7.6, < 1.0) - shoulda-matchers (3.1.2) - activesupport (>= 4.0.0) - sidekiq (5.0.5) - concurrent-ruby (~> 1.0) - connection_pool (~> 2.2, >= 2.2.0) + shoulda-matchers (4.0.1) + activesupport (>= 4.2.0) + sidekiq (5.2.7) + connection_pool (~> 2.2, >= 2.2.2) + rack (>= 1.5.0) rack-protection (>= 1.5.0) - redis (>= 3.3.4, < 5) - skylight (1.4.4) - activesupport (>= 3.0.0) + redis (>= 3.3.5, < 5) + simple_captcha2 (0.4.3) + rails (>= 4.1) + skylight (4.0.2) + skylight-core (= 4.0.2) + skylight-core (4.0.2) + activesupport (>= 4.2.0) spring (2.0.2) activesupport (>= 4.2) sprockets (3.7.2) @@ -198,17 +205,17 @@ GEM actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) - stripe (3.8.0) - faraday (~> 0.10) + stripe (4.18.1) + faraday (~> 0.13) + net-http-persistent (~> 3.0) thor (0.19.4) thread_safe (0.3.6) - tilt (2.0.8) + tilt (2.0.9) tzinfo (1.2.5) thread_safe (~> 0.1) - uglifier (3.2.0) + uglifier (4.1.20) execjs (>= 0.3.0, < 3) - unicode-display_width (1.4.0) - useragent (0.16.8) + unicode-display_width (1.6.0) web-console (2.3.0) activemodel (>= 4.0) binding_of_caller (>= 0.7.2) @@ -239,6 +246,7 @@ DEPENDENCIES sentry-raven shoulda-matchers sidekiq + simple_captcha2 skylight spring stripe! @@ -246,4 +254,4 @@ DEPENDENCIES web-console (~> 2.0) BUNDLED WITH - 1.16.5 + 1.17.3 diff --git a/README.md b/README.md index 8099a2b..6166d65 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,8 @@ A really simple rails application to accept credit card donations for [Noisebrid * PostgreSQL * Ruby >= 2.4.0 * foreman `gem install foreman` + * ghostscript `apt-get install ghostscript` + * imagemagick `apt-get install imagemagick` If you have `rbenv` and `ruby-build` installed you should be able to do the following ```bash diff --git a/app/assets/stylesheets/donation_form.scss b/app/assets/stylesheets/donation_form.scss index 7e7b6af..1472dcc 100644 --- a/app/assets/stylesheets/donation_form.scss +++ b/app/assets/stylesheets/donation_form.scss @@ -55,4 +55,13 @@ .input-group.custom-amount { margin-top: 10px; } + + .simple_captcha { + width: 100%; + display: flex; + flex-direction: column; + border-radius: 5px; + align-items: center; + margin-bottom: 15px; + } } diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 60b0715..25d4b7b 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -4,4 +4,5 @@ class ApplicationController < ActionController::Base protect_from_forgery with: :exception include SecureHeaders::ViewHelpers + include SimpleCaptcha::ControllerHelpers end diff --git a/app/controllers/donations_controller.rb b/app/controllers/donations_controller.rb index 932ea87..7662ede 100644 --- a/app/controllers/donations_controller.rb +++ b/app/controllers/donations_controller.rb @@ -20,6 +20,12 @@ def plan_params end def find_or_create_donor + unless simple_captcha_valid? + flash[:danger] = "Invalid CAPTCHA" + return redirect_to root_url + end + + @donor = if Donor.exists?(email: donor_params[:email]) find_and_update_donor else diff --git a/app/views/donations/_credit_card.html.erb b/app/views/donations/_credit_card.html.erb index d1a4e22..3de0fcd 100644 --- a/app/views/donations/_credit_card.html.erb +++ b/app/views/donations/_credit_card.html.erb @@ -51,6 +51,8 @@ <% end %> + <%= show_simple_captcha %> +
<%= button_tag "Donate", {class: "btn btn-primary"} %>
diff --git a/app/views/simple_captcha/_simple_captcha.erb b/app/views/simple_captcha/_simple_captcha.erb new file mode 100644 index 0000000..e80daef --- /dev/null +++ b/app/views/simple_captcha/_simple_captcha.erb @@ -0,0 +1,41 @@ + + +
+
+ <%= simple_captcha_options[:image] %> +
+ +
+ <%= simple_captcha_options[:field] %> +
+ +
+ <%= simple_captcha_options[:label] %> +
+ +
+ <%= simple_captcha_options[:refresh_button] %> +
+
diff --git a/config/locales/en.yml b/config/locales/en.yml index 0653957..0396cd5 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -21,3 +21,10 @@ en: hello: "Hello world" + simple_captcha: + placeholder: "Enter the image value" + label: "Enter the code in the box:" + refresh_button_text: "Refresh" + message: + default: "Secret Code did not match with the Image" + user: "The secret Image and code were different" diff --git a/db/migrate/20150122061454_create_stripe_plans.rb b/db/migrate/20150122061454_create_stripe_plans.rb index 55d8b6d..a4d4e71 100644 --- a/db/migrate/20150122061454_create_stripe_plans.rb +++ b/db/migrate/20150122061454_create_stripe_plans.rb @@ -1,4 +1,4 @@ -class CreateStripePlans < ActiveRecord::Migration +class CreateStripePlans < ActiveRecord::Migration[4.2] def change create_table :stripe_plans do |t| t.string :stripe_id diff --git a/db/migrate/20150122062120_create_stripe_subscriptions.rb b/db/migrate/20150122062120_create_stripe_subscriptions.rb index 66f7b90..462a81a 100644 --- a/db/migrate/20150122062120_create_stripe_subscriptions.rb +++ b/db/migrate/20150122062120_create_stripe_subscriptions.rb @@ -1,4 +1,4 @@ -class CreateStripeSubscriptions < ActiveRecord::Migration +class CreateStripeSubscriptions < ActiveRecord::Migration[4.2] def change create_table :stripe_subscriptions do |t| t.integer :stripe_plan_id, null: false diff --git a/db/migrate/20150123073453_create_donors.rb b/db/migrate/20150123073453_create_donors.rb index 8417466..dd0073b 100644 --- a/db/migrate/20150123073453_create_donors.rb +++ b/db/migrate/20150123073453_create_donors.rb @@ -1,4 +1,4 @@ -class CreateDonors < ActiveRecord::Migration +class CreateDonors < ActiveRecord::Migration[4.2] def change create_table :donors do |t| t.string :email, null: false diff --git a/db/migrate/20150123073626_change_stripe_subscription_ownership.rb b/db/migrate/20150123073626_change_stripe_subscription_ownership.rb index 9acb759..1acd857 100644 --- a/db/migrate/20150123073626_change_stripe_subscription_ownership.rb +++ b/db/migrate/20150123073626_change_stripe_subscription_ownership.rb @@ -1,4 +1,4 @@ -class ChangeStripeSubscriptionOwnership < ActiveRecord::Migration +class ChangeStripeSubscriptionOwnership < ActiveRecord::Migration[4.2] def up remove_column(:stripe_subscriptions, :stripe_customer_id) add_column(:stripe_subscriptions, :donor_id, :integer, null: false) diff --git a/db/migrate/20150125011731_make_donors_email_nullable.rb b/db/migrate/20150125011731_make_donors_email_nullable.rb index 1345e42..2e3d641 100644 --- a/db/migrate/20150125011731_make_donors_email_nullable.rb +++ b/db/migrate/20150125011731_make_donors_email_nullable.rb @@ -1,4 +1,4 @@ -class MakeDonorsEmailNullable < ActiveRecord::Migration +class MakeDonorsEmailNullable < ActiveRecord::Migration[4.2] def up change_column(:donors, :email, :string, null: true) end diff --git a/db/migrate/20150125012640_rename_subscriptions_stripe_plan_id_to_plan_id.rb b/db/migrate/20150125012640_rename_subscriptions_stripe_plan_id_to_plan_id.rb index 0303b2c..c0b339f 100644 --- a/db/migrate/20150125012640_rename_subscriptions_stripe_plan_id_to_plan_id.rb +++ b/db/migrate/20150125012640_rename_subscriptions_stripe_plan_id_to_plan_id.rb @@ -1,4 +1,4 @@ -class RenameSubscriptionsStripePlanIdToPlanId < ActiveRecord::Migration +class RenameSubscriptionsStripePlanIdToPlanId < ActiveRecord::Migration[4.2] def up remove_column(:stripe_subscriptions, :stripe_plan_id) add_column(:stripe_subscriptions, :plan_id, :integer, null: false) diff --git a/db/migrate/20150127072345_add_stripe_subscription_id_to_stripe_subscriptions.rb b/db/migrate/20150127072345_add_stripe_subscription_id_to_stripe_subscriptions.rb index 91af7bb..930ccf7 100644 --- a/db/migrate/20150127072345_add_stripe_subscription_id_to_stripe_subscriptions.rb +++ b/db/migrate/20150127072345_add_stripe_subscription_id_to_stripe_subscriptions.rb @@ -1,4 +1,4 @@ -class AddStripeSubscriptionIdToStripeSubscriptions < ActiveRecord::Migration +class AddStripeSubscriptionIdToStripeSubscriptions < ActiveRecord::Migration[4.2] def up add_column(:stripe_subscriptions, :stripe_subscription_id, :string, null: false) end diff --git a/db/migrate/20150204064444_make_donor_email_required.rb b/db/migrate/20150204064444_make_donor_email_required.rb index c1871fa..3edfc2b 100644 --- a/db/migrate/20150204064444_make_donor_email_required.rb +++ b/db/migrate/20150204064444_make_donor_email_required.rb @@ -1,4 +1,4 @@ -class MakeDonorEmailRequired < ActiveRecord::Migration +class MakeDonorEmailRequired < ActiveRecord::Migration[4.2] def up change_column(:donors, :email, :string, null: false) end diff --git a/db/migrate/20150207042218_create_charges.rb b/db/migrate/20150207042218_create_charges.rb index 3fea5a1..1877313 100644 --- a/db/migrate/20150207042218_create_charges.rb +++ b/db/migrate/20150207042218_create_charges.rb @@ -1,4 +1,4 @@ -class CreateCharges < ActiveRecord::Migration +class CreateCharges < ActiveRecord::Migration[4.2] def change create_table :charges do |t| t.integer :donor_id, null: false diff --git a/db/migrate/20150209012448_add_name_to_donors.rb b/db/migrate/20150209012448_add_name_to_donors.rb index 7160ebe..cd50e6d 100644 --- a/db/migrate/20150209012448_add_name_to_donors.rb +++ b/db/migrate/20150209012448_add_name_to_donors.rb @@ -1,4 +1,4 @@ -class AddNameToDonors < ActiveRecord::Migration +class AddNameToDonors < ActiveRecord::Migration[4.2] def up add_column(:donors, :name, :string, limit: 120) end diff --git a/db/migrate/20150209031917_add_anonymous_to_donors.rb b/db/migrate/20150209031917_add_anonymous_to_donors.rb index c4f9fcb..f92d8e7 100644 --- a/db/migrate/20150209031917_add_anonymous_to_donors.rb +++ b/db/migrate/20150209031917_add_anonymous_to_donors.rb @@ -1,4 +1,4 @@ -class AddAnonymousToDonors < ActiveRecord::Migration +class AddAnonymousToDonors < ActiveRecord::Migration[4.2] def up add_column(:donors, :anonymous, :boolean, default: false) end diff --git a/db/migrate/20150209040539_set_donor_email_not_null.rb b/db/migrate/20150209040539_set_donor_email_not_null.rb index 4527b02..7b6c423 100644 --- a/db/migrate/20150209040539_set_donor_email_not_null.rb +++ b/db/migrate/20150209040539_set_donor_email_not_null.rb @@ -1,4 +1,4 @@ -class SetDonorEmailNotNull < ActiveRecord::Migration +class SetDonorEmailNotNull < ActiveRecord::Migration[4.2] def up change_column(:donors, :email, :string, null: false) end diff --git a/db/migrate/20150222000634_add_dues_flag_to_subscriptions.rb b/db/migrate/20150222000634_add_dues_flag_to_subscriptions.rb index 2aef6e2..2fed268 100644 --- a/db/migrate/20150222000634_add_dues_flag_to_subscriptions.rb +++ b/db/migrate/20150222000634_add_dues_flag_to_subscriptions.rb @@ -1,4 +1,4 @@ -class AddDuesFlagToSubscriptions < ActiveRecord::Migration +class AddDuesFlagToSubscriptions < ActiveRecord::Migration[4.2] def change add_column(:stripe_subscriptions, :dues, :boolean, default: false, null: false) end diff --git a/db/migrate/20150523043432_add_subscription_id_to_charges.rb b/db/migrate/20150523043432_add_subscription_id_to_charges.rb index 080e1fe..292abf2 100644 --- a/db/migrate/20150523043432_add_subscription_id_to_charges.rb +++ b/db/migrate/20150523043432_add_subscription_id_to_charges.rb @@ -1,4 +1,4 @@ -class AddSubscriptionIdToCharges < ActiveRecord::Migration +class AddSubscriptionIdToCharges < ActiveRecord::Migration[4.2] def up add_column(:charges, :subscription_id, :integer) end diff --git a/db/migrate/20160122044601_add_tag_to_charges.rb b/db/migrate/20160122044601_add_tag_to_charges.rb index fd5043b..6037a31 100644 --- a/db/migrate/20160122044601_add_tag_to_charges.rb +++ b/db/migrate/20160122044601_add_tag_to_charges.rb @@ -1,4 +1,4 @@ -class AddTagToCharges < ActiveRecord::Migration +class AddTagToCharges < ActiveRecord::Migration[4.2] def change add_column(:charges, :tag, :string) end diff --git a/db/migrate/20190522220344_create_simple_captcha_data.rb b/db/migrate/20190522220344_create_simple_captcha_data.rb new file mode 100644 index 0000000..9068aec --- /dev/null +++ b/db/migrate/20190522220344_create_simple_captcha_data.rb @@ -0,0 +1,15 @@ +class CreateSimpleCaptchaData < ActiveRecord::Migration[4.2] + def self.up + create_table :simple_captcha_data do |t| + t.string :key, :limit => 40 + t.string :value, :limit => 6 + t.timestamps + end + + add_index :simple_captcha_data, :key, :name => "idx_key" + end + + def self.down + drop_table :simple_captcha_data + end +end diff --git a/db/schema.rb b/db/schema.rb index 5b9339b..6b73f5a 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -15,63 +15,63 @@ # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" - create_table "charges", force: :cascade do |t| - t.integer "donor_id", null: false - t.integer "amount", null: false - t.string "stripe_charge_id", null: false + create_table "charges", id: :serial, force: :cascade do |t| + t.integer "donor_id", null: false + t.integer "amount", null: false + t.string "stripe_charge_id", null: false t.datetime "created_at" t.datetime "updated_at" - t.integer "subscription_id" - t.string "tag" - t.boolean "anonymous", default: true, null: false + t.integer "subscription_id" + t.string "tag" + t.boolean "anonymous", default: true, null: false end - create_table "donors", force: :cascade do |t| - t.string "email", null: false - t.string "stripe_customer_id", null: false + create_table "donors", id: :serial, force: :cascade do |t| + t.string "email", null: false + t.string "stripe_customer_id", null: false t.datetime "created_at" t.datetime "updated_at" - t.string "name", limit: 120 - t.boolean "anonymous", default: false + t.string "name", limit: 120 + t.boolean "anonymous", default: false end - create_table "paypal_notifications", force: :cascade do |t| - t.string "notification_id", null: false - t.json "payload", null: false + create_table "paypal_notifications", id: :serial, force: :cascade do |t| + t.string "notification_id", null: false + t.json "payload", null: false t.datetime "processed_at" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["notification_id"], name: "index_paypal_notifications_on_notification_id", unique: true, using: :btree + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["notification_id"], name: "index_paypal_notifications_on_notification_id", unique: true end - create_table "stripe_events", force: :cascade do |t| - t.string "stripe_id", null: false - t.json "body" + create_table "stripe_events", id: :serial, force: :cascade do |t| + t.string "stripe_id", null: false + t.json "body" t.datetime "processed_at" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["stripe_id"], name: "index_stripe_events_on_stripe_id", unique: true, using: :btree + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["stripe_id"], name: "index_stripe_events_on_stripe_id", unique: true end - create_table "stripe_plans", force: :cascade do |t| - t.string "stripe_id" - t.string "name", null: false - t.integer "amount", null: false + create_table "stripe_plans", id: :serial, force: :cascade do |t| + t.string "stripe_id" + t.string "name", null: false + t.integer "amount", null: false t.datetime "created_at" t.datetime "updated_at" - t.index ["stripe_id"], name: "index_stripe_plans_on_stripe_id", unique: true, using: :btree + t.index ["stripe_id"], name: "index_stripe_plans_on_stripe_id", unique: true end - create_table "stripe_subscriptions", force: :cascade do |t| - t.string "stripe_status" + create_table "stripe_subscriptions", id: :serial, force: :cascade do |t| + t.string "stripe_status" t.datetime "cancellation_requested_at" t.datetime "cancelled_at" t.datetime "created_at" t.datetime "updated_at" - t.integer "donor_id", null: false - t.integer "plan_id", null: false - t.string "stripe_subscription_id", null: false - t.boolean "dues", default: false, null: false + t.integer "donor_id", null: false + t.integer "plan_id", null: false + t.string "stripe_subscription_id", null: false + t.boolean "dues", default: false, null: false end end