-
-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
200 additions
and
3 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,41 @@ | ||
build: off | ||
cache: | ||
- c:\php -> appveyor.yml | ||
- '%LOCALAPPDATA%\Composer\files -> appveyor.yml' | ||
|
||
clone_folder: c:\projects\orm | ||
|
||
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\orm | ||
|
||
# Install Nette Tester | ||
- appveyor DownloadFile https://getcomposer.org/composer.phar | ||
- php composer.phar install --prefer-dist --no-interaction --no-progress | ||
|
||
# Create sections.ini & config.mssql.neon | ||
- copy tests\sections.appveyor.ini tests\sections.ini | ||
- copy tests\config.mssql.sample.neon tests\config.mssql.neon | ||
|
||
test_script: | ||
- sqlcmd -S ".\SQL2016" -U sa -P Password12! -Q "CREATE DATABASE nextras_orm_test" -d "master" | ||
- vendor\bin\tester -p php -c tests\php-win.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
extensions: | ||
nextras.dbal: Nextras\Dbal\Bridges\NetteDI\DbalExtension | ||
nextras.orm: Nextras\Orm\Bridges\NetteDI\OrmExtension | ||
|
||
nextras.dbal: | ||
driver: sqlsrv | ||
host: "(local)\\SQL2016" | ||
username: sa | ||
password: "Password12!" | ||
database: nextras_orm_test | ||
|
||
nextras.orm: | ||
model: NextrasTests\Orm\Model | ||
|
||
services: | ||
- Nextras\Orm\TestHelper\EntityCreator |
Empty file.
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,127 @@ | ||
CREATE TABLE authors ( | ||
id int NOT NULL IDENTITY(1,1), | ||
name varchar(50) NOT NULL, | ||
web varchar(100) NOT NULL, | ||
born date DEFAULT NULL, | ||
favorite_author_id int, | ||
PRIMARY KEY(id), | ||
CONSTRAINT authors_favorite_author FOREIGN KEY (favorite_author_id) REFERENCES authors (id) | ||
); | ||
|
||
|
||
CREATE TABLE publishers ( | ||
publisher_id int NOT NULL IDENTITY(1,1), | ||
name varchar(50) NOT NULL, | ||
PRIMARY KEY(publisher_id) | ||
); | ||
|
||
|
||
CREATE TABLE tags ( | ||
id int NOT NULL IDENTITY(1,1), | ||
name varchar(50) NOT NULL, | ||
is_global char(1) 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, | ||
next_part int, | ||
publisher_id int NOT NULL, | ||
published_at datetimeoffset NOT NULL, | ||
printed_at datetimeoffset, | ||
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_next_part FOREIGN KEY (next_part) REFERENCES books (id), | ||
CONSTRAINT books_publisher FOREIGN KEY (publisher_id) REFERENCES publishers (publisher_id), | ||
CONSTRAINT books_ena FOREIGN KEY (ean_id) REFERENCES eans (id) | ||
); | ||
|
||
CREATE INDEX book_title ON books (title); | ||
|
||
|
||
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 contents ( | ||
id int NOT NULL, | ||
type varchar(10) NOT NULL, | ||
parent_id int, | ||
PRIMARY KEY (id), | ||
CONSTRAINT contents_parent_id FOREIGN KEY (parent_id) REFERENCES contents (id) ON DELETE NO ACTION ON UPDATE NO ACTIOn | ||
); | ||
|
||
|
||
CREATE TABLE book_collections ( | ||
id int NOT NULL IDENTITY(1,1), | ||
name varchar(255) NOT NULL, | ||
updated_at datetimeoffset NULL, | ||
PRIMARY KEY (id) | ||
); | ||
|
||
|
||
CREATE TABLE users ( | ||
id int NOT NULL IDENTITY(1,1), | ||
PRIMARY KEY(id) | ||
); | ||
|
||
|
||
CREATE TABLE users_x_users ( | ||
my_friends_id int NOT NULL, | ||
friends_with_me_id int NOT NULL, | ||
PRIMARY KEY (my_friends_id, friends_with_me_id), | ||
CONSTRAINT my_friends_key FOREIGN KEY (my_friends_id) REFERENCES users (id) ON DELETE CASCADE ON UPDATE CASCADE, | ||
CONSTRAINT friends_with_me_key FOREIGN KEY (friends_with_me_id) REFERENCES users (id) ON DELETE NO ACTION ON UPDATE NO ACTION | ||
); | ||
|
||
|
||
-- CREATE TRIGGER `book_collections_bu_trigger` BEFORE UPDATE ON `book_collections` | ||
-- FOR EACH ROW SET NEW.updated_at = NOW(); | ||
-- | ||
-- CREATE TRIGGER `book_collections_bi_trigger` BEFORE INSERT ON `book_collections` | ||
-- FOR EACH ROW SET NEW.updated_at = NOW(); | ||
|
||
|
||
CREATE TABLE photo_albums ( | ||
id int NOT NULL IDENTITY(1,1), | ||
title varchar(255) NOT NULL, | ||
preview_id int NULL, | ||
PRIMARY KEY(id) | ||
); | ||
|
||
CREATE TABLE photos ( | ||
id int NOT NULL IDENTITY(1,1), | ||
title varchar(255) NOT NULL, | ||
album_id int NOT NULL, | ||
PRIMARY KEY(id), | ||
CONSTRAINT photos_album_id FOREIGN KEY (album_id) REFERENCES photo_albums (id) ON DELETE CASCADE ON UPDATE CASCADE | ||
); | ||
|
||
ALTER TABLE photo_albums | ||
ADD CONSTRAINT photo_albums_preview_id FOREIGN KEY (preview_id) REFERENCES photos (id) ON DELETE CASCADE ON UPDATE CASCADE; |
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,8 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
use Nextras\Dbal\Connection; | ||
|
||
return function (Connection $connection, $dbname) { | ||
// $connection->query('DROP SCHEMA IF EXISTS nextras'); | ||
// $connection->query('CREATE SCHEMA nextras'); | ||
}; |
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 |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
extension_dir = "./ext" | ||
extension=php_mysqli.dll | ||
extension=php_pgsql.dll | ||
extension=php_sqlsrv_ts.dll |
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 @@ | ||
[mssql] |