integral
integral copied to clipboard
redefinition with removing :keys doesn't drop index
At first, I created table and migrate it.
(defclass tweet ()
((id :type bigint
:auto-increment t
:primary-key t
:reader tweet-id)
(user :type (varchar 255)
:accessor tweet-user))
(:metaclass <dao-table-class>)
(:table-name "tweets")
(:keys user))
(execute-sql (table-definition 'tweet)
then, I redefined this table to
(defclass tweet ()
((id :type bigint
:auto-increment t
:primary-key t
:reader tweet-id)
(user :type (varchar 255)
:accessor tweet-user))
(:metaclass <dao-table-class>)
(:table-name "tweets"))
and
(make-migration-sql (find-class 'tweet))
;; => NIL
.
I can remove index with giving nothing to :keys
(defclass tweet ()
((id :type bigint
:auto-increment t
:primary-key t
:reader tweet-id)
(user :type (varchar 255)
:accessor tweet-user))
(:metaclass <dao-table-class>)
(:table-name "tweets")
(:keys))
(make-migration-sql (find-class 'tweet))
;; => ("DROP INDEX user ON tweets")
Is this as you expected?