From a9099b67d352e7e9e35860852fb8f7ced9709341 Mon Sep 17 00:00:00 2001 From: David M <207745043+davidmillen50@users.noreply.github.com> Date: Tue, 13 Oct 2026 11:01:44 +0100 Subject: [PATCH 1/2] chore: drop dead tables: jobs, courses, course_tutors and course_invitations --- ...se_tutors_and_course_invitations_tables.rb | 81 +++++++++++++++++++ db/schema.rb | 69 +--------------- 2 files changed, 82 insertions(+), 68 deletions(-) create mode 100644 db/migrate/20261013094721_drop_jobs_courses_course_tutors_and_course_invitations_tables.rb diff --git a/db/migrate/20261013094721_drop_jobs_courses_course_tutors_and_course_invitations_tables.rb b/db/migrate/20261013094721_drop_jobs_courses_course_tutors_and_course_invitations_tables.rb new file mode 100644 index 000000000..3c11b80a9 --- /dev/null +++ b/db/migrate/20261013094721_drop_jobs_courses_course_tutors_and_course_invitations_tables.rb @@ -0,0 +1,81 @@ +class DropJobsCoursesCourseTutorsAndCourseInvitationsTables < ActiveRecord::Migration[7.0] + def up + drop_table :course_tutors + drop_table :course_invitations + drop_table :courses + drop_table :jobs + end + + def down + create_table :courses, id: :serial do |t| + t.string :title + t.string :short_description + t.text :description + t.integer :tutor_id + t.datetime :date_and_time, precision: nil + t.integer :seats, default: 0 + t.string :slug + t.string :url + t.datetime :created_at, precision: nil + t.datetime :updated_at, precision: nil + t.integer :sponsor_id + t.string :ticket_url + t.integer :chapter_id + t.datetime :ends_at, precision: nil + + t.index :chapter_id, name: "index_courses_on_chapter_id" + t.index :sponsor_id, name: "index_courses_on_sponsor_id" + t.index :tutor_id, name: "index_courses_on_tutor_id" + end + + create_table :course_tutors, id: :serial do |t| + t.integer :course_id + t.integer :tutor_id + t.datetime :created_at, precision: nil + t.datetime :updated_at, precision: nil + + t.index :course_id, name: "index_course_tutors_on_course_id" + t.index :tutor_id, name: "index_course_tutors_on_tutor_id" + end + + create_table :course_invitations, id: :serial do |t| + t.integer :course_id + t.integer :member_id + t.boolean :attending + t.boolean :attended + t.text :note + t.string :token + t.datetime :created_at, precision: nil + t.datetime :updated_at, precision: nil + + t.index :course_id, name: "index_course_invitations_on_course_id" + t.index :member_id, name: "index_course_invitations_on_member_id" + end + + create_table :jobs, id: :serial do |t| + t.string :title + t.text :description + t.string :location + t.datetime :expiry_date, precision: nil + t.string :email + t.string :link_to_job + t.integer :created_by_id + t.boolean :approved, default: false + t.boolean :submitted, default: false + t.datetime :created_at, precision: nil + t.datetime :updated_at, precision: nil + t.string :company + t.integer :approved_by_id + t.string :company_website + t.string :company_address + t.string :company_postcode + t.datetime :published_on, precision: nil + t.boolean :remote + t.integer :salary + t.string :slug + t.integer :status, default: 0 + + t.index :created_by_id, name: "index_jobs_on_created_by_id" + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 0aaeadeca..d5c539f60 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[8.1].define(version: 2026_10_12_090000) do +ActiveRecord::Schema[8.1].define(version: 2026_10_13_094721) do # These are extensions that must be enabled in order to support this database enable_extension "pg_catalog.plpgsql" @@ -135,48 +135,6 @@ t.index ["sponsor_id"], name: "index_contacts_on_sponsor_id" end - create_table "course_invitations", id: :serial, force: :cascade do |t| - t.boolean "attended" - t.boolean "attending" - t.integer "course_id" - t.datetime "created_at", precision: nil - t.integer "member_id" - t.text "note" - t.string "token" - t.datetime "updated_at", precision: nil - t.index ["course_id"], name: "index_course_invitations_on_course_id" - t.index ["member_id"], name: "index_course_invitations_on_member_id" - end - - create_table "course_tutors", id: :serial, force: :cascade do |t| - t.integer "course_id" - t.datetime "created_at", precision: nil - t.integer "tutor_id" - t.datetime "updated_at", precision: nil - t.index ["course_id"], name: "index_course_tutors_on_course_id" - t.index ["tutor_id"], name: "index_course_tutors_on_tutor_id" - end - - create_table "courses", id: :serial, force: :cascade do |t| - t.integer "chapter_id" - t.datetime "created_at", precision: nil - t.datetime "date_and_time", precision: nil - t.text "description" - t.datetime "ends_at", precision: nil - t.integer "seats", default: 0 - t.string "short_description" - t.string "slug" - t.integer "sponsor_id" - t.string "ticket_url" - t.string "title" - t.integer "tutor_id" - t.datetime "updated_at", precision: nil - t.string "url" - t.index ["chapter_id"], name: "index_courses_on_chapter_id" - t.index ["sponsor_id"], name: "index_courses_on_sponsor_id" - t.index ["tutor_id"], name: "index_courses_on_tutor_id" - end - create_table "delayed_jobs", id: :serial, force: :cascade do |t| t.integer "attempts", default: 0, null: false t.datetime "created_at", precision: nil @@ -361,31 +319,6 @@ t.index ["verified_by_id"], name: "index_invitations_on_verified_by_id" end - create_table "jobs", id: :serial, force: :cascade do |t| - t.boolean "approved", default: false - t.integer "approved_by_id" - t.string "company" - t.string "company_address" - t.string "company_postcode" - t.string "company_website" - t.datetime "created_at", precision: nil - t.integer "created_by_id" - t.text "description" - t.string "email" - t.datetime "expiry_date", precision: nil - t.string "link_to_job" - t.string "location" - t.datetime "published_on", precision: nil - t.boolean "remote" - t.integer "salary" - t.string "slug" - t.integer "status", default: 0 - t.boolean "submitted", default: false - t.string "title" - t.datetime "updated_at", precision: nil - t.index ["created_by_id"], name: "index_jobs_on_created_by_id" - end - create_table "meeting_invitations", id: :serial, force: :cascade do |t| t.boolean "attended", default: false t.boolean "attending" From 6abcdcf7879f7df8677f6c37ec03810ff203be86 Mon Sep 17 00:00:00 2001 From: David M <207745043+davidmillen50@users.noreply.github.com> Date: Tue, 13 Oct 2026 12:06:12 +0100 Subject: [PATCH 2/2] Fix dropped tables migration schema --- ...ses_course_tutors_and_course_invitations_tables.rb} | 10 ++++++---- db/schema.rb | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) rename db/migrate/{20261013094721_drop_jobs_courses_course_tutors_and_course_invitations_tables.rb => 20261013103442_drop_jobs_courses_course_tutors_and_course_invitations_tables.rb} (94%) diff --git a/db/migrate/20261013094721_drop_jobs_courses_course_tutors_and_course_invitations_tables.rb b/db/migrate/20261013103442_drop_jobs_courses_course_tutors_and_course_invitations_tables.rb similarity index 94% rename from db/migrate/20261013094721_drop_jobs_courses_course_tutors_and_course_invitations_tables.rb rename to db/migrate/20261013103442_drop_jobs_courses_course_tutors_and_course_invitations_tables.rb index 3c11b80a9..0e73090e9 100644 --- a/db/migrate/20261013094721_drop_jobs_courses_course_tutors_and_course_invitations_tables.rb +++ b/db/migrate/20261013103442_drop_jobs_courses_course_tutors_and_course_invitations_tables.rb @@ -1,9 +1,11 @@ class DropJobsCoursesCourseTutorsAndCourseInvitationsTables < ActiveRecord::Migration[7.0] def up - drop_table :course_tutors - drop_table :course_invitations - drop_table :courses - drop_table :jobs + safety_assured do + drop_table :course_tutors + drop_table :course_invitations + drop_table :courses + drop_table :jobs + end end def down diff --git a/db/schema.rb b/db/schema.rb index d5c539f60..51944621a 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[8.1].define(version: 2026_10_13_094721) do +ActiveRecord::Schema[8.1].define(version: 2026_10_13_103442) do # These are extensions that must be enabled in order to support this database enable_extension "pg_catalog.plpgsql"