Class: Migr8::DBMS::PostgreSQL

Inherits:
Base
  • Object
show all
Defined in:
lib/migr8.rb

Defined Under Namespace

Classes: Skeleton

Constant Summary collapse

SYMBOL =
'postgres'
PATTERN =
/\bpsql\b/

Instance Attribute Summary

Attributes inherited from Base

#command, #history_table, #sqltmpfile

Instance Method Summary collapse

Methods inherited from Base

#apply_migrations, #create_history_table, detect_by_command, #fetch_column_value_of, inherited, #initialize, #new_skeleton, #q, #unapply_migrations

Constructor Details

This class inherits a constructor from Migr8::DBMS::Base

Instance Method Details

#execute_sql(sql, cmdopt = nil) ⇒ Object



976
977
978
979
# File 'lib/migr8.rb', line 976

def execute_sql(sql, cmdopt=nil)
  preamble = "SET client_min_messages TO WARNING;\n"
  return super(preamble+sql, cmdopt)
end

#get_migrationsObject



1015
1016
1017
1018
# File 'lib/migr8.rb', line 1015

def get_migrations()
  migrations = _get_migrations("-qt", / \| /)
  return migrations
end

#history_table_exist?Boolean



1009
1010
1011
1012
1013
# File 'lib/migr8.rb', line 1009

def history_table_exist?
  table = history_table()
  output = execute_sql("\\dt #{table}")
  return output.include?(table)
end

#run_sql(sql, opts = {}) ⇒ Object



981
982
983
984
985
# File 'lib/migr8.rb', line 981

def run_sql(sql, opts={})
  preamble = "SET client_min_messages TO WARNING;\n"+
             "\\set ON_ERROR_STOP ON\n"
  super(preamble+sql, opts)
end