Skip to content

Calling the 'call' function results in an exception #5

Description

@felixflores
(ns my.stuff
  (:require [stch.sql.format :as sql]
            [clojure.java.jdbc :refer [execute!]]
            [stch.sql.types :refer [call]]
            [stch.sql.ddl :refer [create timestamp integer primary-key serial table default]]))

(def db {:classname "org.postgresql.Driver"
         :subprotocol "postgresql"
         :user "stuff"
         :password ""
         :subname "//localhost:5432/mydb"})

(defn db-execute!
  [statement]
  (execute! db statement))

(db-execute! [(-> (table :schema_versions)
                  (serial :id :not-null)
                  (primary-key :id)
                  (integer :version)
                  (timestamp :created_at (default (call :now)))
                  (create))])


;=> CompilerException java.lang.IllegalArgumentException: No implementation of method: :to-sql of protocol: #'stch.sql.ddl/ToSQL found for class: stch.sql.types.SqlCall, compiling:(config/migrate_config.clj:1:31) 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions