# Copyright(C) 2013 Kentoku SHIBA
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA

--source ../../../include/mroonga/have_innodb.inc
--source ../../../include/mroonga/have_mroonga.inc

--disable_warnings
DROP TABLE IF EXISTS articles;
DROP TABLE IF EXISTS comments;
--enable_warnings

CREATE TABLE comments (
  comment int unsigned PRIMARY KEY,
  content text NOT NULL
);

CREATE TABLE articles (
  content text NOT NULL,
  comment int unsigned,
  CONSTRAINT comment FOREIGN KEY (comment) REFERENCES comments (comment)
) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--replace_regex /int\([0-9]+\)/int/ /`test`\.// / COLLATE utf8mb4_unicode_ci//
SHOW CREATE TABLE articles;

--replace_regex /RESTRICT/NO ACTION/
SELECT * FROM information_schema.referential_constraints;

DROP TABLE articles;
DROP TABLE comments;

--source ../../../include/mroonga/have_mroonga_deinit.inc
