Skip to content

Commit

Permalink
Merge pull request #13421 from saraycp/extend_notifications_id_column…
Browse files Browse the repository at this point in the history
…_capacity

Extend notifications primary and foreign keys capacity
  • Loading branch information
eduardoj committed Nov 30, 2022
2 parents 93cd2bd + b79c355 commit 54cb27b
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/api/app/models/notification.rb
Expand Up @@ -66,7 +66,7 @@ def track_notification_delivered
#
# Table name: notifications
#
# id :integer not null, primary key
# id :bigint not null, primary key
# bs_request_oldstate :string(255)
# bs_request_state :string(255)
# delivered :boolean default(FALSE)
Expand Down
4 changes: 2 additions & 2 deletions src/api/app/models/notified_project.rb
Expand Up @@ -9,9 +9,9 @@ class NotifiedProject < ApplicationRecord
#
# Table name: notified_projects
#
# id :integer not null, primary key
# id :bigint not null, primary key
# created_at :datetime not null
# notification_id :integer not null, indexed, indexed => [project_id]
# notification_id :bigint not null, indexed, indexed => [project_id]
# project_id :integer not null, indexed => [notification_id]
#
# Indexes
Expand Down
@@ -0,0 +1,16 @@
class ChangeNotificationsPrimaryAndForeignKeysToBigint < ActiveRecord::Migration[7.0]
def up
# This migration blocks the table, we are running it during Maintenance Window.
safety_assured do
# Foreign key
change_column :notified_projects, :notification_id, :bigint
# Primary key
change_column :notified_projects, :id, :bigint, auto_increment: true
change_column :notifications, :id, :bigint, auto_increment: true
end
end

def down
raise ActiveRecord::IrreversibleMigration
end
end
8 changes: 4 additions & 4 deletions src/api/db/schema.rb
Expand Up @@ -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_06_22_135133) do
ActiveRecord::Schema[7.0].define(version: 2022_11_23_163119) do
create_table "architectures", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", options: "ENGINE=InnoDB ROW_FORMAT=DYNAMIC", force: :cascade do |t|
t.string "name", null: false, collation: "utf8mb3_general_ci"
t.boolean "available", default: false
Expand Down Expand Up @@ -668,7 +668,7 @@
t.index ["maintenance_db_project_id"], name: "index_maintenance_incidents_on_maintenance_db_project_id"
end

create_table "notifications", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", options: "ENGINE=InnoDB ROW_FORMAT=DYNAMIC", force: :cascade do |t|
create_table "notifications", charset: "utf8mb4", collation: "utf8mb4_unicode_ci", options: "ENGINE=InnoDB ROW_FORMAT=DYNAMIC", force: :cascade do |t|
t.string "event_type", null: false, collation: "utf8mb3_general_ci"
t.text "event_payload", null: false
t.string "subscription_receiver_role", null: false, collation: "utf8mb3_general_ci"
Expand All @@ -689,8 +689,8 @@
t.index ["subscriber_type", "subscriber_id"], name: "index_notifications_on_subscriber_type_and_subscriber_id"
end

create_table "notified_projects", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t|
t.integer "notification_id", null: false
create_table "notified_projects", charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t|
t.bigint "notification_id", null: false
t.integer "project_id", null: false
t.datetime "created_at", null: false
t.index ["notification_id", "project_id"], name: "index_notified_projects_on_notification_id_and_project_id", unique: true
Expand Down

0 comments on commit 54cb27b

Please sign in to comment.