Ho un sito per il quale sono necessarie delle tabelle del tipo
codice:
CREATE TABLE `category_user` (
`user_id` int(10) UNSIGNED NOT NULL,
`category_id` int(10) UNSIGNED NOT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
Praticamente, alla creazione del record, created_at ed updated_at devono riportare il timestamp corrente, quando un record viene aggiornato, il campo updated_at deve automaticamente essere impostato al timestamp dell'aggiornamento.

Ma sul server che deve ospitale c'è la versione 5.5.41 di MySQL che restituisce l'errore
#1293 - Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause
La dichiarazione della tabella sarebbe lecita dalla versione 5.6 di MySQL, ma non è disponibile.

C'è un modo compatibile con MySQL 5.5 per ottenere lo stesso risultato?