1# Copyright(C) 2015 Kouhei Sutou <kou@clear-code.com> 2# 3# This library is free software; you can redistribute it and/or 4# modify it under the terms of the GNU Lesser General Public 5# License as published by the Free Software Foundation; either 6# version 2.1 of the License, or (at your option) any later version. 7# 8# This library is distributed in the hope that it will be useful, 9# but WITHOUT ANY WARRANTY; without even the implied warranty of 10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11# Lesser General Public License for more details. 12# 13# You should have received a copy of the GNU Lesser General Public 14# License along with this library; if not, write to the Free Software 15# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA 16 17--source ../../include/mroonga/skip_mariadb_10_0_or_later.inc 18--source ../../include/mroonga/skip_mysql_5_7_or_later.inc 19--source include/have_partition.inc 20--source ../../include/mroonga/have_mroonga.inc 21 22--disable_warnings 23DROP TABLE IF EXISTS logs; 24--enable_warnings 25 26SET NAMES UTF8; 27CREATE TABLE logs ( 28 timestamp DATETIME, 29 message TEXT 30) DEFAULT CHARSET=UTF8 31 PARTITION BY RANGE (TO_DAYS(timestamp)) ( 32 PARTITION p201501 VALUES LESS THAN (TO_DAYS('2015-02-01')), 33 PARTITION p201502 VALUES LESS THAN (TO_DAYS('2015-03-01')), 34 PARTITION p201503 VALUES LESS THAN (TO_DAYS('2015-04-01')), 35 PARTITION pfuture VALUES LESS THAN MAXVALUE 36); 37SHOW CREATE TABLE logs; 38 39INSERT INTO logs VALUES('2015-01-01 00:00:00', 'Start'); 40INSERT INTO logs VALUES('2015-01-31 23:59:59', 'Shutdown'); 41INSERT INTO logs VALUES('2015-02-01 00:00:00', 'Start'); 42INSERT INTO logs VALUES('2015-02-28 23:59:59', 'Shutdown'); 43INSERT INTO logs VALUES('2015-03-01 00:00:00', 'Start'); 44INSERT INTO logs VALUES('2015-03-31 23:59:59', 'Shutdown'); 45INSERT INTO logs VALUES('2015-04-01 00:00:00', 'Start'); 46INSERT INTO logs VALUES('2015-04-30 23:59:59', 'Shutdown'); 47 48SELECT * FROM logs ORDER BY timestamp; 49 50DROP TABLE logs; 51 52--source ../../include/mroonga/have_mroonga_deinit.inc 53