Merge branch 'master' into glitch-soc/merge-upstream
Conflicts: app/models/status.rb db/migrate/20180528141303_fix_accounts_unique_index.rb db/schema.rb Resolved by taking upstream changes (no real conflicts, just glitch-soc specific code too close to actual changes).
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
require Rails.root.join('lib', 'mastodon', 'migration_helpers')
|
||||
|
||||
class ChangeAccountIdNonnullableInLists < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
change_column_null :lists, :account_id, false
|
||||
|
@@ -6,6 +6,10 @@ class FixAccountsUniqueIndex < ActiveRecord::Migration[5.2]
|
||||
def local?
|
||||
domain.nil?
|
||||
end
|
||||
|
||||
def acct
|
||||
local? ? username : "#{username}@#{domain}"
|
||||
end
|
||||
end
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
12
db/migrate/20180812162710_create_status_stats.rb
Normal file
12
db/migrate/20180812162710_create_status_stats.rb
Normal file
@@ -0,0 +1,12 @@
|
||||
class CreateStatusStats < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :status_stats do |t|
|
||||
t.belongs_to :status, null: false, foreign_key: { on_delete: :cascade }, index: { unique: true }
|
||||
t.bigint :replies_count, null: false, default: 0
|
||||
t.bigint :reblogs_count, null: false, default: 0
|
||||
t.bigint :favourites_count, null: false, default: 0
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
19
db/migrate/20180812173710_copy_status_stats.rb
Normal file
19
db/migrate/20180812173710_copy_status_stats.rb
Normal file
@@ -0,0 +1,19 @@
|
||||
class CopyStatusStats < ActiveRecord::Migration[5.2]
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
safety_assured do
|
||||
execute <<-SQL.squish
|
||||
INSERT INTO status_stats (status_id, reblogs_count, favourites_count, created_at, updated_at)
|
||||
SELECT id, reblogs_count, favourites_count, created_at, updated_at
|
||||
FROM statuses
|
||||
ON CONFLICT (status_id) DO UPDATE
|
||||
SET reblogs_count = EXCLUDED.reblogs_count, favourites_count = EXCLUDED.favourites_count
|
||||
SQL
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
# Nothing
|
||||
end
|
||||
end
|
@@ -0,0 +1,23 @@
|
||||
require Rails.root.join('lib', 'mastodon', 'migration_helpers')
|
||||
|
||||
class AddConfidentialToDoorkeeperApplication < ActiveRecord::Migration[5.2]
|
||||
include Mastodon::MigrationHelpers
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
safety_assured do
|
||||
add_column_with_default(
|
||||
:oauth_applications,
|
||||
:confidential,
|
||||
:boolean,
|
||||
allow_null: false,
|
||||
default: true # maintaining backwards compatibility: require secrets
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
remove_column :oauth_applications, :confidential
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user