Since the tables will be auto-created when booting the server core, however, the MVC doesn’t know the dependency chain. To help the auto-creation doing correct work, you may want to specify the table dependencies in the table definition:
For example, you have another Model named article which is designed for your blog system. Obviously, it’s related to user table since every article requires at least one user as an author.
(create-artanis-model article ; model name (:deps user) ; deps list (id auto (#:primary-key)) (author_id tinyint (#:not-null)) (title char-field (#:not-null #:maxlen 128)) (timestamp bigint (#:unsigned #:not-null)) )
You may realized we’ve added src_scheme[:exports code]((:deps user)) to hint the MVC system that article table should be created after user table. So when it meets article Model during booting, it’ll make sure to create user then article.
NOTE:: src_scheme[:exports code]((:deps models_list …)) NOTE: This feature is useful when you do DB migration.