method

rename_table

rails latest stable - Class: ActiveRecord::ConnectionAdapters::FrontBaseAdapter

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (v1.2.6) is shown here.

rename_table(name, new_name)
public

No documentation available.

# File activerecord/lib/active_record/connection_adapters/frontbase_adapter.rb, line 769
      def rename_table(name, new_name)
        columns = columns(name)
        pkcol = columns.find {|c| c.fb_autogen}
        execute "ALTER TABLE NAME #{name} TO #{new_name}"
        if pkcol
          change_column_default(new_name,pkcol.name,"UNIQUE")
          begin_db_transaction
          mpk = select_value("SELECT MAX(#{pkcol.name}) FROM #{new_name}")
          mpk = 0 if mpk.nil?
          execute "SET UNIQUE=#{mpk} FOR #{new_name}"
          commit_db_transaction
        end
      end