1 namespace :open_id_authentication do
3 desc "Creates authentication tables for use with OpenIdAuthentication"
4 task :create => :environment do
5 generate_migration(["open_id_authentication_tables", "add_open_id_authentication_tables"])
8 desc "Upgrade authentication tables from ruby-openid 1.x.x to 2.x.x"
9 task :upgrade => :environment do
10 generate_migration(["upgrade_open_id_authentication_tables", "upgrade_open_id_authentication_tables"])
13 def generate_migration(args)
14 require 'rails_generator'
15 require 'rails_generator/scripts/generate'
17 if ActiveRecord::Base.connection.supports_migrations?
18 Rails::Generator::Scripts::Generate.new.run(args)
20 raise "Task unavailable to this database (no migration support)"
24 desc "Clear the authentication tables"
25 task :clear => :environment do
26 OpenIdAuthentication::DbStore.cleanup_nonces
27 OpenIdAuthentication::DbStore.cleanup_associations