Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion lib/lhm/table.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def initialize(table_name, connection)
def ddl
sql = "show create table `#{ @table_name }`"
specification = nil
@connection.execute(sql).each { |row| specification = row.last }
@connection.execute(sql).each { |row| specification = specification(row) }
specification
end

Expand Down Expand Up @@ -111,6 +111,14 @@ def extract_primary_key(schema)

keys.length == 1 ? keys.first : keys
end

def specification(row)
if row.is_a?(Array)
row.last
else
row["Create Table"]
end
end
end
end
end