Merge tag 'v3.0.0' into hometown-dev
This commit is contained in:
@ -3,7 +3,7 @@ class AddInReplyToAccountIdToStatuses < ActiveRecord::Migration[5.0]
|
||||
add_column :statuses, :in_reply_to_account_id, :integer, null: true, default: nil
|
||||
|
||||
ActiveRecord::Base.transaction do
|
||||
Status.where.not(in_reply_to_id: nil).includes(:thread).find_each do |status|
|
||||
Status.unscoped.where.not(in_reply_to_id: nil).includes(:thread).find_each do |status|
|
||||
next if status.thread.nil?
|
||||
|
||||
status.in_reply_to_account_id = status.thread.account_id
|
||||
|
@ -1,7 +1,7 @@
|
||||
class AddReplyToStatuses < ActiveRecord::Migration[5.0]
|
||||
def up
|
||||
add_column :statuses, :reply, :boolean, nil: false, default: false
|
||||
Status.update_all('reply = (in_reply_to_id IS NOT NULL)')
|
||||
Status.unscoped.update_all('reply = (in_reply_to_id IS NOT NULL)')
|
||||
end
|
||||
|
||||
def down
|
||||
|
@ -5,70 +5,70 @@ class IdsToBigints < ActiveRecord::Migration[5.1]
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
INCLUDED_COLUMNS = [
|
||||
[:account_domain_blocks, :account_id],
|
||||
[:account_domain_blocks, :id],
|
||||
[:accounts, :id],
|
||||
[:blocks, :account_id],
|
||||
[:blocks, :id],
|
||||
[:blocks, :target_account_id],
|
||||
[:conversation_mutes, :account_id],
|
||||
[:conversation_mutes, :id],
|
||||
[:domain_blocks, :id],
|
||||
[:favourites, :account_id],
|
||||
[:favourites, :id],
|
||||
[:favourites, :status_id],
|
||||
[:follow_requests, :account_id],
|
||||
[:follow_requests, :id],
|
||||
[:follow_requests, :target_account_id],
|
||||
[:follows, :account_id],
|
||||
[:follows, :id],
|
||||
[:follows, :target_account_id],
|
||||
[:imports, :account_id],
|
||||
[:imports, :id],
|
||||
[:media_attachments, :account_id],
|
||||
[:media_attachments, :id],
|
||||
[:mentions, :account_id],
|
||||
[:mentions, :id],
|
||||
[:mutes, :account_id],
|
||||
[:mutes, :id],
|
||||
[:mutes, :target_account_id],
|
||||
[:notifications, :account_id],
|
||||
[:notifications, :from_account_id],
|
||||
[:notifications, :id],
|
||||
[:oauth_access_grants, :application_id],
|
||||
[:oauth_access_grants, :id],
|
||||
[:oauth_access_grants, :resource_owner_id],
|
||||
[:oauth_access_tokens, :application_id],
|
||||
[:oauth_access_tokens, :id],
|
||||
[:oauth_access_tokens, :resource_owner_id],
|
||||
[:oauth_applications, :id],
|
||||
[:oauth_applications, :owner_id],
|
||||
[:reports, :account_id],
|
||||
[:reports, :action_taken_by_account_id],
|
||||
[:reports, :id],
|
||||
[:reports, :target_account_id],
|
||||
[:session_activations, :access_token_id],
|
||||
[:session_activations, :user_id],
|
||||
[:session_activations, :web_push_subscription_id],
|
||||
[:settings, :id],
|
||||
[:settings, :thing_id],
|
||||
[:statuses, :account_id],
|
||||
[:statuses, :application_id],
|
||||
[:statuses, :in_reply_to_account_id],
|
||||
[:stream_entries, :account_id],
|
||||
[:stream_entries, :id],
|
||||
[:subscriptions, :account_id],
|
||||
[:subscriptions, :id],
|
||||
[:tags, :id],
|
||||
[:users, :account_id],
|
||||
[:users, :id],
|
||||
[:web_settings, :id],
|
||||
[:web_settings, :user_id],
|
||||
]
|
||||
INCLUDED_COLUMNS << [:deprecated_preview_cards, :id] if table_exists?(:deprecated_preview_cards)
|
||||
|
||||
def migrate_columns(to_type)
|
||||
included_columns = [
|
||||
[:account_domain_blocks, :account_id],
|
||||
[:account_domain_blocks, :id],
|
||||
[:accounts, :id],
|
||||
[:blocks, :account_id],
|
||||
[:blocks, :id],
|
||||
[:blocks, :target_account_id],
|
||||
[:conversation_mutes, :account_id],
|
||||
[:conversation_mutes, :id],
|
||||
[:domain_blocks, :id],
|
||||
[:favourites, :account_id],
|
||||
[:favourites, :id],
|
||||
[:favourites, :status_id],
|
||||
[:follow_requests, :account_id],
|
||||
[:follow_requests, :id],
|
||||
[:follow_requests, :target_account_id],
|
||||
[:follows, :account_id],
|
||||
[:follows, :id],
|
||||
[:follows, :target_account_id],
|
||||
[:imports, :account_id],
|
||||
[:imports, :id],
|
||||
[:media_attachments, :account_id],
|
||||
[:media_attachments, :id],
|
||||
[:mentions, :account_id],
|
||||
[:mentions, :id],
|
||||
[:mutes, :account_id],
|
||||
[:mutes, :id],
|
||||
[:mutes, :target_account_id],
|
||||
[:notifications, :account_id],
|
||||
[:notifications, :from_account_id],
|
||||
[:notifications, :id],
|
||||
[:oauth_access_grants, :application_id],
|
||||
[:oauth_access_grants, :id],
|
||||
[:oauth_access_grants, :resource_owner_id],
|
||||
[:oauth_access_tokens, :application_id],
|
||||
[:oauth_access_tokens, :id],
|
||||
[:oauth_access_tokens, :resource_owner_id],
|
||||
[:oauth_applications, :id],
|
||||
[:oauth_applications, :owner_id],
|
||||
[:reports, :account_id],
|
||||
[:reports, :action_taken_by_account_id],
|
||||
[:reports, :id],
|
||||
[:reports, :target_account_id],
|
||||
[:session_activations, :access_token_id],
|
||||
[:session_activations, :user_id],
|
||||
[:session_activations, :web_push_subscription_id],
|
||||
[:settings, :id],
|
||||
[:settings, :thing_id],
|
||||
[:statuses, :account_id],
|
||||
[:statuses, :application_id],
|
||||
[:statuses, :in_reply_to_account_id],
|
||||
[:stream_entries, :account_id],
|
||||
[:stream_entries, :id],
|
||||
[:subscriptions, :account_id],
|
||||
[:subscriptions, :id],
|
||||
[:tags, :id],
|
||||
[:users, :account_id],
|
||||
[:users, :id],
|
||||
[:web_settings, :id],
|
||||
[:web_settings, :user_id],
|
||||
]
|
||||
included_columns << [:deprecated_preview_cards, :id] if table_exists?(:deprecated_preview_cards)
|
||||
|
||||
# Print out a warning that this will probably take a while.
|
||||
say ''
|
||||
say 'WARNING: This migration may take a *long* time for large instances'
|
||||
@ -86,7 +86,7 @@ class IdsToBigints < ActiveRecord::Migration[5.1]
|
||||
sleep 1
|
||||
end
|
||||
|
||||
tables = INCLUDED_COLUMNS.map(&:first).uniq
|
||||
tables = included_columns.map(&:first).uniq
|
||||
table_sizes = {}
|
||||
|
||||
# Sort tables by their size
|
||||
@ -94,7 +94,7 @@ class IdsToBigints < ActiveRecord::Migration[5.1]
|
||||
table_sizes[table] = estimate_rows_in_table(table)
|
||||
end
|
||||
|
||||
ordered_columns = INCLUDED_COLUMNS.sort_by do |col_parts|
|
||||
ordered_columns = included_columns.sort_by do |col_parts|
|
||||
[-table_sizes[col_parts.first], col_parts.last]
|
||||
end
|
||||
|
||||
|
@ -12,6 +12,11 @@ class FixAccountsUniqueIndex < ActiveRecord::Migration[5.2]
|
||||
end
|
||||
end
|
||||
|
||||
class StreamEntry < ApplicationRecord
|
||||
# Dummy class, to make migration possible across version changes
|
||||
belongs_to :account, inverse_of: :stream_entries
|
||||
end
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
|
5
db/migrate/20190403141604_add_comment_to_invites.rb
Normal file
5
db/migrate/20190403141604_add_comment_to_invites.rb
Normal file
@ -0,0 +1,5 @@
|
||||
class AddCommentToInvites < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_column :invites, :comment, :text
|
||||
end
|
||||
end
|
@ -0,0 +1,9 @@
|
||||
class CreateCustomEmojiCategories < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :custom_emoji_categories do |t|
|
||||
t.string :name, index: { unique: true }
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,5 @@
|
||||
class AddCategoryIdToCustomEmojis < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_column :custom_emojis, :category_id, :bigint
|
||||
end
|
||||
end
|
5
db/migrate/20190701022101_add_trust_level_to_accounts.rb
Normal file
5
db/migrate/20190701022101_add_trust_level_to_accounts.rb
Normal file
@ -0,0 +1,5 @@
|
||||
class AddTrustLevelToAccounts < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_column :accounts, :trust_level, :integer
|
||||
end
|
||||
end
|
9
db/migrate/20190705002136_create_domain_allows.rb
Normal file
9
db/migrate/20190705002136_create_domain_allows.rb
Normal file
@ -0,0 +1,9 @@
|
||||
class CreateDomainAllows < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :domain_allows do |t|
|
||||
t.string :domain, default: '', null: false, index: { unique: true }
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
9
db/migrate/20190715164535_add_instance_actor.rb
Normal file
9
db/migrate/20190715164535_add_instance_actor.rb
Normal file
@ -0,0 +1,9 @@
|
||||
class AddInstanceActor < ActiveRecord::Migration[5.2]
|
||||
def up
|
||||
Account.create!(id: -99, actor_type: 'Application', locked: true, username: Rails.configuration.x.local_domain)
|
||||
end
|
||||
|
||||
def down
|
||||
Account.find_by(id: -99, actor_type: 'Application').destroy!
|
||||
end
|
||||
end
|
@ -0,0 +1,28 @@
|
||||
class AddCaseInsensitiveIndexToTags < ActiveRecord::Migration[5.2]
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
Tag.connection.select_all('SELECT string_agg(id::text, \',\') AS ids FROM tags GROUP BY lower(name) HAVING count(*) > 1').to_hash.each do |row|
|
||||
canonical_tag_id = row['ids'].split(',').first
|
||||
redundant_tag_ids = row['ids'].split(',')[1..-1]
|
||||
|
||||
safety_assured do
|
||||
execute "UPDATE accounts_tags AS t0 SET tag_id = #{canonical_tag_id} WHERE tag_id IN (#{redundant_tag_ids.join(', ')}) AND NOT EXISTS (SELECT t1.tag_id FROM accounts_tags AS t1 WHERE t1.tag_id = #{canonical_tag_id} AND t1.account_id = t0.account_id)"
|
||||
execute "UPDATE statuses_tags AS t0 SET tag_id = #{canonical_tag_id} WHERE tag_id IN (#{redundant_tag_ids.join(', ')}) AND NOT EXISTS (SELECT t1.tag_id FROM statuses_tags AS t1 WHERE t1.tag_id = #{canonical_tag_id} AND t1.status_id = t0.status_id)"
|
||||
execute "UPDATE featured_tags AS t0 SET tag_id = #{canonical_tag_id} WHERE tag_id IN (#{redundant_tag_ids.join(', ')}) AND NOT EXISTS (SELECT t1.tag_id FROM featured_tags AS t1 WHERE t1.tag_id = #{canonical_tag_id} AND t1.account_id = t0.account_id)"
|
||||
end
|
||||
|
||||
Tag.where(id: redundant_tag_ids).in_batches.delete_all
|
||||
end
|
||||
|
||||
safety_assured { execute 'CREATE UNIQUE INDEX CONCURRENTLY index_tags_on_name_lower ON tags (lower(name))' }
|
||||
remove_index :tags, name: 'index_tags_on_name'
|
||||
remove_index :tags, name: 'hashtag_search_index'
|
||||
end
|
||||
|
||||
def down
|
||||
add_index :tags, :name, unique: true, algorithm: :concurrently
|
||||
safety_assured { execute 'CREATE INDEX CONCURRENTLY hashtag_search_index ON tags (name text_pattern_ops)' }
|
||||
remove_index :tags, name: 'index_tags_on_name_lower'
|
||||
end
|
||||
end
|
5
db/migrate/20190729185330_add_score_to_tags.rb
Normal file
5
db/migrate/20190729185330_add_score_to_tags.rb
Normal file
@ -0,0 +1,5 @@
|
||||
class AddScoreToTags < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_column :tags, :score, :int
|
||||
end
|
||||
end
|
9
db/migrate/20190805123746_add_capabilities_to_tags.rb
Normal file
9
db/migrate/20190805123746_add_capabilities_to_tags.rb
Normal file
@ -0,0 +1,9 @@
|
||||
class AddCapabilitiesToTags < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_column :tags, :usable, :boolean
|
||||
add_column :tags, :trendable, :boolean
|
||||
add_column :tags, :listable, :boolean
|
||||
add_column :tags, :reviewed_at, :datetime
|
||||
add_column :tags, :requested_review_at, :datetime
|
||||
end
|
||||
end
|
@ -0,0 +1,7 @@
|
||||
class AddCommentsToDomainBlocks < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_column :domain_blocks, :private_comment, :text
|
||||
add_column :domain_blocks, :public_comment, :text
|
||||
end
|
||||
end
|
||||
|
6
db/migrate/20190815225426_add_last_status_at_to_tags.rb
Normal file
6
db/migrate/20190815225426_add_last_status_at_to_tags.rb
Normal file
@ -0,0 +1,6 @@
|
||||
class AddLastStatusAtToTags < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_column :tags, :last_status_at, :datetime
|
||||
add_column :tags, :last_trend_at, :datetime
|
||||
end
|
||||
end
|
5
db/migrate/20190819134503_add_deleted_at_to_statuses.rb
Normal file
5
db/migrate/20190819134503_add_deleted_at_to_statuses.rb
Normal file
@ -0,0 +1,5 @@
|
||||
class AddDeletedAtToStatuses < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_column :statuses, :deleted_at, :datetime
|
||||
end
|
||||
end
|
13
db/migrate/20190820003045_update_statuses_index.rb
Normal file
13
db/migrate/20190820003045_update_statuses_index.rb
Normal file
@ -0,0 +1,13 @@
|
||||
class UpdateStatusesIndex < ActiveRecord::Migration[5.2]
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
safety_assured { add_index :statuses, [:account_id, :id, :visibility, :updated_at], where: 'deleted_at IS NULL', order: { id: :desc }, algorithm: :concurrently, name: :index_statuses_20190820 }
|
||||
remove_index :statuses, name: :index_statuses_20180106
|
||||
end
|
||||
|
||||
def down
|
||||
safety_assured { add_index :statuses, [:account_id, :id, :visibility, :updated_at], order: { id: :desc }, algorithm: :concurrently, name: :index_statuses_20180106 }
|
||||
remove_index :statuses, name: :index_statuses_20190820
|
||||
end
|
||||
end
|
11
db/migrate/20190823221802_add_local_index_to_statuses.rb
Normal file
11
db/migrate/20190823221802_add_local_index_to_statuses.rb
Normal file
@ -0,0 +1,11 @@
|
||||
class AddLocalIndexToStatuses < ActiveRecord::Migration[5.2]
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
add_index :statuses, [:id, :account_id], name: :index_statuses_local_20190824, algorithm: :concurrently, order: { id: :desc }, where: '(local OR (uri IS NULL)) AND deleted_at IS NULL AND visibility = 0 AND reblog_of_id IS NULL AND ((NOT reply) OR (in_reply_to_account_id = account_id))'
|
||||
end
|
||||
|
||||
def down
|
||||
remove_index :statuses, name: :index_statuses_local_20190824
|
||||
end
|
||||
end
|
6
db/migrate/20190901035623_add_max_score_to_tags.rb
Normal file
6
db/migrate/20190901035623_add_max_score_to_tags.rb
Normal file
@ -0,0 +1,6 @@
|
||||
class AddMaxScoreToTags < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_column :tags, :max_score, :float
|
||||
add_column :tags, :max_score_at, :datetime
|
||||
end
|
||||
end
|
14
db/migrate/20190904222339_create_markers.rb
Normal file
14
db/migrate/20190904222339_create_markers.rb
Normal file
@ -0,0 +1,14 @@
|
||||
class CreateMarkers < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :markers do |t|
|
||||
t.references :user, foreign_key: { on_delete: :cascade, index: false }
|
||||
t.string :timeline, default: '', null: false
|
||||
t.bigint :last_read_id, default: 0, null: false
|
||||
t.integer :lock_version, default: 0, null: false
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
add_index :markers, [:user_id, :timeline], unique: true
|
||||
end
|
||||
end
|
12
db/migrate/20190914202517_create_account_migrations.rb
Normal file
12
db/migrate/20190914202517_create_account_migrations.rb
Normal file
@ -0,0 +1,12 @@
|
||||
class CreateAccountMigrations < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :account_migrations do |t|
|
||||
t.belongs_to :account, foreign_key: { on_delete: :cascade }
|
||||
t.string :acct, null: false, default: ''
|
||||
t.bigint :followers_count, null: false, default: 0
|
||||
t.belongs_to :target_account, foreign_key: { to_table: :accounts, on_delete: :nullify }
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
11
db/migrate/20190915194355_create_account_aliases.rb
Normal file
11
db/migrate/20190915194355_create_account_aliases.rb
Normal file
@ -0,0 +1,11 @@
|
||||
class CreateAccountAliases < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :account_aliases do |t|
|
||||
t.belongs_to :account, foreign_key: { on_delete: :cascade }
|
||||
t.string :acct, null: false, default: ''
|
||||
t.string :uri, null: false, default: ''
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
9
db/migrate/20190917213523_add_remember_token_index.rb
Normal file
9
db/migrate/20190917213523_add_remember_token_index.rb
Normal file
@ -0,0 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class AddRememberTokenIndex < ActiveRecord::Migration[5.2]
|
||||
disable_ddl_transaction!
|
||||
|
||||
def change
|
||||
add_index :users, :remember_token, algorithm: :concurrently, unique: true
|
||||
end
|
||||
end
|
5
db/migrate/20190927232842_add_voters_count_to_polls.rb
Normal file
5
db/migrate/20190927232842_add_voters_count_to_polls.rb
Normal file
@ -0,0 +1,5 @@
|
||||
class AddVotersCountToPolls < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_column :polls, :voters_count, :bigint
|
||||
end
|
||||
end
|
@ -0,0 +1,15 @@
|
||||
require Rails.root.join('lib', 'mastodon', 'migration_helpers')
|
||||
|
||||
class AddLockVersionToAccountStats < ActiveRecord::Migration[5.2]
|
||||
include Mastodon::MigrationHelpers
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
safety_assured { add_column_with_default :account_stats, :lock_version, :integer, allow_null: false, default: 0 }
|
||||
end
|
||||
|
||||
def down
|
||||
remove_column :account_stats, :lock_version
|
||||
end
|
||||
end
|
13
db/post_migrate/20190706233204_drop_stream_entries.rb
Normal file
13
db/post_migrate/20190706233204_drop_stream_entries.rb
Normal file
@ -0,0 +1,13 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class DropStreamEntries < ActiveRecord::Migration[5.2]
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
drop_table :stream_entries
|
||||
end
|
||||
|
||||
def down
|
||||
raise ActiveRecord::IrreversibleMigration
|
||||
end
|
||||
end
|
11
db/post_migrate/20190715031050_drop_subscriptions.rb
Normal file
11
db/post_migrate/20190715031050_drop_subscriptions.rb
Normal file
@ -0,0 +1,11 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class DropSubscriptions < ActiveRecord::Migration[5.2]
|
||||
def up
|
||||
drop_table :subscriptions
|
||||
end
|
||||
|
||||
def down
|
||||
raise ActiveRecord::IrreversibleMigration
|
||||
end
|
||||
end
|
12
db/post_migrate/20190901040524_remove_score_from_tags.rb
Normal file
12
db/post_migrate/20190901040524_remove_score_from_tags.rb
Normal file
@ -0,0 +1,12 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class RemoveScoreFromTags < ActiveRecord::Migration[5.2]
|
||||
disable_ddl_transaction!
|
||||
|
||||
def change
|
||||
safety_assured do
|
||||
remove_column :tags, :score, :int
|
||||
remove_column :tags, :last_trend_at, :datetime
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,18 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class RemoveInvalidWebPushSubscription < ActiveRecord::Migration[5.2]
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
invalid_web_push_subscriptions = Web::PushSubscription.where(endpoint: '')
|
||||
.or(Web::PushSubscription.where(key_p256dh: ''))
|
||||
.or(Web::PushSubscription.where(key_auth: ''))
|
||||
.preload(:session_activation)
|
||||
invalid_web_push_subscriptions.find_each do |web_push_subscription|
|
||||
web_push_subscription.session_activation&.update!(web_push_subscription_id: nil)
|
||||
web_push_subscription.destroy!
|
||||
end
|
||||
end
|
||||
|
||||
def down; end
|
||||
end
|
100
db/schema.rb
100
db/schema.rb
@ -10,11 +10,20 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 2019_07_26_034905) do
|
||||
ActiveRecord::Schema.define(version: 2019_10_01_213028) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
||||
create_table "account_aliases", force: :cascade do |t|
|
||||
t.bigint "account_id"
|
||||
t.string "acct", default: "", null: false
|
||||
t.string "uri", default: "", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["account_id"], name: "index_account_aliases_on_account_id"
|
||||
end
|
||||
|
||||
create_table "account_conversations", force: :cascade do |t|
|
||||
t.bigint "account_id"
|
||||
t.bigint "conversation_id"
|
||||
@ -49,6 +58,17 @@ ActiveRecord::Schema.define(version: 2019_07_26_034905) do
|
||||
t.index ["account_id"], name: "index_account_identity_proofs_on_account_id"
|
||||
end
|
||||
|
||||
create_table "account_migrations", force: :cascade do |t|
|
||||
t.bigint "account_id"
|
||||
t.string "acct", default: "", null: false
|
||||
t.bigint "followers_count", default: 0, null: false
|
||||
t.bigint "target_account_id"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["account_id"], name: "index_account_migrations_on_account_id"
|
||||
t.index ["target_account_id"], name: "index_account_migrations_on_target_account_id"
|
||||
end
|
||||
|
||||
create_table "account_moderation_notes", force: :cascade do |t|
|
||||
t.text "content", null: false
|
||||
t.bigint "account_id", null: false
|
||||
@ -77,6 +97,7 @@ ActiveRecord::Schema.define(version: 2019_07_26_034905) do
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.datetime "last_status_at"
|
||||
t.integer "lock_version", default: 0, null: false
|
||||
t.index ["account_id"], name: "index_account_stats_on_account_id", unique: true
|
||||
end
|
||||
|
||||
@ -148,6 +169,7 @@ ActiveRecord::Schema.define(version: 2019_07_26_034905) do
|
||||
t.string "also_known_as", array: true
|
||||
t.datetime "silenced_at"
|
||||
t.datetime "suspended_at"
|
||||
t.integer "trust_level"
|
||||
t.index "(((setweight(to_tsvector('simple'::regconfig, (display_name)::text), 'A'::\"char\") || setweight(to_tsvector('simple'::regconfig, (username)::text), 'B'::\"char\")) || setweight(to_tsvector('simple'::regconfig, (COALESCE(domain, ''::character varying))::text), 'C'::\"char\")))", name: "search_index", using: :gin
|
||||
t.index "lower((username)::text), lower((domain)::text)", name: "index_accounts_on_username_and_domain_lower", unique: true
|
||||
t.index ["moved_to_account_id"], name: "index_accounts_on_moved_to_account_id"
|
||||
@ -208,6 +230,13 @@ ActiveRecord::Schema.define(version: 2019_07_26_034905) do
|
||||
t.index ["uri"], name: "index_conversations_on_uri", unique: true
|
||||
end
|
||||
|
||||
create_table "custom_emoji_categories", force: :cascade do |t|
|
||||
t.string "name"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["name"], name: "index_custom_emoji_categories_on_name", unique: true
|
||||
end
|
||||
|
||||
create_table "custom_emojis", force: :cascade do |t|
|
||||
t.string "shortcode", default: "", null: false
|
||||
t.string "domain"
|
||||
@ -221,6 +250,7 @@ ActiveRecord::Schema.define(version: 2019_07_26_034905) do
|
||||
t.string "uri"
|
||||
t.string "image_remote_url"
|
||||
t.boolean "visible_in_picker", default: true, null: false
|
||||
t.bigint "category_id"
|
||||
t.index ["shortcode", "domain"], name: "index_custom_emojis_on_shortcode_and_domain", unique: true
|
||||
end
|
||||
|
||||
@ -236,6 +266,13 @@ ActiveRecord::Schema.define(version: 2019_07_26_034905) do
|
||||
t.index ["account_id"], name: "index_custom_filters_on_account_id"
|
||||
end
|
||||
|
||||
create_table "domain_allows", force: :cascade do |t|
|
||||
t.string "domain", default: "", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["domain"], name: "index_domain_allows_on_domain", unique: true
|
||||
end
|
||||
|
||||
create_table "domain_blocks", force: :cascade do |t|
|
||||
t.string "domain", default: "", null: false
|
||||
t.datetime "created_at", null: false
|
||||
@ -243,6 +280,8 @@ ActiveRecord::Schema.define(version: 2019_07_26_034905) do
|
||||
t.integer "severity", default: 0
|
||||
t.boolean "reject_media", default: false, null: false
|
||||
t.boolean "reject_reports", default: false, null: false
|
||||
t.text "private_comment"
|
||||
t.text "public_comment"
|
||||
t.index ["domain"], name: "index_domain_blocks_on_domain", unique: true
|
||||
end
|
||||
|
||||
@ -326,6 +365,7 @@ ActiveRecord::Schema.define(version: 2019_07_26_034905) do
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.boolean "autofollow", default: false, null: false
|
||||
t.text "comment"
|
||||
t.index ["code"], name: "index_invites_on_code", unique: true
|
||||
t.index ["user_id"], name: "index_invites_on_user_id"
|
||||
end
|
||||
@ -348,6 +388,17 @@ ActiveRecord::Schema.define(version: 2019_07_26_034905) do
|
||||
t.index ["account_id"], name: "index_lists_on_account_id"
|
||||
end
|
||||
|
||||
create_table "markers", force: :cascade do |t|
|
||||
t.bigint "user_id"
|
||||
t.string "timeline", default: "", null: false
|
||||
t.bigint "last_read_id", default: 0, null: false
|
||||
t.integer "lock_version", default: 0, null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["user_id", "timeline"], name: "index_markers_on_user_id_and_timeline", unique: true
|
||||
t.index ["user_id"], name: "index_markers_on_user_id"
|
||||
end
|
||||
|
||||
create_table "media_attachments", force: :cascade do |t|
|
||||
t.bigint "status_id"
|
||||
t.string "file_file_name"
|
||||
@ -480,6 +531,7 @@ ActiveRecord::Schema.define(version: 2019_07_26_034905) do
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.integer "lock_version", default: 0, null: false
|
||||
t.bigint "voters_count"
|
||||
t.index ["account_id"], name: "index_polls_on_account_id"
|
||||
t.index ["status_id"], name: "index_polls_on_status_id"
|
||||
end
|
||||
@ -628,7 +680,9 @@ ActiveRecord::Schema.define(version: 2019_07_26_034905) do
|
||||
t.bigint "poll_id"
|
||||
t.boolean "local_only"
|
||||
t.string "activity_pub_type"
|
||||
t.index ["account_id", "id", "visibility", "updated_at"], name: "index_statuses_20180106", order: { id: :desc }
|
||||
t.datetime "deleted_at"
|
||||
t.index ["account_id", "id", "visibility", "updated_at"], name: "index_statuses_20190820", order: { id: :desc }, where: "(deleted_at IS NULL)"
|
||||
t.index ["id", "account_id"], name: "index_statuses_local_20190824", order: { id: :desc }, where: "((local OR (uri IS NULL)) AND (deleted_at IS NULL) AND (visibility = 0) AND (reblog_of_id IS NULL) AND ((NOT reply) OR (in_reply_to_account_id = account_id)))"
|
||||
t.index ["in_reply_to_account_id"], name: "index_statuses_on_in_reply_to_account_id"
|
||||
t.index ["in_reply_to_id"], name: "index_statuses_on_in_reply_to_id"
|
||||
t.index ["reblog_of_id", "account_id"], name: "index_statuses_on_reblog_of_id_and_account_id"
|
||||
@ -642,36 +696,19 @@ ActiveRecord::Schema.define(version: 2019_07_26_034905) do
|
||||
t.index ["tag_id", "status_id"], name: "index_statuses_tags_on_tag_id_and_status_id", unique: true
|
||||
end
|
||||
|
||||
create_table "stream_entries", force: :cascade do |t|
|
||||
t.bigint "activity_id"
|
||||
t.string "activity_type"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.boolean "hidden", default: false, null: false
|
||||
t.bigint "account_id"
|
||||
t.index ["account_id", "activity_type", "id"], name: "index_stream_entries_on_account_id_and_activity_type_and_id"
|
||||
t.index ["activity_id", "activity_type"], name: "index_stream_entries_on_activity_id_and_activity_type"
|
||||
end
|
||||
|
||||
create_table "subscriptions", force: :cascade do |t|
|
||||
t.string "callback_url", default: "", null: false
|
||||
t.string "secret"
|
||||
t.datetime "expires_at"
|
||||
t.boolean "confirmed", default: false, null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.datetime "last_successful_delivery_at"
|
||||
t.string "domain"
|
||||
t.bigint "account_id", null: false
|
||||
t.index ["account_id", "callback_url"], name: "index_subscriptions_on_account_id_and_callback_url", unique: true
|
||||
end
|
||||
|
||||
create_table "tags", force: :cascade do |t|
|
||||
t.string "name", default: "", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index "lower((name)::text) text_pattern_ops", name: "hashtag_search_index"
|
||||
t.index ["name"], name: "index_tags_on_name", unique: true
|
||||
t.boolean "usable"
|
||||
t.boolean "trendable"
|
||||
t.boolean "listable"
|
||||
t.datetime "reviewed_at"
|
||||
t.datetime "requested_review_at"
|
||||
t.datetime "last_status_at"
|
||||
t.float "max_score"
|
||||
t.datetime "max_score_at"
|
||||
t.index "lower((name)::text)", name: "index_tags_on_name_lower", unique: true
|
||||
end
|
||||
|
||||
create_table "tombstones", force: :cascade do |t|
|
||||
@ -731,6 +768,7 @@ ActiveRecord::Schema.define(version: 2019_07_26_034905) do
|
||||
t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true
|
||||
t.index ["created_by_application_id"], name: "index_users_on_created_by_application_id"
|
||||
t.index ["email"], name: "index_users_on_email", unique: true
|
||||
t.index ["remember_token"], name: "index_users_on_remember_token", unique: true
|
||||
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
|
||||
end
|
||||
|
||||
@ -755,10 +793,13 @@ ActiveRecord::Schema.define(version: 2019_07_26_034905) do
|
||||
t.index ["user_id"], name: "index_web_settings_on_user_id", unique: true
|
||||
end
|
||||
|
||||
add_foreign_key "account_aliases", "accounts", on_delete: :cascade
|
||||
add_foreign_key "account_conversations", "accounts", on_delete: :cascade
|
||||
add_foreign_key "account_conversations", "conversations", on_delete: :cascade
|
||||
add_foreign_key "account_domain_blocks", "accounts", name: "fk_206c6029bd", on_delete: :cascade
|
||||
add_foreign_key "account_identity_proofs", "accounts", on_delete: :cascade
|
||||
add_foreign_key "account_migrations", "accounts", column: "target_account_id", on_delete: :nullify
|
||||
add_foreign_key "account_migrations", "accounts", on_delete: :cascade
|
||||
add_foreign_key "account_moderation_notes", "accounts"
|
||||
add_foreign_key "account_moderation_notes", "accounts", column: "target_account_id"
|
||||
add_foreign_key "account_pins", "accounts", column: "target_account_id", on_delete: :cascade
|
||||
@ -790,6 +831,7 @@ ActiveRecord::Schema.define(version: 2019_07_26_034905) do
|
||||
add_foreign_key "list_accounts", "follows", on_delete: :cascade
|
||||
add_foreign_key "list_accounts", "lists", on_delete: :cascade
|
||||
add_foreign_key "lists", "accounts", on_delete: :cascade
|
||||
add_foreign_key "markers", "users", on_delete: :cascade
|
||||
add_foreign_key "media_attachments", "accounts", name: "fk_96dd81e81b", on_delete: :nullify
|
||||
add_foreign_key "media_attachments", "scheduled_statuses", on_delete: :nullify
|
||||
add_foreign_key "media_attachments", "statuses", on_delete: :nullify
|
||||
@ -826,8 +868,6 @@ ActiveRecord::Schema.define(version: 2019_07_26_034905) do
|
||||
add_foreign_key "statuses", "statuses", column: "reblog_of_id", on_delete: :cascade
|
||||
add_foreign_key "statuses_tags", "statuses", on_delete: :cascade
|
||||
add_foreign_key "statuses_tags", "tags", name: "fk_3081861e21", on_delete: :cascade
|
||||
add_foreign_key "stream_entries", "accounts", name: "fk_5659b17554", on_delete: :cascade
|
||||
add_foreign_key "subscriptions", "accounts", name: "fk_9847d1cbb5", on_delete: :cascade
|
||||
add_foreign_key "tombstones", "accounts", on_delete: :cascade
|
||||
add_foreign_key "user_invite_requests", "users", on_delete: :cascade
|
||||
add_foreign_key "users", "accounts", name: "fk_50500f500d", on_delete: :cascade
|
||||
|
@ -1,7 +1,10 @@
|
||||
Doorkeeper::Application.create!(name: 'Web', superapp: true, redirect_uri: Doorkeeper.configuration.native_redirect_uri, scopes: 'read write follow')
|
||||
Doorkeeper::Application.create!(name: 'Web', superapp: true, redirect_uri: Doorkeeper.configuration.native_redirect_uri, scopes: 'read write follow push')
|
||||
|
||||
domain = ENV['LOCAL_DOMAIN'] || Rails.configuration.x.local_domain
|
||||
account = Account.find_or_initialize_by(id: -99, actor_type: 'Application', locked: true, username: domain)
|
||||
account.save!
|
||||
|
||||
if Rails.env.development?
|
||||
domain = ENV['LOCAL_DOMAIN'] || Rails.configuration.x.local_domain
|
||||
admin = Account.where(username: 'admin').first_or_initialize(username: 'admin')
|
||||
admin.save(validate: false)
|
||||
User.where(email: "admin@#{domain}").first_or_initialize(email: "admin@#{domain}", password: 'mastodonadmin', password_confirmation: 'mastodonadmin', confirmed_at: Time.now.utc, admin: true, account: admin, agreement: true, approved: true).save!
|
||||
|
Reference in New Issue
Block a user