Merge commit 'fd284311e7
' into kb_migration
This commit is contained in:
commit
287eacf5f3
400 changed files with 4667 additions and 5387 deletions
|
@ -4,10 +4,39 @@ class AddFromAccountIdToNotifications < ActiveRecord::Migration[5.0]
|
|||
def up
|
||||
add_column :notifications, :from_account_id, :integer
|
||||
|
||||
Notification.where(from_account_id: nil).where(activity_type: 'Status').update_all('from_account_id = (SELECT statuses.account_id FROM notifications AS notifications1 INNER JOIN statuses ON notifications1.activity_id = statuses.id WHERE notifications1.activity_type = \'Status\' AND notifications1.id = notifications.id)')
|
||||
Notification.where(from_account_id: nil).where(activity_type: 'Mention').update_all('from_account_id = (SELECT statuses.account_id FROM notifications AS notifications1 INNER JOIN mentions ON notifications1.activity_id = mentions.id INNER JOIN statuses ON mentions.status_id = statuses.id WHERE notifications1.activity_type = \'Mention\' AND notifications1.id = notifications.id)')
|
||||
Notification.where(from_account_id: nil).where(activity_type: 'Favourite').update_all('from_account_id = (SELECT favourites.account_id FROM notifications AS notifications1 INNER JOIN favourites ON notifications1.activity_id = favourites.id WHERE notifications1.activity_type = \'Favourite\' AND notifications1.id = notifications.id)')
|
||||
Notification.where(from_account_id: nil).where(activity_type: 'Follow').update_all('from_account_id = (SELECT follows.account_id FROM notifications AS notifications1 INNER JOIN follows ON notifications1.activity_id = follows.id WHERE notifications1.activity_type = \'Follow\' AND notifications1.id = notifications.id)')
|
||||
Notification.where(from_account_id: nil).where(activity_type: 'Status').update_all(<<~SQL.squish)
|
||||
from_account_id = (
|
||||
SELECT statuses.account_id
|
||||
FROM notifications AS notifications1
|
||||
INNER JOIN statuses ON notifications1.activity_id = statuses.id
|
||||
WHERE notifications1.activity_type = 'Status' AND notifications1.id = notifications.id
|
||||
)
|
||||
SQL
|
||||
Notification.where(from_account_id: nil).where(activity_type: 'Mention').update_all(<<~SQL.squish)
|
||||
from_account_id = (
|
||||
SELECT statuses.account_id
|
||||
FROM notifications AS notifications1
|
||||
INNER JOIN mentions ON notifications1.activity_id = mentions.id
|
||||
INNER JOIN statuses ON mentions.status_id = statuses.id
|
||||
WHERE notifications1.activity_type = 'Mention' AND notifications1.id = notifications.id
|
||||
)
|
||||
SQL
|
||||
Notification.where(from_account_id: nil).where(activity_type: 'Favourite').update_all(<<~SQL.squish)
|
||||
from_account_id = (
|
||||
SELECT favourites.account_id
|
||||
FROM notifications AS notifications1
|
||||
INNER JOIN favourites ON notifications1.activity_id = favourites.id
|
||||
WHERE notifications1.activity_type = 'Favourite' AND notifications1.id = notifications.id
|
||||
)
|
||||
SQL
|
||||
Notification.where(from_account_id: nil).where(activity_type: 'Follow').update_all(<<~SQL.squish)
|
||||
from_account_id = (
|
||||
SELECT follows.account_id
|
||||
FROM notifications AS notifications1
|
||||
INNER JOIN follows ON notifications1.activity_id = follows.id
|
||||
WHERE notifications1.activity_type = 'Follow' AND notifications1.id = notifications.id
|
||||
)
|
||||
SQL
|
||||
end
|
||||
|
||||
def down
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddPublishedAtToPreviewCards < ActiveRecord::Migration[7.0]
|
||||
def change
|
||||
add_column :preview_cards, :published_at, :datetime
|
||||
end
|
||||
end
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[7.0].define(version: 2023_07_14_004824) do
|
||||
ActiveRecord::Schema[7.0].define(version: 2023_07_24_160715) do
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
||||
|
@ -906,6 +906,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_07_14_004824) do
|
|||
t.datetime "max_score_at", precision: nil
|
||||
t.boolean "trendable"
|
||||
t.integer "link_type"
|
||||
t.datetime "published_at"
|
||||
t.index ["url"], name: "index_preview_cards_on_url", unique: true
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue