Add NOT NULL requirement to account columns on AccountPin (#33244)
Some checks are pending
Bundler Audit / security (push) Waiting to run
Check i18n / check-i18n (push) Waiting to run
CodeQL / Analyze (javascript) (push) Waiting to run
CodeQL / Analyze (ruby) (push) Waiting to run
Check formatting / lint (push) Waiting to run
CSS Linting / lint (push) Waiting to run
Haml Linting / lint (push) Waiting to run
JavaScript Linting / lint (push) Waiting to run
Ruby Linting / lint (push) Waiting to run
JavaScript Testing / test (push) Waiting to run
Historical data migration test / test (14-alpine) (push) Waiting to run
Historical data migration test / test (15-alpine) (push) Waiting to run
Historical data migration test / test (16-alpine) (push) Waiting to run
Historical data migration test / test (17-alpine) (push) Waiting to run
Ruby Testing / build (production) (push) Waiting to run
Ruby Testing / build (test) (push) Waiting to run
Ruby Testing / test (.ruby-version) (push) Blocked by required conditions
Ruby Testing / test (3.2) (push) Blocked by required conditions
Ruby Testing / Libvips tests (.ruby-version) (push) Blocked by required conditions
Ruby Testing / Libvips tests (3.2) (push) Blocked by required conditions
Ruby Testing / End to End testing (.ruby-version) (push) Blocked by required conditions
Ruby Testing / End to End testing (3.2) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (.ruby-version, docker.elastic.co/elasticsearch/elasticsearch:7.17.13) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (.ruby-version, docker.elastic.co/elasticsearch/elasticsearch:8.10.2) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (.ruby-version, opensearchproject/opensearch:2) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (3.2, docker.elastic.co/elasticsearch/elasticsearch:7.17.13) (push) Blocked by required conditions

This commit is contained in:
Matt Jankowski 2024-12-10 10:50:49 -05:00 committed by GitHub
parent e76aff7de5
commit e4e35ab134
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 28 additions and 5 deletions

View File

@ -5,10 +5,10 @@
# Table name: account_pins
#
# id :bigint(8) not null, primary key
# account_id :bigint(8)
# target_account_id :bigint(8)
# created_at :datetime not null
# updated_at :datetime not null
# account_id :bigint(8) not null
# target_account_id :bigint(8) not null
#
class AccountPin < ApplicationRecord

View File

@ -0,0 +1,23 @@
# frozen_string_literal: true
class AddNotNullToAccountPinAccountColumns < ActiveRecord::Migration[7.2]
def up
connection.execute(<<~SQL.squish)
DELETE FROM account_pins
WHERE account_id IS NULL
OR target_account_id IS NULL
SQL
safety_assured do
change_column_null :account_pins, :account_id, false
change_column_null :account_pins, :target_account_id, false
end
end
def down
safety_assured do
change_column_null :account_pins, :account_id, true
change_column_null :account_pins, :target_account_id, true
end
end
end

View File

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.2].define(version: 2024_12_05_163118) do
ActiveRecord::Schema[7.2].define(version: 2024_12_10_140838) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -82,8 +82,8 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_05_163118) do
end
create_table "account_pins", force: :cascade do |t|
t.bigint "account_id"
t.bigint "target_account_id"
t.bigint "account_id", null: false
t.bigint "target_account_id", null: false
t.datetime "created_at", precision: nil, null: false
t.datetime "updated_at", precision: nil, null: false
t.index ["account_id", "target_account_id"], name: "index_account_pins_on_account_id_and_target_account_id", unique: true