Merge remote-tracking branch 'parent/main' into upstream-20241231
This commit is contained in:
commit
3c77d4e8e4
268 changed files with 4213 additions and 3029 deletions
|
@ -1,16 +0,0 @@
|
|||
inherit_from: ../../.rubocop.yml
|
||||
|
||||
# Below are all enabled as workaround for https://docs.rubocop.org/rubocop/configuration.html#path-relativity
|
||||
# TODO: Delete this file and move above config to base naming config
|
||||
|
||||
Rails/CreateTableWithTimestamps:
|
||||
Include:
|
||||
- '*.rb'
|
||||
|
||||
Rails/ThreeStateBooleanColumn:
|
||||
Include:
|
||||
- '*.rb'
|
||||
|
||||
Rails/ReversibleMigration:
|
||||
Include:
|
||||
- '*.rb'
|
|
@ -17,7 +17,7 @@ class MigrateSettings < ActiveRecord::Migration[4.2]
|
|||
t.remove_index [:thing_type, :thing_id, :var]
|
||||
t.rename :thing_id, :target_id
|
||||
t.rename :thing_type, :target_type
|
||||
t.column :target_id, :integer, null: false
|
||||
t.column :target_id, :integer, null: false # rubocop:disable Rails/NotNullColumn
|
||||
t.column :target_type, :string, null: false, default: ''
|
||||
t.index [:target_type, :target_id, :var], unique: true
|
||||
end
|
||||
|
|
|
@ -9,7 +9,7 @@ class MigrateNotificationsPolicyV2 < ActiveRecord::Migration[7.1]
|
|||
def up
|
||||
NotificationPolicy.in_batches.update_all(<<~SQL.squish)
|
||||
for_not_following = CASE filter_not_following WHEN true THEN 1 ELSE 0 END,
|
||||
for_not_followers = CASE filter_not_following WHEN true THEN 1 ELSE 0 END,
|
||||
for_not_followers = CASE filter_not_followers WHEN true THEN 1 ELSE 0 END,
|
||||
for_new_accounts = CASE filter_new_accounts WHEN true THEN 1 ELSE 0 END,
|
||||
for_private_mentions = CASE filter_private_mentions WHEN true THEN 1 ELSE 0 END
|
||||
SQL
|
||||
|
@ -18,7 +18,7 @@ class MigrateNotificationsPolicyV2 < ActiveRecord::Migration[7.1]
|
|||
def down
|
||||
NotificationPolicy.in_batches.update_all(<<~SQL.squish)
|
||||
filter_not_following = CASE for_not_following WHEN 0 THEN false ELSE true END,
|
||||
filter_not_following = CASE for_not_followers WHEN 0 THEN false ELSE true END,
|
||||
filter_not_followers = CASE for_not_followers WHEN 0 THEN false ELSE true END,
|
||||
filter_new_accounts = CASE for_new_accounts WHEN 0 THEN false ELSE true END,
|
||||
filter_private_mentions = CASE for_private_mentions WHEN 0 THEN false ELSE true END
|
||||
SQL
|
||||
|
|
|
@ -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
|
|
@ -0,0 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddNotNullToAccountNoteAccountColumn < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
add_check_constraint :account_notes, 'account_id IS NOT NULL', name: 'account_notes_account_id_null', validate: false
|
||||
end
|
||||
end
|
|
@ -0,0 +1,19 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class ValidateNotNullToAccountNoteAccountColumn < ActiveRecord::Migration[7.2]
|
||||
def up
|
||||
connection.execute(<<~SQL.squish)
|
||||
DELETE FROM account_notes
|
||||
WHERE account_id IS NULL
|
||||
SQL
|
||||
|
||||
validate_check_constraint :account_notes, name: 'account_notes_account_id_null'
|
||||
change_column_null :account_notes, :account_id, false
|
||||
remove_check_constraint :account_notes, name: 'account_notes_account_id_null'
|
||||
end
|
||||
|
||||
def down
|
||||
add_check_constraint :account_notes, 'account_id IS NOT NULL', name: 'account_notes_account_id_null', validate: false
|
||||
change_column_null :account_notes, :account_id, true
|
||||
end
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddNotNullToAccountNoteTargetAccountColumn < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
add_check_constraint :account_notes, 'target_account_id IS NOT NULL', name: 'account_notes_target_account_id_null', validate: false
|
||||
end
|
||||
end
|
|
@ -0,0 +1,19 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class ValidateNotNullToAccountNoteTargetAccountColumn < ActiveRecord::Migration[7.2]
|
||||
def up
|
||||
connection.execute(<<~SQL.squish)
|
||||
DELETE FROM account_notes
|
||||
WHERE target_account_id IS NULL
|
||||
SQL
|
||||
|
||||
validate_check_constraint :account_notes, name: 'account_notes_target_account_id_null'
|
||||
change_column_null :account_notes, :target_account_id, false
|
||||
remove_check_constraint :account_notes, name: 'account_notes_target_account_id_null'
|
||||
end
|
||||
|
||||
def down
|
||||
add_check_constraint :account_notes, 'target_account_id IS NOT NULL', name: 'account_notes_target_account_id_null', validate: false
|
||||
change_column_null :account_notes, :target_account_id, true
|
||||
end
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddNotNullToMarkerUserColumn < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
add_check_constraint :markers, 'user_id IS NOT NULL', name: 'markers_user_id_null', validate: false
|
||||
end
|
||||
end
|
|
@ -0,0 +1,19 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class ValidateNotNullToMarkerUserColumn < ActiveRecord::Migration[7.2]
|
||||
def up
|
||||
connection.execute(<<~SQL.squish)
|
||||
DELETE FROM markers
|
||||
WHERE user_id IS NULL
|
||||
SQL
|
||||
|
||||
validate_check_constraint :markers, name: 'markers_user_id_null'
|
||||
change_column_null :markers, :user_id, false
|
||||
remove_check_constraint :markers, name: 'markers_user_id_null'
|
||||
end
|
||||
|
||||
def down
|
||||
add_check_constraint :markers, 'user_id IS NOT NULL', name: 'markers_user_id_null', validate: false
|
||||
change_column_null :markers, :user_id, true
|
||||
end
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddNotNullToPollVoteAccountColumn < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
add_check_constraint :poll_votes, 'account_id IS NOT NULL', name: 'poll_votes_account_id_null', validate: false
|
||||
end
|
||||
end
|
|
@ -0,0 +1,19 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class ValidateNotNullToPollVoteAccountColumn < ActiveRecord::Migration[7.2]
|
||||
def up
|
||||
connection.execute(<<~SQL.squish)
|
||||
DELETE FROM poll_votes
|
||||
WHERE account_id IS NULL
|
||||
SQL
|
||||
|
||||
validate_check_constraint :poll_votes, name: 'poll_votes_account_id_null'
|
||||
change_column_null :poll_votes, :account_id, false
|
||||
remove_check_constraint :poll_votes, name: 'poll_votes_account_id_null'
|
||||
end
|
||||
|
||||
def down
|
||||
add_check_constraint :poll_votes, 'account_id IS NOT NULL', name: 'poll_votes_account_id_null', validate: false
|
||||
change_column_null :poll_votes, :account_id, true
|
||||
end
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddNotNullToPollVotePollColumn < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
add_check_constraint :poll_votes, 'poll_id IS NOT NULL', name: 'poll_votes_poll_id_null', validate: false
|
||||
end
|
||||
end
|
|
@ -0,0 +1,19 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class ValidateNotNullToPollVotePollColumn < ActiveRecord::Migration[7.2]
|
||||
def up
|
||||
connection.execute(<<~SQL.squish)
|
||||
DELETE FROM poll_votes
|
||||
WHERE poll_id IS NULL
|
||||
SQL
|
||||
|
||||
validate_check_constraint :poll_votes, name: 'poll_votes_poll_id_null'
|
||||
change_column_null :poll_votes, :poll_id, false
|
||||
remove_check_constraint :poll_votes, name: 'poll_votes_poll_id_null'
|
||||
end
|
||||
|
||||
def down
|
||||
add_check_constraint :poll_votes, 'poll_id IS NOT NULL', name: 'poll_votes_poll_id_null', validate: false
|
||||
change_column_null :poll_votes, :poll_id, true
|
||||
end
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddNotNullToPollAccountColumn < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
add_check_constraint :polls, 'account_id IS NOT NULL', name: 'polls_account_id_null', validate: false
|
||||
end
|
||||
end
|
|
@ -0,0 +1,19 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class ValidateNotNullToPollAccountColumn < ActiveRecord::Migration[7.2]
|
||||
def up
|
||||
connection.execute(<<~SQL.squish)
|
||||
DELETE FROM polls
|
||||
WHERE account_id IS NULL
|
||||
SQL
|
||||
|
||||
validate_check_constraint :polls, name: 'polls_account_id_null'
|
||||
change_column_null :polls, :account_id, false
|
||||
remove_check_constraint :polls, name: 'polls_account_id_null'
|
||||
end
|
||||
|
||||
def down
|
||||
add_check_constraint :polls, 'account_id IS NOT NULL', name: 'polls_account_id_null', validate: false
|
||||
change_column_null :polls, :account_id, true
|
||||
end
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddNotNullToPollStatusColumn < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
add_check_constraint :polls, 'status_id IS NOT NULL', name: 'polls_status_id_null', validate: false
|
||||
end
|
||||
end
|
|
@ -0,0 +1,19 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class ValidateNotNullToPollStatusColumn < ActiveRecord::Migration[7.2]
|
||||
def up
|
||||
connection.execute(<<~SQL.squish)
|
||||
DELETE FROM polls
|
||||
WHERE status_id IS NULL
|
||||
SQL
|
||||
|
||||
validate_check_constraint :polls, name: 'polls_status_id_null'
|
||||
change_column_null :polls, :status_id, false
|
||||
remove_check_constraint :polls, name: 'polls_status_id_null'
|
||||
end
|
||||
|
||||
def down
|
||||
add_check_constraint :polls, 'status_id IS NOT NULL', name: 'polls_status_id_null', validate: false
|
||||
change_column_null :polls, :status_id, true
|
||||
end
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddNotNullToTombstoneAccountColumn < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
add_check_constraint :tombstones, 'account_id IS NOT NULL', name: 'tombstones_account_id_null', validate: false
|
||||
end
|
||||
end
|
|
@ -0,0 +1,19 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class ValidateNotNullToTombstoneAccountColumn < ActiveRecord::Migration[7.2]
|
||||
def up
|
||||
connection.execute(<<~SQL.squish)
|
||||
DELETE FROM tombstones
|
||||
WHERE account_id IS NULL
|
||||
SQL
|
||||
|
||||
validate_check_constraint :tombstones, name: 'tombstones_account_id_null'
|
||||
change_column_null :tombstones, :account_id, false
|
||||
remove_check_constraint :tombstones, name: 'tombstones_account_id_null'
|
||||
end
|
||||
|
||||
def down
|
||||
add_check_constraint :tombstones, 'account_id IS NOT NULL', name: 'tombstones_account_id_null', validate: false
|
||||
change_column_null :tombstones, :account_id, true
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue