Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove on update condition without drop mysql table

Tags:

I have a mysql table and data entries in it:

CREATE TABLE    `invoices`.`invoices` (
    `InvoiceID` bigint(20) unsigned NOT NULL auto_increment,
    `UserID` int(10) unsigned NOT NULL,
    `Value` decimal(10,3) NOT NULL,
    `Description` varchar(4048) NOT NULL,
    `DateTime` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
    PRIMARY KEY    (`InvoiceID`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin5;

I want to remove "on update CURRENT_TIMESTAMP" condition. How can I alter this table?

like image 497
HasanG Avatar asked Sep 06 '10 13:09

HasanG


1 Answers

ALTER TABLE `invoices`.`invoices`
    CHANGE `DateTime` `DateTime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
like image 122
aularon Avatar answered Sep 23 '22 04:09

aularon