Skip to content

Commit 4d5fa6c

Browse files
authored
Merge pull request #6 from tattersoftware/tools
Migration Standards
2 parents bd4e273 + e6c7fb1 commit 4d5fa6c

File tree

9 files changed

+27
-27
lines changed

9 files changed

+27
-27
lines changed

.github/workflows/analyze.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
with:
4040
php-version: ${{ matrix.php-versions }}
4141
tools: composer, pecl, phpunit
42-
extensions: intl, json, mbstring, mysqlnd, xdebug, xml, sqlite3
42+
extensions: intl, json, mbstring, gd, mysqlnd, xdebug, xml, sqlite3
4343

4444
- name: Get composer cache directory
4545
id: composer-cache

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
with:
3030
php-version: ${{ matrix.php-versions }}
3131
tools: composer, pecl, phpunit
32-
extensions: intl, json, mbstring, mysqlnd, xdebug, xml, sqlite3
32+
extensions: intl, json, mbstring, gd, mysqlnd, xdebug, xml, sqlite3
3333
coverage: xdebug
3434

3535
- name: Get composer cache directory

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ to ensure the database is setup correctly:
3131
## Configuration (optional)
3232

3333
The library's default behavior can be altered by extending its config file. Copy
34-
**bin/Visits.php** to **app/Config/** and follow the instructions in the
34+
**examples/Visits.php** to **app/Config/** and follow the instructions in the
3535
comments. If no config file is found in app/Config the library will use its own.
3636

3737
## Usage

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
},
2525
"require-dev": {
2626
"codeigniter4/codeigniter4": "dev-develop",
27-
"tatter/tools": "^1.6"
27+
"tatter/tools": "^1.7"
2828
},
2929
"autoload": {
3030
"psr-4": {
File renamed without changes.

phpstan.neon.dist

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ parameters:
1313
- '#Access to protected property .+\\[A-Za-z]+Model::\$[A-Za-z]+#'
1414
- '#Access to an undefined property CodeIgniter\\Session\\Session::\$session_id#'
1515
- '#Call to an undefined static method Config\\Services::[A-Za-z]+\(\)#'
16-
- '#Unsafe usage of new static\(\)*#'
1716
universalObjectCratesClasses:
1817
- CodeIgniter\Entity
1918
- Faker\Generator

phpunit.xml.dist

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@
3636
</testsuite>
3737
</testsuites>
3838

39+
<listeners>
40+
<listener class="JohnKary\PHPUnit\Listener\SpeedTrapListener" />
41+
</listeners>
42+
3943
<logging>
4044
<testdoxHtml outputFile="build/phpunit/testdox.html"/>
4145
<testdoxText outputFile="build/phpunit/testdox.txt"/>

src/Database/Migrations/20190319121802_create_table_visits.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,21 @@ class Migration_create_table_visits extends Migration
77
public function up()
88
{
99
$fields = [
10-
'session_id' => ['type' => 'VARCHAR', 'constraint' => 32],
11-
'user_id' => ['type' => 'INT', 'null' => true],
12-
'ip_address' => ['type' => 'BIGINT', 'null' => true],
13-
'user_agent' => ['type' => 'VARCHAR', 'constraint' => 255],
14-
'scheme' => ['type' => 'VARCHAR', 'constraint' => 15],
15-
'host' => ['type' => 'VARCHAR', 'constraint' => 63],
16-
'port' => ['type' => 'VARCHAR', 'constraint' => 15],
17-
'user' => ['type' => 'VARCHAR', 'constraint' => 31],
18-
'pass' => ['type' => 'VARCHAR', 'constraint' => 255],
19-
'path' => ['type' => 'VARCHAR', 'constraint' => 255],
20-
'query' => ['type' => 'VARCHAR', 'constraint' => 255],
21-
'fragment' => ['type' => 'VARCHAR', 'constraint' => 31],
22-
'views' => ['type' => 'INT', 'default' => 1],
23-
'created_at' => ['type' => 'DATETIME', 'null' => true],
24-
'updated_at' => ['type' => 'DATETIME', 'null' => true],
10+
'session_id' => ['type' => 'varchar', 'constraint' => 32, 'default' => ''],
11+
'user_id' => ['type' => 'int', 'null' => true],
12+
'ip_address' => ['type' => 'bigint', 'null' => true],
13+
'user_agent' => ['type' => 'varchar', 'constraint' => 255, 'default' => ''],
14+
'scheme' => ['type' => 'varchar', 'constraint' => 15, 'default' => ''],
15+
'host' => ['type' => 'varchar', 'constraint' => 63],
16+
'port' => ['type' => 'varchar', 'constraint' => 15, 'default' => ''],
17+
'user' => ['type' => 'varchar', 'constraint' => 31, 'default' => ''],
18+
'pass' => ['type' => 'varchar', 'constraint' => 255, 'default' => ''],
19+
'path' => ['type' => 'varchar', 'constraint' => 255],
20+
'query' => ['type' => 'varchar', 'constraint' => 255, 'default' => ''],
21+
'fragment' => ['type' => 'varchar', 'constraint' => 31, 'default' => ''],
22+
'views' => ['type' => 'int', 'default' => 1],
23+
'created_at' => ['type' => 'datetime', 'null' => true],
24+
'updated_at' => ['type' => 'datetime', 'null' => true],
2525
];
2626

2727
$this->forge->addField('id');

src/Models/VisitModel.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ class VisitModel extends Model
66
{
77
protected $table = 'visits';
88
protected $primaryKey = 'id';
9+
protected $returnType = 'Tatter\Visits\Entities\Visit';
910

10-
protected $returnType = 'Tatter\Visits\Entities\Visit';
11+
protected $useTimestamps = true;
1112
protected $useSoftDeletes = false;
13+
protected $skipValidation = false;
1214

1315
protected $allowedFields = [
1416
'session_id',
@@ -26,13 +28,8 @@ class VisitModel extends Model
2628
'fragment',
2729
];
2830

29-
protected $useTimestamps = true;
30-
31-
protected $validationRules = [
31+
protected $validationRules = [
3232
'host' => 'required',
3333
'path' => 'required',
3434
];
35-
protected $validationMessages = [];
36-
protected $skipValidation = false;
37-
3835
}

0 commit comments

Comments
 (0)