             ->create();
     }
 }"
-   table-data))
+      table-data))))
 
 (defn migration-filename [table-name]
   (let [fmt (java.text.SimpleDateFormat. "yyyyMMddHHmmss")

(defn get-tables
  "Retrieves a list containing all tables in the database."
  [db]
  (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")))

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