lib/flare_up/command/create_table.rb in flare-up-0.9 vs lib/flare_up/command/create_table.rb in flare-up-0.10
- old
+ new
@@ -7,11 +7,10 @@
def initialize(*args)
@columns = []
super
end
-
# http://docs.aws.amazon.com/redshift/latest/dg/r_CREATE_TABLE_NEW.html
def get_command
"CREATE TABLE #{@table_name} #{get_columns} #{@options}"
end
@@ -25,26 +24,9 @@
def columns=(columns)
raise ArgumentError, 'Columns must be a string' unless columns.is_a?(String)
columns_separated = columns.split(' ')
raise ArgumentError, 'Columns must have a data type for each name' unless columns_separated.length % 2 == 0
@columns = columns_separated
- end
-
- def execute(connection)
- begin
- connection.execute(get_command)
- []
- rescue PG::InternalError => e
- case e.message
- when /Check 'stl_load_errors' system table for details/
- return STLLoadErrorFetcher.fetch_errors(connection)
- when /PG::SyntaxError/
- matches = /syntax error (.+) \(PG::SyntaxError\)/.match(e.message)
- raise SyntaxError, "Syntax error in the CREATE TABLE command: [#{matches[1]}]."
- else
- raise e
- end
- end
end
private
def get_columns