Skip to content

Commit

Permalink
改進 news-raw-tables.php 產生表格的方法
Browse files Browse the repository at this point in the history
  • Loading branch information
yookoala committed Jan 7, 2015
1 parent eec225c commit 48768c8
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions webdata/scripts/news-raw-tables.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,9 @@
* to create 12 tables for NewsRaw
*/
$theTime = mktime();
$str = "CREATE TABLE IF NOT EXISTS `news_raw_%s` (
`news_id` int(11) NOT NULL,
`time` int(11) NOT NULL,
`raw` text NOT NULL,
PRIMARY KEY (`news_id`,`time`)
) ENGINE=InnoDB;";
$str = 'CREATE TABLE IF NOT EXISTS `news_raw_%s` LIKE news_raw';
$db = NewsRaw::getDb();
for ($i = 0; $i < 12; $i++) {
$db->query(sprintf($str, date('Ym', $theTime)));
$theTime = strtotime('+1 month', $theTime);
}
}

0 comments on commit 48768c8

Please sign in to comment.