Skip to content

Commit 9e6d5fa

Browse files
committed
test: More Test Cases for Running Migrations
1 parent 17e1669 commit 9e6d5fa

File tree

10 files changed

+487
-13
lines changed

10 files changed

+487
-13
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
namespace app\database\migrations\multi;
3+
4+
use webfiori\database\Database;
5+
use webfiori\database\migration\AbstractMigration;
6+
/**
7+
* A database migration class.
8+
*/
9+
class Migration000 extends AbstractMigration {
10+
/**
11+
* Creates new instance of the class.
12+
*/
13+
public function __construct() {
14+
parent::__construct('Third One', 2);
15+
}
16+
/**
17+
* Performs the action that will apply the migration.
18+
*
19+
* @param Database $schema The database at which the migration will be applied to.
20+
*/
21+
public function up(Database $schema) {
22+
//TODO: Implement the action which will apply the migration to database.
23+
}
24+
/**
25+
* Performs the action that will revert back the migration.
26+
*
27+
* @param Database $schema The database at which the migration will be applied to.
28+
*/
29+
public function down(Database $schema) {
30+
//TODO: Implement the action which will revert back the migration.
31+
}
32+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
namespace app\database\migrations\multi;
3+
4+
use webfiori\database\Database;
5+
use webfiori\database\migration\AbstractMigration;
6+
/**
7+
* A database migration class.
8+
*/
9+
class Migration001 extends AbstractMigration {
10+
/**
11+
* Creates new instance of the class.
12+
*/
13+
public function __construct() {
14+
parent::__construct('Second one', 1);
15+
}
16+
/**
17+
* Performs the action that will apply the migration.
18+
*
19+
* @param Database $schema The database at which the migration will be applied to.
20+
*/
21+
public function up(Database $schema) {
22+
//TODO: Implement the action which will apply the migration to database.
23+
}
24+
/**
25+
* Performs the action that will revert back the migration.
26+
*
27+
* @param Database $schema The database at which the migration will be applied to.
28+
*/
29+
public function down(Database $schema) {
30+
//TODO: Implement the action which will revert back the migration.
31+
}
32+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
namespace app\database\migrations\multi;
3+
4+
use webfiori\database\Database;
5+
use webfiori\database\migration\AbstractMigration;
6+
/**
7+
* A database migration class.
8+
*/
9+
class Migration002 extends AbstractMigration {
10+
/**
11+
* Creates new instance of the class.
12+
*/
13+
public function __construct() {
14+
parent::__construct('First One', 0);
15+
}
16+
/**
17+
* Performs the action that will apply the migration.
18+
*
19+
* @param Database $schema The database at which the migration will be applied to.
20+
*/
21+
public function up(Database $schema) {
22+
//TODO: Implement the action which will apply the migration to database.
23+
}
24+
/**
25+
* Performs the action that will revert back the migration.
26+
*
27+
* @param Database $schema The database at which the migration will be applied to.
28+
*/
29+
public function down(Database $schema) {
30+
//TODO: Implement the action which will revert back the migration.
31+
}
32+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
namespace app\database\migrations\multi;
3+
4+
use webfiori\database\ConnectionInfo;
5+
use webfiori\database\migration\MigrationsRunner;
6+
use const APP_PATH;
7+
use const DS;
8+
9+
10+
class MultiRunner extends MigrationsRunner {
11+
12+
public function __construct() {
13+
$conn = new ConnectionInfo('mssql', 'sa', '1234567890@Eu', 'testing_db', SQL_SERVER_HOST, 1433, [
14+
'TrustServerCertificate' => 'true'
15+
]);
16+
parent::__construct(APP_PATH.'database'.DS.'migrations'.DS.'multi', '\\app\\database\\migrations\\multi', $conn);
17+
}
18+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
namespace app\database\migrations\multiErr;
3+
4+
use webfiori\database\Database;
5+
use webfiori\database\migration\AbstractMigration;
6+
/**
7+
* A database migration class.
8+
*/
9+
class Migration000 extends AbstractMigration {
10+
/**
11+
* Creates new instance of the class.
12+
*/
13+
public function __construct() {
14+
parent::__construct('Third One', 2);
15+
}
16+
/**
17+
* Performs the action that will apply the migration.
18+
*
19+
* @param Database $schema The database at which the migration will be applied to.
20+
*/
21+
public function up(Database $schema) {
22+
$schema->x();
23+
}
24+
/**
25+
* Performs the action that will revert back the migration.
26+
*
27+
* @param Database $schema The database at which the migration will be applied to.
28+
*/
29+
public function down(Database $schema) {
30+
$schema->y();
31+
}
32+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
namespace app\database\migrations\multiErr;
3+
4+
use webfiori\database\Database;
5+
use webfiori\database\migration\AbstractMigration;
6+
/**
7+
* A database migration class.
8+
*/
9+
class Migration001 extends AbstractMigration {
10+
/**
11+
* Creates new instance of the class.
12+
*/
13+
public function __construct() {
14+
parent::__construct('Second one', 1);
15+
}
16+
/**
17+
* Performs the action that will apply the migration.
18+
*
19+
* @param Database $schema The database at which the migration will be applied to.
20+
*/
21+
public function up(Database $schema) {
22+
//TODO: Implement the action which will apply the migration to database.
23+
}
24+
/**
25+
* Performs the action that will revert back the migration.
26+
*
27+
* @param Database $schema The database at which the migration will be applied to.
28+
*/
29+
public function down(Database $schema) {
30+
//TODO: Implement the action which will revert back the migration.
31+
}
32+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
namespace app\database\migrations\multiErr;
3+
4+
use webfiori\database\Database;
5+
use webfiori\database\migration\AbstractMigration;
6+
/**
7+
* A database migration class.
8+
*/
9+
class Migration002 extends AbstractMigration {
10+
/**
11+
* Creates new instance of the class.
12+
*/
13+
public function __construct() {
14+
parent::__construct('First One', 0);
15+
}
16+
/**
17+
* Performs the action that will apply the migration.
18+
*
19+
* @param Database $schema The database at which the migration will be applied to.
20+
*/
21+
public function up(Database $schema) {
22+
//TODO: Implement the action which will apply the migration to database.
23+
}
24+
/**
25+
* Performs the action that will revert back the migration.
26+
*
27+
* @param Database $schema The database at which the migration will be applied to.
28+
*/
29+
public function down(Database $schema) {
30+
//TODO: Implement the action which will revert back the migration.
31+
}
32+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
namespace app\database\migrations\multiErr;
3+
4+
use webfiori\database\ConnectionInfo;
5+
use webfiori\database\migration\MigrationsRunner;
6+
use const APP_PATH;
7+
use const DS;
8+
9+
10+
class MultiErrRunner extends MigrationsRunner {
11+
12+
public function __construct() {
13+
$conn = new ConnectionInfo('mssql', 'sa', '1234567890@Eu', 'testing_db', SQL_SERVER_HOST, 1433, [
14+
'TrustServerCertificate' => 'true'
15+
]);
16+
parent::__construct(APP_PATH.'database'.DS.'migrations'.DS.'multiErr', '\\app\\database\\migrations\\multiErr', $conn);
17+
}
18+
}

0 commit comments

Comments
 (0)