Module: ActiveRecord::ConnectionAdapters::SchemaStatements
- Defined in:
- lib/active_warehouse/migrations.rb
Overview
:nodoc:
Instance Method Summary collapse
- #dump_schema_information_with_activewarehouse ⇒ Object
- #initialize_schema_information_with_activewarehouse ⇒ Object
Instance Method Details
#dump_schema_information_with_activewarehouse ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/active_warehouse/migrations.rb', line 42 def dump_schema_information_with_activewarehouse schema_information = [] dump = dump_schema_information_without_activewarehouse schema_information << dump if dump begin plugins = ActiveRecord::Base.connection.select_all("SELECT * FROM #{ActiveWarehouse::Migrator.schema_info_table_name}") plugins.each do |plugin| if (version = plugin['version'].to_i) > 0 schema_information << "INSERT INTO #{ActiveWarehouse::Migrator.schema_info_table_name} (version) VALUES (#{version})" end end rescue ActiveRecord::StatementInvalid # No Schema Info end schema_information.join("\n") end |
#initialize_schema_information_with_activewarehouse ⇒ Object
31 32 33 34 35 36 37 38 39 |
# File 'lib/active_warehouse/migrations.rb', line 31 def initialize_schema_information_with_activewarehouse initialize_schema_information_without_activewarehouse begin execute "CREATE TABLE #{ActiveWarehouse::Migrator.schema_info_table_name} (version #{type_to_sql(:integer)})" rescue ActiveRecord::StatementInvalid # Schema has been initialized end end |