From 29421d8fbb55da3c0afa675849961e2836e69dcb Mon Sep 17 00:00:00 2001 From: Ridhwana Date: Thu, 6 Oct 2022 16:30:48 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=82=EF=B8=8F=E2=9C=82=EF=B8=8F=E2=9C=82?= =?UTF-8?q?=EF=B8=8F=20Part=203:=20Remove=20Sponsorship=20Table=20(#18529)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: remove initializeSponsorshipVisibility and related code * feat: remove sponsorships from sidebar * feat: remove sponsorships from the admin - route, controller, view, spec * feat: remove the admin menu item * feat: remove the i8n for admin sponsors controller * feat: sponsorship decorator was not being used anywhere * feat: sponsorship slack messenger was not being used anywhere * feat: remove the sponsorship_headline that gets configures on the admin * feat: remove the /sponsors page * feat: remove renedring of single_sponsor partial and associated partials * feat: remove the navigation link rake task for sponsors * feat: remove sponsorship from tags * feat: remove i8n constants used * remove sponsor references in text to the privacy page * feat: remove the sponsorship detail from the organization page * feat: remove the sponsors css that was used for app/views/pages/sponsors.html.erb * feat: remove the sponsorship i8n that was used in the slack messengers * feat: swap out the decorators to use Article as an example * feat: remove spec to show sponsors on home page * feat: update the specs to use Article Decorator instead of the Sponsorship Decorator * fix: use direct and not all * fix: remove tests for tag sponsorship * fix: remove organization sponsorship test * feat: remove more i8n * remove unused css from app/views/organizations/_sidebar_additional.html.erb * feat: remove sponsorship relationship from tag and organization * remove seed * feat: remove all Sponsor related specs * feat: remove model, associated i8n and specs * feat: remove sponsor from navbar * feat: add a guard clause if we're unable to constantinize the purchase_type * feat; remove sponsorship related tests * feat: remove sponsorship relationship * feat: remov especs related to sponsorship * feat: remove tag sponsorship validation * feat: remove the sponsorship factory * feat: drop the sponsorships table --- .../20221003103855_drop_sponsorship_table.rb | 15 +++++++++++ db/schema.rb | 27 +------------------ 2 files changed, 16 insertions(+), 26 deletions(-) create mode 100644 db/migrate/20221003103855_drop_sponsorship_table.rb diff --git a/db/migrate/20221003103855_drop_sponsorship_table.rb b/db/migrate/20221003103855_drop_sponsorship_table.rb new file mode 100644 index 000000000..e1391cce3 --- /dev/null +++ b/db/migrate/20221003103855_drop_sponsorship_table.rb @@ -0,0 +1,15 @@ +class DropSponsorshipTable < ActiveRecord::Migration[7.0] + def up + safety_assured do + remove_foreign_key :sponsorships, :organizations + remove_foreign_key :sponsorships, :users + + drop_table :sponsorships + end + end + + def down + raise ActiveRecord::IrreversibleMigratione + end +end + diff --git a/db/schema.rb b/db/schema.rb index 745c7bb39..116cfe51a 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2022_09_28_162321) do +ActiveRecord::Schema[7.0].define(version: 2022_10_03_103855) do # These are extensions that must be enabled in order to support this database enable_extension "citext" enable_extension "pg_stat_statements" @@ -1051,29 +1051,6 @@ ActiveRecord::Schema[7.0].define(version: 2022_09_28_162321) do t.index ["var"], name: "index_site_configs_on_var", unique: true end - create_table "sponsorships", force: :cascade do |t| - t.text "blurb_html" - t.datetime "created_at", precision: nil, null: false - t.datetime "expires_at", precision: nil - t.integer "featured_number", default: 0, null: false - t.text "instructions" - t.datetime "instructions_updated_at", precision: nil - t.string "level", null: false - t.bigint "organization_id" - t.bigint "sponsorable_id" - t.string "sponsorable_type" - t.string "status", default: "none", null: false - t.string "tagline" - t.datetime "updated_at", precision: nil, null: false - t.string "url" - t.bigint "user_id" - t.index ["level"], name: "index_sponsorships_on_level" - t.index ["organization_id"], name: "index_sponsorships_on_organization_id" - t.index ["sponsorable_id", "sponsorable_type"], name: "index_sponsorships_on_sponsorable_id_and_sponsorable_type" - t.index ["status"], name: "index_sponsorships_on_status" - t.index ["user_id"], name: "index_sponsorships_on_user_id" - end - create_table "tag_adjustments", force: :cascade do |t| t.string "adjustment_type" t.bigint "article_id" @@ -1437,8 +1414,6 @@ ActiveRecord::Schema[7.0].define(version: 2022_09_28_162321) do add_foreign_key "rating_votes", "users", on_delete: :nullify add_foreign_key "reactions", "users", on_delete: :cascade add_foreign_key "response_templates", "users" - add_foreign_key "sponsorships", "organizations" - add_foreign_key "sponsorships", "users" add_foreign_key "tag_adjustments", "articles", on_delete: :cascade add_foreign_key "tag_adjustments", "tags", on_delete: :cascade add_foreign_key "tag_adjustments", "users", on_delete: :cascade