-
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sqlsrv: platform renamed to SqlServerPlatform
- Loading branch information
Showing
10 changed files
with
191 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
build: off | ||
cache: | ||
- c:\php -> appveyor.yml | ||
- '%LOCALAPPDATA%\Composer\files -> appveyor.yml' | ||
|
||
clone_folder: c:\projects\dbal | ||
|
||
services: | ||
- mssql2016 | ||
|
||
init: | ||
- SET PATH=c:\php;%PATH% | ||
- SET PHP=1 | ||
- SET ANSICON=121x90 (121x90) | ||
|
||
install: | ||
# Install PHP | ||
- IF EXIST c:\php (SET PHP=0) ELSE (mkdir c:\php) | ||
- IF %PHP%==1 cd c:\php | ||
- IF %PHP%==1 appveyor DownloadFile http://windows.php.net/downloads/releases/archives/php-7.1.0-Win32-VC14-x64.zip | ||
- IF %PHP%==1 7z x php-7.1.0-Win32-VC14-x64.zip >nul | ||
- IF %PHP%==1 echo extension_dir=ext >> php.ini | ||
- IF %PHP%==1 echo extension=php_openssl.dll >> php.ini | ||
- IF %PHP%==1 echo extension=php_sqlsrv_ts.dll >> php.ini | ||
- IF %PHP%==1 appveyor DownloadFile https://github.com/Microsoft/msphpsql/releases/download/4.1.4-Windows/7.1.zip | ||
- IF %PHP%==1 7z x 7.1.zip >nul | ||
- IF %PHP%==1 copy 7.1\x64\php_sqlsrv_71_ts.dll ext\php_sqlsrv_ts.dll | ||
- IF %PHP%==1 del /Q *.zip | ||
- cd c:\projects\dbal | ||
|
||
# Install Nette Tester | ||
- appveyor DownloadFile https://getcomposer.org/composer.phar | ||
- php composer.phar install --prefer-dist --no-interaction --no-progress | ||
|
||
# Create databases.ini | ||
- copy tests\databases.appveyor.ini tests\databases.ini | ||
|
||
test_script: | ||
- vendor\bin\tester -p php -c tests\php.win-sample.ini --setup tests\inc\setup.php tests\cases |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
DELETE FROM books_x_tags DBCC CHECKIDENT ('books_x_tags', RESEED, 0); | ||
DELETE FROM books DBCC CHECKIDENT ('books', RESEED, 0); | ||
DELETE FROM tags DBCC CHECKIDENT ('tags', RESEED, 0); | ||
DELETE FROM authors DBCC CHECKIDENT ('authors', RESEED, 0); | ||
DELETE FROM publishers DBCC CHECKIDENT ('publishers', RESEED, 0); | ||
DELETE FROM tag_followers DBCC CHECKIDENT ('tag_followers', RESEED, 0); | ||
|
||
|
||
SET IDENTITY_INSERT authors ON | ||
INSERT INTO authors (id, name, web, born) VALUES (1, 'Writer 1', 'http://example.com/1', NULL); | ||
SET IDENTITY_INSERT authors ON | ||
INSERT INTO authors (id, name, web, born) VALUES (2, 'Writer 2', 'http://example.com/2', NULL); | ||
|
||
|
||
SET IDENTITY_INSERT publishers ON | ||
INSERT INTO publishers (id, name) VALUES (1, 'Nextras publisher'); | ||
|
||
|
||
SET IDENTITY_INSERT tags ON | ||
INSERT INTO tags (id, name) VALUES (1, 'Tag 1'); | ||
SET IDENTITY_INSERT tags ON | ||
INSERT INTO tags (id, name) VALUES (2, 'Tag 2'); | ||
SET IDENTITY_INSERT tags ON | ||
INSERT INTO tags (id, name) VALUES (3, 'Tag 3'); | ||
|
||
|
||
SET IDENTITY_INSERT books ON | ||
INSERT INTO books (id, author_id, translator_id, title, publisher_id) VALUES (1, 1, 1, 'Book 1', 1); | ||
SET IDENTITY_INSERT books ON | ||
INSERT INTO books (id, author_id, translator_id, title, publisher_id) VALUES (2, 1, NULL, 'Book 2', 1); | ||
SET IDENTITY_INSERT books ON | ||
INSERT INTO books (id, author_id, translator_id, title, publisher_id) VALUES (3, 2, 2, 'Book 3', 1); | ||
SET IDENTITY_INSERT books ON | ||
INSERT INTO books (id, author_id, translator_id, title, publisher_id) VALUES (4, 2, 2, 'Book 4', 1); | ||
|
||
|
||
INSERT INTO books_x_tags (book_id, tag_id) VALUES (1, 1); | ||
INSERT INTO books_x_tags (book_id, tag_id) VALUES (1, 2); | ||
INSERT INTO books_x_tags (book_id, tag_id) VALUES (2, 2); | ||
INSERT INTO books_x_tags (book_id, tag_id) VALUES (2, 3); | ||
INSERT INTO books_x_tags (book_id, tag_id) VALUES (3, 3); | ||
|
||
|
||
-- there is nothing as connection timezone, so we have to explictly express the timezone | ||
INSERT INTO tag_followers (tag_id, author_id, created_at) VALUES (1, 1, '2014-01-01 00:10:00+01:00'); | ||
INSERT INTO tag_followers (tag_id, author_id, created_at) VALUES (3, 1, '2014-01-01 00:10:00+01:00'); | ||
INSERT INTO tag_followers (tag_id, author_id, created_at) VALUES (2, 2, '2014-01-01 00:10:00+01:00'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
CREATE TABLE authors ( | ||
id int NOT NULL IDENTITY(11,1), | ||
name varchar(50) NOT NULL, | ||
web varchar(100) NOT NULL, | ||
born date DEFAULT NULL, | ||
PRIMARY KEY(id) | ||
); | ||
|
||
|
||
CREATE TABLE publishers ( | ||
id int NOT NULL IDENTITY(1,1), | ||
name varchar(50) NOT NULL, | ||
PRIMARY KEY(id) | ||
); | ||
|
||
CREATE UNIQUE INDEX idx_unique_publishers_name ON publishers(name); | ||
|
||
CREATE TABLE tags ( | ||
id int NOT NULL IDENTITY(1,1), | ||
name varchar(50) NOT NULL, | ||
PRIMARY KEY (id) | ||
); | ||
|
||
CREATE TABLE eans ( | ||
id int NOT NULL IDENTITY(1,1), | ||
code varchar(50) NOT NULL, | ||
PRIMARY KEY(id) | ||
); | ||
|
||
CREATE TABLE books ( | ||
id int NOT NULL IDENTITY(1,1), | ||
author_id int NOT NULL, | ||
translator_id int, | ||
title varchar(50) NOT NULL, | ||
publisher_id int NOT NULL, | ||
ean_id int, | ||
PRIMARY KEY (id), | ||
CONSTRAINT books_authors FOREIGN KEY (author_id) REFERENCES authors (id), | ||
CONSTRAINT books_translator FOREIGN KEY (translator_id) REFERENCES authors (id), | ||
CONSTRAINT books_publisher FOREIGN KEY (publisher_id) REFERENCES publishers (id), | ||
CONSTRAINT books_ean FOREIGN KEY (ean_id) REFERENCES eans (id) | ||
); | ||
|
||
CREATE INDEX book_title ON books (title); | ||
|
||
CREATE VIEW my_books AS SELECT * FROM books WHERE author_id = 1; | ||
|
||
CREATE TABLE books_x_tags ( | ||
book_id int NOT NULL, | ||
tag_id int NOT NULL, | ||
PRIMARY KEY (book_id, tag_id), | ||
CONSTRAINT books_x_tags_tag FOREIGN KEY (tag_id) REFERENCES tags (id), | ||
CONSTRAINT books_x_tags_book FOREIGN KEY (book_id) REFERENCES books (id) ON DELETE CASCADE | ||
); | ||
|
||
CREATE TABLE tag_followers ( | ||
tag_id int NOT NULL, | ||
author_id int NOT NULL, | ||
created_at datetimeoffset NOT NULL, | ||
PRIMARY KEY (tag_id, author_id), | ||
CONSTRAINT tag_followers_tag FOREIGN KEY (tag_id) REFERENCES tags (id) ON DELETE CASCADE ON UPDATE CASCADE, | ||
CONSTRAINT tag_followers_author FOREIGN KEY (author_id) REFERENCES authors (id) ON DELETE CASCADE ON UPDATE CASCADE | ||
); | ||
|
||
CREATE TABLE table_with_defaults ( | ||
name VARCHAR(255) DEFAULT 'Jon Snow' | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
use Nextras\Dbal\Connection; | ||
|
||
return function (Connection $connection, $dbname) { | ||
$connection->query('DROP DATABASE IF EXISTS %table', $dbname); | ||
$connection->query('CREATE DATABASE IF NOT EXISTS %table', $dbname); | ||
$connection->query('USE %table', $dbname); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[sqlsrv] | ||
driver = sqlsrv | ||
host = "(local)\SQL2016" | ||
username = sa | ||
password = "Password12!" | ||
database = "master" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
extension_dir = "./ext" | ||
extension=php_mysqli.dll | ||
extension=php_pgsql.dll | ||
extension=php_sqlsrv_ts.dll |