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



978
979
980
981
# File 'lib/migr8.rb', line 978

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

#get_migrationsObject



1017
1018
1019
1020
# File 'lib/migr8.rb', line 1017

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

#history_table_exist?Boolean

Returns:

  • (Boolean)


1011
1012
1013
1014
1015
# File 'lib/migr8.rb', line 1011

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

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



983
984
985
986
987
# File 'lib/migr8.rb', line 983

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