Django set Storage Engine & Default Charset

前端 未结 2 1965
生来不讨喜
生来不讨喜 2021-02-03 12:59

Creating my tables from my models.py. I donno how to do 2 things -

  1. I want to specify MySQL to create some of my tables as InnoDB
2条回答
  •  走了就别回头了
    2021-02-03 14:05

    CREATE TABLE IF NOT EXISTS `users` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `firstname` varchar(32) NOT NULL,
      `lastname` varchar(32) NOT NULL,
      `gender` varchar(6) NOT NULL,
      `email` varchar(32) NOT NULL,
      `username` varchar(32) NOT NULL,
      `password` varchar(32) NOT NULL,
      `created` datetime NOT NULL,
      `modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
      PRIMARY KEY (`id`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=76 ;
    

提交回复
热议问题