Adding mysql user to database -
is possible add mysql user database column?
lets have following table:
create table message( id int auto_increment not null, title varchar(255), message text, last_edited timestamp default current_timestamp on update current_timestamp, primary key (id) ) engine=innodb; and want add 'editor' column current mysql user , insert there , updates automatically similar behaviour of timestamp datatype. can done , if sort of datatype should use (is there such type user or should use simple varchar) , kind of syntax involved?
create table message( id int auto_increment not null, title varchar(255), message text, last_edited timestamp default current_timestamp on update current_timestamp, editor varchar(50) not null, primary key (id), unique index `editor`(`editor`) ) engine=innodb; and while inserting; use
insert `message`(`columns..`, `editor`) values( <your values>, current_user() ) on duplicate key update `editor` = current_user();
Comments
Post a Comment