Skip to content

Commit

Permalink
Merge pull request #42 from byjg/4.2.1
Browse files Browse the repository at this point in the history
Add Primary to Version Table + Fix Deprecation Warnings
  • Loading branch information
byjg authored Mar 15, 2022
2 parents 902f0ac + 276a454 commit 263563a
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"ext-pdo": "*"
},
"require-dev": {
"phpunit/phpunit": "5.7.*|7.4.*"
"phpunit/phpunit": "5.7.*|7.4.*|^9.5"
},
"autoload": {
"psr-4": {
Expand Down
3 changes: 2 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ services:

mysql:
container_name: anydataset_db_mysql
image: mysql:5.7
image: mysql:8
command: --default-authentication-plugin=mysql_native_password
environment:
- MYSQL_ROOT_PASSWORD=password
ports:
Expand Down
2 changes: 1 addition & 1 deletion src/Database/DblibDatabase.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ protected function createTableIfNotExists($database, $createTable)
public function createVersion()
{
$database = preg_replace('~^/~', '', $this->getDbDriver()->getUri()->getPath());
$createTable = 'CREATE TABLE ' . $this->getMigrationTable() . ' (version int, status varchar(20))';
$createTable = 'CREATE TABLE ' . $this->getMigrationTable() . ' (version int, status varchar(20), PRIMARY KEY (version))';
$this->createTableIfNotExists($database, $createTable);
$this->checkExistsVersion();
}
Expand Down
2 changes: 1 addition & 1 deletion src/Database/MySqlDatabase.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function dropDatabase()
*/
public function createVersion()
{
$this->getDbDriver()->execute('CREATE TABLE IF NOT EXISTS ' . $this->getMigrationTable() . ' (version int, status varchar(20))');
$this->getDbDriver()->execute('CREATE TABLE IF NOT EXISTS ' . $this->getMigrationTable() . ' (version int, status varchar(20), PRIMARY KEY (version))');
$this->checkExistsVersion();
}

Expand Down
2 changes: 1 addition & 1 deletion src/Database/PgsqlDatabase.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function dropDatabase()
*/
public function createVersion()
{
$this->getDbDriver()->execute('CREATE TABLE IF NOT EXISTS ' . $this->getMigrationTable() . ' (version int, status varchar(20))');
$this->getDbDriver()->execute('CREATE TABLE IF NOT EXISTS ' . $this->getMigrationTable() . ' (version int, status varchar(20), PRIMARY KEY (version))');
$this->checkExistsVersion();
}

Expand Down
2 changes: 1 addition & 1 deletion src/Database/SqliteDatabase.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function dropDatabase()
*/
public function createVersion()
{
$this->getDbDriver()->execute('CREATE TABLE IF NOT EXISTS ' . $this->getMigrationTable() . ' (version int, status varchar(20))');
$this->getDbDriver()->execute('CREATE TABLE IF NOT EXISTS ' . $this->getMigrationTable() . ' (version int, status varchar(20), PRIMARY KEY (version))');
$this->checkExistsVersion();
}

Expand Down
2 changes: 1 addition & 1 deletion src/Migration.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public function getFileContent($file)
"checksum" => null,
"content" => null,
];
if (!file_exists($file)) {
if (empty($file) || !file_exists($file)) {
return $data;
}

Expand Down

0 comments on commit 263563a

Please sign in to comment.