mirror of
https://github.com/whippyshou/mastodon
synced 2024-12-30 06:28:27 +09:00
4afda5444a
* fix: change Identity's id column to a bigint This appears to be the last model created using a 5.0 migration, where column types defaulted to `integer` rather than `bigint`. This migration changes the column type to match that of all of the other ID columns. * Change user_id column in identities to bigint and fix down-migration
23 lines
640 B
Ruby
23 lines
640 B
Ruby
# frozen_string_literal: true
|
|
# == Schema Information
|
|
#
|
|
# Table name: identities
|
|
#
|
|
# provider :string default(""), not null
|
|
# uid :string default(""), not null
|
|
# created_at :datetime not null
|
|
# updated_at :datetime not null
|
|
# id :bigint(8) not null, primary key
|
|
# user_id :bigint(8)
|
|
#
|
|
|
|
class Identity < ApplicationRecord
|
|
belongs_to :user, dependent: :destroy
|
|
validates :uid, presence: true, uniqueness: { scope: :provider }
|
|
validates :provider, presence: true
|
|
|
|
def self.find_for_oauth(auth)
|
|
find_or_create_by(uid: auth.uid, provider: auth.provider)
|
|
end
|
|
end
|