mirror of
https://github.com/mastodon/mastodon.git
synced 2026-09-09 00:05:53 -05:00
Add NOT NULL requirement to columns on account_conversations (#33308)
Some checks failed
Check i18n / check-i18n (push) Waiting to run
Check formatting / 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
Bundler Audit / security (push) Has been cancelled
Crowdin / Upload translations / upload-translations (push) Has been cancelled
CSS Linting / lint (push) Has been cancelled
Haml Linting / lint (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
CodeQL / Analyze (ruby) (push) Has been cancelled
Some checks failed
Check i18n / check-i18n (push) Waiting to run
Check formatting / 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
Bundler Audit / security (push) Has been cancelled
Crowdin / Upload translations / upload-translations (push) Has been cancelled
CSS Linting / lint (push) Has been cancelled
Haml Linting / lint (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
CodeQL / Analyze (ruby) (push) Has been cancelled
This commit is contained in:
@@ -5,13 +5,13 @@
|
||||
# Table name: account_conversations
|
||||
#
|
||||
# id :bigint(8) not null, primary key
|
||||
# account_id :bigint(8)
|
||||
# conversation_id :bigint(8)
|
||||
# lock_version :integer default(0), not null
|
||||
# participant_account_ids :bigint(8) default([]), not null, is an Array
|
||||
# status_ids :bigint(8) default([]), not null, is an Array
|
||||
# last_status_id :bigint(8)
|
||||
# lock_version :integer default(0), not null
|
||||
# unread :boolean default(FALSE), not null
|
||||
# account_id :bigint(8) not null
|
||||
# conversation_id :bigint(8) not null
|
||||
# last_status_id :bigint(8)
|
||||
#
|
||||
|
||||
class AccountConversation < ApplicationRecord
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class AddNotNullToAccountConversationAccountColumn < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
add_check_constraint :account_conversations, 'account_id IS NOT NULL', name: 'account_conversations_account_id_null', validate: false
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,19 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ValidateNotNullToAccountConversationAccountColumn < ActiveRecord::Migration[7.2]
|
||||
def up
|
||||
connection.execute(<<~SQL.squish)
|
||||
DELETE FROM account_conversations
|
||||
WHERE account_id IS NULL
|
||||
SQL
|
||||
|
||||
validate_check_constraint :account_conversations, name: 'account_conversations_account_id_null'
|
||||
change_column_null :account_conversations, :account_id, false
|
||||
remove_check_constraint :account_conversations, name: 'account_conversations_account_id_null'
|
||||
end
|
||||
|
||||
def down
|
||||
add_check_constraint :account_conversations, 'account_id IS NOT NULL', name: 'account_conversations_account_id_null', validate: false
|
||||
change_column_null :account_conversations, :account_id, true
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class AddNotNullToAccountConversationConversationColumn < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
add_check_constraint :account_conversations, 'conversation_id IS NOT NULL', name: 'account_conversations_conversation_id_null', validate: false
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,19 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ValidateNotNullToAccountConversationConversationColumn < ActiveRecord::Migration[7.2]
|
||||
def up
|
||||
connection.execute(<<~SQL.squish)
|
||||
DELETE FROM account_conversations
|
||||
WHERE conversation_id IS NULL
|
||||
SQL
|
||||
|
||||
validate_check_constraint :account_conversations, name: 'account_conversations_conversation_id_null'
|
||||
change_column_null :account_conversations, :conversation_id, false
|
||||
remove_check_constraint :account_conversations, name: 'account_conversations_conversation_id_null'
|
||||
end
|
||||
|
||||
def down
|
||||
add_check_constraint :account_conversations, 'conversation_id IS NOT NULL', name: 'account_conversations_conversation_id_null', validate: false
|
||||
change_column_null :account_conversations, :conversation_id, true
|
||||
end
|
||||
end
|
||||
@@ -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_12_154346) do
|
||||
ActiveRecord::Schema[7.2].define(version: 2024_12_13_170053) do
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
||||
@@ -24,8 +24,8 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_12_154346) do
|
||||
end
|
||||
|
||||
create_table "account_conversations", force: :cascade do |t|
|
||||
t.bigint "account_id"
|
||||
t.bigint "conversation_id"
|
||||
t.bigint "account_id", null: false
|
||||
t.bigint "conversation_id", null: false
|
||||
t.bigint "participant_account_ids", default: [], null: false, array: true
|
||||
t.bigint "status_ids", default: [], null: false, array: true
|
||||
t.bigint "last_status_id"
|
||||
|
||||
Reference in New Issue
Block a user