1 package Newslash::Model::Histories;
2 use Newslash::Model::Base -base;
4 use constant HISTORY_TABLE_NAME => 'ns_histories';
10 return 1 if $self->check_readonly;
12 my $table_name = HISTORY_TABLE_NAME;
14 # under construction...
17 if (!$self->table_exists($table_name)) {
18 my $dbh = $self->connect_db;
21 CREATE TABLE IF NOT EXISTS $table_name (
22 history_id mediumint(8) unsigned AUTO_INCREMENT PRIMARY KEY,
23 type varchar(128) NOT NULL,
25 uid mediumint(8) unsigned NOT NULL,
30 relatedtext mediumtext,
33 related_id mediumint(8) unsigned NOT NULL,
34 timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
35 ) DEFAULT CHARSET=utf8mb4
37 my $rs = $dbh->do($sql, undef);
40 $self->warn("create table: $table_name");
43 $self->warn("cannot create table: $table_name");