mirror of
https://github.com/Fishwaldo/huginn.git
synced 2025-03-16 03:41:41 +00:00
Skip validations in the oauth migration
Also enforced the presence of needed attributes of the services table on the database level
This commit is contained in:
parent
db968e6f4f
commit
b089919490
3 changed files with 5 additions and 6 deletions
|
@ -4,7 +4,6 @@ module Oauthable
|
|||
included do |base|
|
||||
attr_accessible :service_id
|
||||
validates_presence_of :service_id
|
||||
base.extend ClassMethods
|
||||
self.class_variable_set(:@@valid_oauth_providers, :all)
|
||||
end
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
class CreateServices < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :services do |t|
|
||||
t.integer :user_id
|
||||
t.string :provider
|
||||
t.string :name
|
||||
t.text :token
|
||||
t.integer :user_id, null: false
|
||||
t.string :provider, null: false
|
||||
t.string :name, null: false
|
||||
t.text :token, null: false
|
||||
t.text :secret
|
||||
t.text :refresh_token
|
||||
t.datetime :expires_at
|
||||
|
|
|
@ -24,7 +24,7 @@ class MigrateAgentsToServiceAuthentication < ActiveRecord::Migration
|
|||
secret: twitter_oauth_token_secret(agent)
|
||||
)
|
||||
agent.service_id = service.id
|
||||
agent.save!
|
||||
agent.save!(validate: false)
|
||||
end
|
||||
if agents.length > 0
|
||||
puts <<-EOF.strip_heredoc
|
||||
|
|
Loading…
Add table
Reference in a new issue