lib/desert/plugin_migrations/2.1/extensions/schema_statements.rb in cauta-desert-0.5.2 vs lib/desert/plugin_migrations/2.1/extensions/schema_statements.rb in cauta-desert-0.5.3
- old
+ new
@@ -1,15 +1,15 @@
ActiveRecord::ConnectionAdapters::SchemaStatements.module_eval do
def initialize_schema_migrations_table_with_plugins
initialize_schema_migrations_table_without_plugins
begin
- psm_table = ActiveRecord::Migrator.schema_migrations_table_name
- unless ActiveRecord::Base.connection.table_exists?(psm_table)
- execute "CREATE TABLE #{psm_table} (plugin_name #{type_to_sql(:string)}, version #{type_to_sql(:string)})"
+ smt = Desert::PluginMigrations::Migrator.schema_migrations_table_name
+ unless ActiveRecord::Base.connection.tables.include?(smt)
+ execute "CREATE TABLE #{smt} (plugin_name #{type_to_sql(:string)}, version #{type_to_sql(:string)})"
end
- plugins_and_versions = select_all("SELECT plugin_name, version from #{psm_table}")
+ plugins_and_versions = select_all("SELECT plugin_name, version from #{smt}")
plugins_and_versions.each do |plugin_data|
plugin_name, version = plugin_data["plugin_name"], plugin_data["version"]
plugin = Desert::Manager.find_plugin(plugin_name)
migration_versions = Dir["#{plugin.migration_path}/*.rb"].map do |path|
File.basename(path, ".rb")
@@ -31,6 +31,6 @@
rescue ActiveRecord::StatementInvalid
# Schema has been initialized
end
end
alias_method_chain :initialize_schema_migrations_table, :plugins
-end
+end
\ No newline at end of file