New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue with multiple columns having default CURRENT_TIMESTAMP #24
Comments
What version of MySQL are you running? Versions before 5.6.5 do not allow more than one timestamp column with a If you'd like, you can try this patch. If it works, I can apply it and add support for your version of MySQL. diff --git a/lib/Minion/Backend/mysql.pm b/lib/Minion/Backend/mysql.pm
index c9020c2..dd67734 100644
--- a/lib/Minion/Backend/mysql.pm
+++ b/lib/Minion/Backend/mysql.pm
@@ -319,8 +319,8 @@ sub register_worker {
my ($self, $id, $options) = @_;
my $db = $self->mysql->db;
- my $sql = q{INSERT INTO minion_workers (id, host, pid, status)
- VALUES (?, ?, ?, ?)
+ my $sql = q{INSERT INTO minion_workers (id, host, pid, status, started, notified)
+ VALUES (?, ?, ?, ?, NOW(), NOW())
ON DUPLICATE KEY UPDATE notified=NOW(), host=VALUES(host), pid=VALUES(pid), status=VALUES(status)};
$db->query($sql, $id, hostname, $$, encode_json( $options->{status} // {} ) );
@@ -1002,7 +1002,7 @@ create table if not exists minion_jobs (
`id` serial not null primary key,
`args` mediumblob not null,
`created` timestamp not null default current_timestamp,
- `delayed` timestamp not null default current_timestamp,
+ `delayed` timestamp not null,
`finished` timestamp null,
`priority` int not null,
`result` mediumblob,
@@ -1019,7 +1019,7 @@ create table if not exists minion_workers (
`host` text not null,
`pid` int not null,
`started` timestamp not null default current_timestamp,
- `notified` timestamp not null default current_timestamp
+ `notified` timestamp not null
);
-- 1 down
@@ -1034,7 +1034,7 @@ alter table minion_jobs add queue varchar(128) not null default 'default';
-- 4 up
ALTER TABLE minion_workers MODIFY COLUMN started timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP;
-ALTER TABLE minion_workers MODIFY COLUMN notified timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP;
+ALTER TABLE minion_workers MODIFY COLUMN notified timestamp NOT NULL;
CREATE TABLE IF NOT EXISTS minion_workers_inbox (
`id` SERIAL NOT NULL PRIMARY KEY,
`worker_id` BIGINT UNSIGNED NOT NULL, |
larryl
pushed a commit
to larryl/Minion-Backend-mysql
that referenced
this issue
Dec 19, 2019
[Fixed] - Fixed an issue with InnoDB index sizing and MySQL strict mode. Thanks @larryl and Grant Street Group! (Github preaction#24)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
DBD::mysql::st execute failed: Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause at <filename>
The text was updated successfully, but these errors were encountered: