Merge tag 'v3.2.0' into instance_only_statuses
This commit is contained in:
@ -1,13 +0,0 @@
|
||||
class CreateDevices < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
create_table :devices do |t|
|
||||
t.integer :account_id, null: false
|
||||
t.string :registration_id, null: false, default: ''
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
add_index :devices, :registration_id
|
||||
add_index :devices, :account_id
|
||||
end
|
||||
end
|
@ -1,5 +1,5 @@
|
||||
class RemoveDevices < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
drop_table :devices
|
||||
drop_table :devices if table_exists?(:devices)
|
||||
end
|
||||
end
|
||||
|
@ -0,0 +1,22 @@
|
||||
class RemoveDuplicatedIndexesPghero < ActiveRecord::Migration[5.2]
|
||||
def up
|
||||
remove_index :account_conversations, name: :index_account_conversations_on_account_id if index_exists?(:account_conversations, :account_id, name: :index_account_conversations_on_account_id)
|
||||
remove_index :account_identity_proofs, name: :index_account_identity_proofs_on_account_id if index_exists?(:account_identity_proofs, :account_id, name: :index_account_identity_proofs_on_account_id)
|
||||
remove_index :account_pins, name: :index_account_pins_on_account_id if index_exists?(:account_pins, :account_id, name: :index_account_pins_on_account_id)
|
||||
remove_index :announcement_mutes, name: :index_announcement_mutes_on_account_id if index_exists?(:announcement_mutes, :account_id, name: :index_announcement_mutes_on_account_id)
|
||||
remove_index :announcement_reactions, name: :index_announcement_reactions_on_account_id if index_exists?(:announcement_reactions, :account_id, name: :index_announcement_reactions_on_account_id)
|
||||
remove_index :bookmarks, name: :index_bookmarks_on_account_id if index_exists?(:bookmarks, :account_id, name: :index_bookmarks_on_account_id)
|
||||
remove_index :markers, name: :index_markers_on_user_id if index_exists?(:markers, :user_id, name: :index_markers_on_user_id)
|
||||
end
|
||||
|
||||
def down
|
||||
add_index :account_conversations, :account_id, name: :index_account_conversations_on_account_id unless index_exists?(:account_conversations, :account_id, name: :index_account_conversations_on_account_id)
|
||||
add_index :account_identity_proofs, :account_id, name: :index_account_identity_proofs_on_account_id unless index_exists?(:account_identity_proofs, :account_id, name: :index_account_identity_proofs_on_account_id)
|
||||
add_index :account_pins, :account_id, name: :index_account_pins_on_account_id unless index_exists?(:account_pins, :account_id, name: :index_account_pins_on_account_id)
|
||||
add_index :announcement_mutes, :account_id, name: :index_announcement_mutes_on_account_id unless index_exists?(:announcement_mutes, :account_id, name: :index_announcement_mutes_on_account_id)
|
||||
add_index :announcement_reactions, :account_id, name: :index_announcement_reactions_on_account_id unless index_exists?(:announcement_reactions, :account_id, name: :index_announcement_reactions_on_account_id)
|
||||
add_index :bookmarks, :account_id, name: :index_bookmarks_on_account_id unless index_exists?(:bookmarks, :account_id, name: :index_bookmarks_on_account_id)
|
||||
add_index :markers, :user_id, name: :index_markers_on_user_id unless index_exists?(:markers, :user_id, name: :index_markers_on_user_id)
|
||||
end
|
||||
end
|
||||
|
14
db/migrate/20200516180352_create_devices.rb
Normal file
14
db/migrate/20200516180352_create_devices.rb
Normal file
@ -0,0 +1,14 @@
|
||||
class CreateDevices < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :devices do |t|
|
||||
t.references :access_token, foreign_key: { to_table: :oauth_access_tokens, on_delete: :cascade, index: :unique }
|
||||
t.references :account, foreign_key: { on_delete: :cascade }
|
||||
t.string :device_id, default: '', null: false
|
||||
t.string :name, default: '', null: false
|
||||
t.text :fingerprint_key, default: '', null: false
|
||||
t.text :identity_key, default: '', null: false
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
12
db/migrate/20200516183822_create_one_time_keys.rb
Normal file
12
db/migrate/20200516183822_create_one_time_keys.rb
Normal file
@ -0,0 +1,12 @@
|
||||
class CreateOneTimeKeys < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :one_time_keys do |t|
|
||||
t.references :device, foreign_key: { on_delete: :cascade }
|
||||
t.string :key_id, default: '', null: false, index: :unique
|
||||
t.text :key, default: '', null: false
|
||||
t.text :signature, default: '', null: false
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
15
db/migrate/20200518083523_create_encrypted_messages.rb
Normal file
15
db/migrate/20200518083523_create_encrypted_messages.rb
Normal file
@ -0,0 +1,15 @@
|
||||
class CreateEncryptedMessages < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :encrypted_messages do |t|
|
||||
t.references :device, foreign_key: { on_delete: :cascade }
|
||||
t.references :from_account, foreign_key: { to_table: :accounts, on_delete: :cascade }
|
||||
t.string :from_device_id, default: '', null: false
|
||||
t.integer :type, default: 0, null: false
|
||||
t.text :body, default: '', null: false
|
||||
t.text :digest, default: '', null: false
|
||||
t.text :message_franking, default: '', null: false
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,13 @@
|
||||
class EncryptedMessageIdsToTimestampIds < ActiveRecord::Migration[5.2]
|
||||
def up
|
||||
safety_assured do
|
||||
execute("ALTER TABLE encrypted_messages ALTER COLUMN id SET DEFAULT timestamp_id('encrypted_messages')")
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
execute("LOCK encrypted_messages")
|
||||
execute("SELECT setval('encrypted_messages_id_seq', (SELECT MAX(id) FROM encrypted_messages))")
|
||||
execute("ALTER TABLE encrypted_messages ALTER COLUMN id SET DEFAULT nextval('encrypted_messages_id_seq')")
|
||||
end
|
||||
end
|
5
db/migrate/20200529214050_add_devices_url_to_accounts.rb
Normal file
5
db/migrate/20200529214050_add_devices_url_to_accounts.rb
Normal file
@ -0,0 +1,5 @@
|
||||
class AddDevicesUrlToAccounts < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_column :accounts, :devices_url, :string
|
||||
end
|
||||
end
|
9
db/migrate/20200601222558_create_system_keys.rb
Normal file
9
db/migrate/20200601222558_create_system_keys.rb
Normal file
@ -0,0 +1,9 @@
|
||||
class CreateSystemKeys < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :system_keys do |t|
|
||||
t.binary :key
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,5 @@
|
||||
class AddBlurhashToPreviewCards < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_column :preview_cards, :blurhash, :string
|
||||
end
|
||||
end
|
6
db/migrate/20200608113046_add_sign_in_token_to_users.rb
Normal file
6
db/migrate/20200608113046_add_sign_in_token_to_users.rb
Normal file
@ -0,0 +1,6 @@
|
||||
class AddSignInTokenToUsers < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_column :users, :sign_in_token, :string
|
||||
add_column :users, :sign_in_token_sent_at, :datetime
|
||||
end
|
||||
end
|
@ -0,0 +1,15 @@
|
||||
class AddFixedLowercaseIndexToAccounts < ActiveRecord::Migration[5.2]
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
rename_index :accounts, 'index_accounts_on_username_and_domain_lower', 'old_index_accounts_on_username_and_domain_lower' unless index_name_exists?(:accounts, 'old_index_accounts_on_username_and_domain_lower')
|
||||
add_index :accounts, "lower (username), COALESCE(lower(domain), '')", name: 'index_accounts_on_username_and_domain_lower', unique: true, algorithm: :concurrently
|
||||
remove_index :accounts, name: 'old_index_accounts_on_username_and_domain_lower'
|
||||
end
|
||||
|
||||
def down
|
||||
add_index :accounts, 'lower (username), lower(domain)', name: 'old_index_accounts_on_username_and_domain_lower', unique: true, algorithm: :concurrently
|
||||
remove_index :accounts, name: 'index_accounts_on_username_and_domain_lower'
|
||||
rename_index :accounts, 'old_index_accounts_on_username_and_domain_lower', 'index_accounts_on_username_and_domain_lower'
|
||||
end
|
||||
end
|
@ -0,0 +1,17 @@
|
||||
class MediaAttachmentIdsToTimestampIds < ActiveRecord::Migration[5.1]
|
||||
def up
|
||||
# Set up the media_attachments.id column to use our timestamp-based IDs.
|
||||
safety_assured do
|
||||
execute("ALTER TABLE media_attachments ALTER COLUMN id SET DEFAULT timestamp_id('media_attachments')")
|
||||
end
|
||||
|
||||
# Make sure we have a sequence to use.
|
||||
Mastodon::Snowflake.ensure_id_sequences_exist
|
||||
end
|
||||
|
||||
def down
|
||||
execute("LOCK media_attachments")
|
||||
execute("SELECT setval('media_attachments_id_seq', (SELECT MAX(id) FROM media_attachments))")
|
||||
execute("ALTER TABLE media_attachments ALTER COLUMN id SET DEFAULT nextval('media_attachments_id_seq')")
|
||||
end
|
||||
end
|
@ -0,0 +1,11 @@
|
||||
class AddThumbnailColumnsToMediaAttachments < ActiveRecord::Migration[5.2]
|
||||
def up
|
||||
add_attachment :media_attachments, :thumbnail
|
||||
add_column :media_attachments, :thumbnail_remote_url, :string
|
||||
end
|
||||
|
||||
def down
|
||||
remove_attachment :media_attachments, :thumbnail
|
||||
remove_column :media_attachments, :thumbnail_remote_url
|
||||
end
|
||||
end
|
13
db/migrate/20200628133322_create_account_notes.rb
Normal file
13
db/migrate/20200628133322_create_account_notes.rb
Normal file
@ -0,0 +1,13 @@
|
||||
class CreateAccountNotes < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :account_notes do |t|
|
||||
t.references :account, foreign_key: { on_delete: :cascade }, index: false
|
||||
t.references :target_account, foreign_key: { to_table: :accounts, on_delete: :cascade }
|
||||
t.text :comment, null: false
|
||||
t.index [:account_id, :target_account_id], unique: true
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user