Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature - Testing with strict sql_mode #490

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ install: composer install --prefer-source --dev
before_script:
- echo 'extension = "memcache.so"' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
- mysql -e 'CREATE DATABASE phpar_test;'
- mysql -e "SET GLOBAL sql_mode = 'NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES'"
- psql -c 'CREATE DATABASE phpar_test;' -U postgres

services:
Expand Down
174 changes: 97 additions & 77 deletions test/sql/mysql.sql
Original file line number Diff line number Diff line change
@@ -1,112 +1,132 @@
CREATE TABLE authors(
author_id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
parent_author_id INT,
name VARCHAR(25) NOT NULL DEFAULT 'default_name',
updated_at datetime,
created_at datetime,
some_Date date,
some_time time,
some_text text,
some_enum enum('a','b','c'),
encrypted_password varchar(50),
mixedCaseField varchar(50)
# Set our `sql_mode` for strict testing
SET SESSION sql_mode = 'NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES';


CREATE TABLE `authors` (
`author_id` int(11) NOT NULL AUTO_INCREMENT,
`parent_author_id` int(11),
`name` varchar(25) NOT NULL DEFAULT 'default_name',
`updated_at` datetime,
`created_at` datetime,
`some_date` date,
`some_time` time,
`some_text` text,
`some_enum` enum('a','b','c'),
`encrypted_password` varchar(50),
`mixedCaseField` varchar(50),
PRIMARY KEY (`author_id`)
) ENGINE=InnoDB;

CREATE TABLE books(
book_id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
Author_Id INT,
secondary_author_id INT,
name VARCHAR(50),
numeric_test VARCHAR(10) DEFAULT '0',
special NUMERIC(10,2) DEFAULT 0
CREATE TABLE `books` (
`book_id` int(11) NOT NULL AUTO_INCREMENT,
`author_id` int(11),
`secondary_author_id` int(11),
`name` varchar(50),
`numeric_test` varchar(10) DEFAULT '0',
`special` numeric(10,2) DEFAULT 0,
PRIMARY KEY (`book_id`)
);

CREATE TABLE publishers(
publisher_id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(25) NOT NULL DEFAULT 'default_name'
CREATE TABLE `publishers` (
`publisher_id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(25) NOT NULL DEFAULT 'default_name',
PRIMARY KEY (`publisher_id`)
) ENGINE=InnoDB;

CREATE TABLE venues (
Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,
name varchar(50),
city varchar(60),
state char(2),
address varchar(50),
phone varchar(10) default NULL,
UNIQUE(name,address)
CREATE TABLE `venues` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50),
`city` varchar(60),
`state` char(2),
`address` varchar(50),
`phone` varchar(10) default NULL,
PRIMARY KEY (`id`),
UNIQUE(`name`,`address`)
);

CREATE TABLE events (
id int NOT NULL auto_increment PRIMARY KEY,
venue_id int NULL,
host_id int NOT NULL,
title varchar(60) NOT NULL,
description varchar(50),
type varchar(15) default NULL
CREATE TABLE `events` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`venue_id` int(11) NULL,
`host_id` int(11) NOT NULL,
`title` varchar(60) NOT NULL,
`description` varchar(50),
`type` varchar(15) default NULL,
PRIMARY KEY (`id`)
);

CREATE TABLE hosts(
id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(25)
CREATE TABLE `hosts` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(25),
PRIMARY KEY (`id`)
);

CREATE TABLE employees (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
first_name VARCHAR(255) NOT NULL,
last_name VARCHAR(255) NOT NULL,
nick_name VARCHAR(255) NOT NULL
CREATE TABLE `employees` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`first_name` varchar(255) NOT NULL,
`last_name` varchar(255) NOT NULL,
`nick_name` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
);

CREATE TABLE positions (
id int NOT NULL AUTO_INCREMENT PRIMARY KEY,
employee_id int NOT NULL,
title VARCHAR(255) NOT NULL,
active SMALLINT NOT NULL
CREATE TABLE `positions` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`employee_id` int(11) NOT NULL,
`title` varchar(255) NOT NULL,
`active` smallint(11) NOT NULL,
PRIMARY KEY (`id`)
);

CREATE TABLE `rm-bldg`(
`rm-id` INT NOT NULL,
`rm-name` VARCHAR(10) NOT NULL,
`space out` VARCHAR(1) NOT NULL
`rm-id` int(11) NOT NULL,
`rm-name` varchar(10) NOT NULL,
`space out` varchar(1) NOT NULL
);

CREATE TABLE awesome_people(
id int not null primary key auto_increment,
author_id int,
is_awesome int default 1
CREATE TABLE `awesome_people` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`author_id` int(11),
`is_awesome` int(11) default 1,
PRIMARY KEY (`id`)
);

CREATE TABLE amenities(
`amenity_id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`type` varchar(40) NOT NULL DEFAULT ''
CREATE TABLE `amenities` (
`amenity_id` int(11) NOT NULL AUTO_INCREMENT,
`type` varchar(40) NOT NULL DEFAULT '',
PRIMARY KEY (`amenity_id`)
);

CREATE TABLE property(
`property_id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY
CREATE TABLE `property` (
`property_id` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`property_id`)
);

CREATE TABLE property_amenities(
`id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
CREATE TABLE `property_amenities` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`amenity_id` int(11) NOT NULL DEFAULT '0',
`property_id` int(11) NOT NULL DEFAULT '0'
`property_id` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
);

CREATE TABLE users (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY
CREATE TABLE `users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`)
) ENGINE=InnoDB;

CREATE TABLE newsletters (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY
CREATE TABLE `newsletters` (
`id` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`)
) ENGINE=InnoDB;

CREATE TABLE user_newsletters (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
user_id INT NOT NULL,
newsletter_id INT NOT NULL
CREATE TABLE `user_newsletters` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`newsletter_id` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB;

CREATE TABLE valuestore (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
CREATE TABLE `valuestore` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`key` varchar(20) NOT NULL DEFAULT '',
`value` varchar(255) NOT NULL DEFAULT ''
) ENGINE=InnoDB;
`value` varchar(255) NOT NULL DEFAULT '',
PRIMARY KEY (`id`)
) ENGINE=InnoDB;