You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
user=> (sql/format {:alter-table [:table], :alter-column [(:column:set [:notnil])]})
["ALTER TABLE table ALTER COLUMN not NULL"]
But the following do work:
user=> (-> (alter-table:fruit)
(alter-column:name:type [:varchar64])
sql/format)
["ALTER TABLE fruit ALTER COLUMN name TYPE VARCHAR(64)"]
user=> (-> (alter-table:fruit)
(alter-column:name:set [:notnil])
sql/format)
["ALTER TABLE fruit ALTER COLUMN name SET NOT NULL"]
user=>
According to the honeysql postgres documetation:
This statement is given as an example.
However, this creates code which is not compatible with postgres.
Postgres expects
ALTER TABLE fruit ALTER COLUMN name TYPE VARCHAR(64)
and
ALTER TABLE fruit ALTER COLUMN name SET NOT NULL
(See: https://www.postgresql.org/docs/current/sql-altertable.html )
This can be achieved with these queries:
{:alter-table [:table], :alter-column [(:column :set [:not nil])]}
and:
{:alter-table [:table], :alter-column [(:column :type [:varchar 64])]}
The text was updated successfully, but these errors were encountered: