0

I want to add a timestamp column to the replica table, so that when any updates get replicated from the source it gets updated. However, it does not seem to work on every table.

Binary logs format is set to mixed.

I tried to test this with a separate table. In the source:

CREATE TABLE replication_test (
  `id` INT NOT NULL AUTO_INCREMENT,
  `text` varchar(10),
  PRIMARY KEY (id)
);

And in the replica I added the lastUpdated column:

ALTER TABLE replication_test ADD lastUpdated TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;

And it works, when I do insert/update queries in source the lastUpdated field gets updated. However, if I add the lastUpdated timestamp column to an existing table using the above ALTER TABLE statement, it is not updated after a update query in source.

Has anyone encountered a similar issue? Can this happen because row based replication is used instead of statement in the existing tables?

dan1st
  • 12,568
  • 8
  • 34
  • 67
jjustas
  • 31
  • 1
  • 4

0 Answers0