diff --git a/src/squirrel_parse/to_hugsql_queries.clj b/src/squirrel_parse/to_hugsql_queries.clj index ec50e70..cd67655 100644 --- a/src/squirrel_parse/to_hugsql_queries.clj +++ b/src/squirrel_parse/to_hugsql_queries.clj @@ -4,6 +4,8 @@ (:require [clojure.java.io :refer [file]] [clojure.math.combinatorics :refer [combinations]] [clojure.string :as s] + [clj-time.core :as t] + [clj-time.format :as f] [squirrel-parse.to-adl :refer [migrations-to-xml]] [squirrel-parse.utils :refer [is-link-table? singularise]])) @@ -281,13 +283,20 @@ [adl-struct (migrations-to-xml migrations-path "Ignored") file-content (apply str - (doall (map + (cons + (str "-- " + output + " autogenerated by \n-- [squirrel-parse](https://github.com/simon-brooke/squirrel-parse)\n-- at " + (f/unparse (f/formatters :basic-date-time) (t/now)) + "\n\n") + (doall + (map #(:query %) (vals (apply merge (map #(queries % adl-struct) - (vals adl-struct)))))))] + (vals adl-struct))))))))] (spit output file-content) file-content))) diff --git a/src/squirrel_parse/to_json_routes.clj b/src/squirrel_parse/to_json_routes.clj index a4eca3a..2f9efe4 100644 --- a/src/squirrel_parse/to_json_routes.clj +++ b/src/squirrel_parse/to_json_routes.clj @@ -5,6 +5,8 @@ [clojure.math.combinatorics :refer [combinations]] [clojure.pprint :refer [pprint write]] [clojure.string :as s] + [clj-time.core :as t] + [clj-time.format :as f] [squirrel-parse.to-adl :refer [migrations-to-xml]] [squirrel-parse.to-hugsql-queries :refer [queries]] [squirrel-parse.utils :refer [is-link-table? singularise]])) @@ -40,8 +42,10 @@ (defn file-header [parent-name this-name] (list 'ns - ^{:doc "JSON routes auto-generated by squirrel-parse"} (symbol (str parent-name "." this-name)) + (str "JSON routes for " parent-name + " auto-generated by [squirrel-parse](https://github.com/simon-brooke/squirrel-parse) at " + (f/unparse (f/formatters :basic-date-time) (t/now))) (list 'require '[noir.response :as nresponse]