Lisp HUG Maillist Archive

How to use sql:create-view-from-class to create a primary key?

Hi guys,

I have created a view class with the following codes:
----------------------------------------------------------------------------------------------------------
(sql:def-view-class user ()
((name :db-kind :key :type (string 20) :initarg :name :accessor user-name)
  (reserved_a :type (string 20) :initarg :reserved-a :accessor user-reserved-a))
(:documentation "LispWorks interface of user view."))
----------------------------------------------------------------------------------------------------------
Then I use create-view-from-class to create this table after
connection to MySQL:
(sql:create-view-from-class 'user)

It created the table 'USER' but the column 'NAME' is not the primary key.

How can I mark 'NAME' as a primary key in this example?

Thanks.

With Best Regards,
jingtao.

_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html

Updated at: 2020-12-10 08:28 UTC