 (defn get-tables
   "Retrieves a list containing all tables in the database."
   [db]
-  (j/query db "show tables"))
+  (map (comp second first)
+       (j/query db "show tables")))
 
 (defn column-usage
   "Gets all the foreign keys declarations for a particular schema and table."

                                                      name-parts)))]
    (str ts "_"  migration-name ".php")))

(def tablenames
  (str/split (slurp "/home/eduardo/Documentos/dep-ordered.csv") #"\n"))

(defn -main
  "Takes a MySQL database connection configuration and a directory to output
  the Phinx migrations."
  [host dbname user pass schema directory & more]
  (let [db {:subprotocol "mysql"
            :subname (str "//" host ":3306/" dbname)
            :user user
            :password pass}
        tables (map #(table-data db schema %)
                    (describe-tables db tablenames))]
    (doseq [table tables]
      (let [fcontent (render-migration-content table)
            fname    (migration-filename (:table-name table))
            _        (Thread/sleep 1000) ; We need one second delay so the migration timestamp don't repeat!
            ]

            ->create();
    }
}"
      table-data))))

(defn migration-filename [table-name]
  (let [fmt (java.text.SimpleDateFormat. "yyyyMMddHHmmss")
