This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-08-30
Channels
- # adventofcode (4)
- # aleph (1)
- # announcements (6)
- # babashka (11)
- # beginners (63)
- # calva (73)
- # clj-kondo (9)
- # clj-on-windows (20)
- # cljdoc (8)
- # cljsrn (4)
- # clojure (48)
- # clojure-europe (20)
- # clojure-italy (1)
- # clojure-nl (11)
- # clojure-spec (11)
- # clojure-uk (3)
- # clojurescript (32)
- # cloverage (1)
- # conjure (1)
- # cryogen (5)
- # datomic (83)
- # fulcro (28)
- # graphql (23)
- # gratitude (4)
- # helix (15)
- # honeysql (4)
- # improve-getting-started (14)
- # introduce-yourself (3)
- # jackdaw (5)
- # kaocha (11)
- # leiningen (1)
- # malli (1)
- # meander (5)
- # off-topic (18)
- # pathom (17)
- # pedestal (6)
- # polylith (15)
- # practicalli (1)
- # quil (2)
- # reitit (4)
- # releases (6)
- # shadow-cljs (38)
- # sql (20)
- # testing (6)
- # timbre (5)
- # tools-deps (11)
- # vim (2)
hi, how can we create add primary key ddl in honeysql? look like there is no add-primary-key
helper fn?
ALTER TABLE table_name ADD PRIMARY KEY (id);
@quan Use :add-index
:
dev=> (-> (h/alter-table :foo)
#_=> (h/add-index :primary-key :id)
#_=> (sql/format))
["ALTER TABLE foo ADD PRIMARY KEY(id)"]
dev=>
It's a combination of https://cljdoc.org/d/com.github.seancorfield/honeysql/2.0.783/doc/getting-started/sql-clause-reference#add-index-drop-index and https://cljdoc.org/d/com.github.seancorfield/honeysql/2.0.783/doc/getting-started/sql-special-syntax-#foreign-key-primary-key -- I'll create an issue to add an example and cross-link these.