Closed jmartens closed 3 years ago
The exception causing this might actually be this:
During handling of the above exception (Column 'total_run_count' cannot be null)
As the originally reported Exception is triggered when handling the original exception
The create statement does not allow NULL values:
MariaDB [blastfromthepast]> show create table django_celery_beat_periodictask\G
*************************** 1. row ***************************
Table: django_celery_beat_periodictask
Create Table: CREATE TABLE `django_celery_beat_periodictask` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(200) NOT NULL,
`task` varchar(200) NOT NULL,
`args` longtext NOT NULL,
`kwargs` longtext NOT NULL,
`queue` varchar(200) DEFAULT NULL,
`exchange` varchar(200) DEFAULT NULL,
`routing_key` varchar(200) DEFAULT NULL,
`expires` datetime DEFAULT NULL,
`enabled` tinyint(1) NOT NULL,
`last_run_at` datetime DEFAULT NULL,
`total_run_count` int(10) unsigned NOT NULL,
`date_changed` datetime NOT NULL,
`description` longtext NOT NULL,
`crontab_id` int(11) DEFAULT NULL,
`interval_id` int(11) DEFAULT NULL,
`solar_id` int(11) DEFAULT NULL,
`one_off` tinyint(1) NOT NULL,
`start_time` datetime DEFAULT NULL,
`priority` int(10) unsigned DEFAULT NULL,
`headers` longtext NOT NULL,
`clocked_id` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`),
KEY `django_celery_beat_periodictask_solar_id_a87ce72c` (`solar_id`),
KEY `django_celery_beat_p_crontab_id_d3cba168_fk_django_ce` (`crontab_id`),
KEY `django_celery_beat_p_interval_id_a8ca27da_fk_django_ce` (`interval_id`),
KEY `django_celery_beat_periodictask_clocked_id_47a69f82` (`clocked_id`),
CONSTRAINT `django_celery_beat_p_clocked_id_47a69f82_fk_django_ce` FOREIGN KEY (`clocked_id`) REFERENCES `django_celery_beat_clockedschedule` (`id`),
CONSTRAINT `django_celery_beat_p_crontab_id_d3cba168_fk_django_ce` FOREIGN KEY (`crontab_id`) REFERENCES `django_celery_beat_crontabschedule` (`id`),
CONSTRAINT `django_celery_beat_p_interval_id_a8ca27da_fk_django_ce` FOREIGN KEY (`interval_id`) REFERENCES `django_celery_beat_intervalschedule` (`id`),
CONSTRAINT `django_celery_beat_p_solar_id_a87ce72c_fk_django_ce` FOREIGN KEY (`solar_id`) REFERENCES `django_celery_beat_solarschedule` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
1 row in set (0.001 sec)
The same request after a refresh completes after modifying the affected column like so:
MariaDB [blastfromthepast]> ALTER TABLE `django_celery_beat_periodictask` MODIFY COLUMN `total_run_count` int(10) unsigned
-> ;
Query OK, 0 rows affected (0.160 sec)
Records: 0 Duplicates: 0 Warnings: 0
Apparently the default is set to be 0, so I suspect that somewhere in the model or views this is set to None/NULL despite its editable attribute that is set to False
Summary:
Include a brief descrioption of the problem here, and fill out the version info below.
Django in a docker container connecting to a MySQL docker container running the following versions of celery and django-celery-beat:
Exact steps to reproduce the issue:
Detailed information
Please include more detailed information here, such as relevant information about your system setup, things you did to try and debug the problem, log messages, etc.
When updatign an existing periodic task in my DJango admin interface I received the following error: