当前位置:Gxlcms > 数据库问题 > [mysql] Some non-transactional changed tables couldn't be rolled back

[mysql] Some non-transactional changed tables couldn't be rolled back

时间:2021-07-01 10:21:17 帮助过:4人阅读

使用peewee的事务时,碰到一个郁闷的问题,事务似乎无效!

于是简化了下模型,写了简单的测试代码,发现问题,如题所示。

找到解答:

https://github.com/etianen/django-reversion/issues/362

https://dev.mysql.com/doc/refman/5.0/en/nontransactional-tables.html

原因就是数据库表的引擎需要设置为InnoDB才能支持事物,解决方法如下:

http://dev.mysql.com/doc/refman/5.6/en/converting-tables-to-innodb.html

即,将需要支持事物的表的引擎设置为InnoDB,sql如下:

alter table my_table engine=InnoDB;

 

[mysql] Some non-transactional changed tables couldn't be rolled back

标签:

人气教程排行