Skip to content

Commit

Permalink
Merge pull request #6 from tattersoftware/tools
Browse files Browse the repository at this point in the history
Migration Standards
  • Loading branch information
MGatner authored Mar 17, 2021
2 parents bd4e273 + e6c7fb1 commit 4d5fa6c
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/analyze.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
with:
php-version: ${{ matrix.php-versions }}
tools: composer, pecl, phpunit
extensions: intl, json, mbstring, mysqlnd, xdebug, xml, sqlite3
extensions: intl, json, mbstring, gd, mysqlnd, xdebug, xml, sqlite3

- name: Get composer cache directory
id: composer-cache
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
with:
php-version: ${{ matrix.php-versions }}
tools: composer, pecl, phpunit
extensions: intl, json, mbstring, mysqlnd, xdebug, xml, sqlite3
extensions: intl, json, mbstring, gd, mysqlnd, xdebug, xml, sqlite3
coverage: xdebug

- name: Get composer cache directory
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ to ensure the database is setup correctly:
## Configuration (optional)

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

## Usage
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
},
"require-dev": {
"codeigniter4/codeigniter4": "dev-develop",
"tatter/tools": "^1.6"
"tatter/tools": "^1.7"
},
"autoload": {
"psr-4": {
Expand Down
File renamed without changes.
1 change: 0 additions & 1 deletion phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ parameters:
- '#Access to protected property .+\\[A-Za-z]+Model::\$[A-Za-z]+#'
- '#Access to an undefined property CodeIgniter\\Session\\Session::\$session_id#'
- '#Call to an undefined static method Config\\Services::[A-Za-z]+\(\)#'
- '#Unsafe usage of new static\(\)*#'
universalObjectCratesClasses:
- CodeIgniter\Entity
- Faker\Generator
Expand Down
4 changes: 4 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
</testsuite>
</testsuites>

<listeners>
<listener class="JohnKary\PHPUnit\Listener\SpeedTrapListener" />
</listeners>

<logging>
<testdoxHtml outputFile="build/phpunit/testdox.html"/>
<testdoxText outputFile="build/phpunit/testdox.txt"/>
Expand Down
30 changes: 15 additions & 15 deletions src/Database/Migrations/20190319121802_create_table_visits.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@ class Migration_create_table_visits extends Migration
public function up()
{
$fields = [
'session_id' => ['type' => 'VARCHAR', 'constraint' => 32],
'user_id' => ['type' => 'INT', 'null' => true],
'ip_address' => ['type' => 'BIGINT', 'null' => true],
'user_agent' => ['type' => 'VARCHAR', 'constraint' => 255],
'scheme' => ['type' => 'VARCHAR', 'constraint' => 15],
'host' => ['type' => 'VARCHAR', 'constraint' => 63],
'port' => ['type' => 'VARCHAR', 'constraint' => 15],
'user' => ['type' => 'VARCHAR', 'constraint' => 31],
'pass' => ['type' => 'VARCHAR', 'constraint' => 255],
'path' => ['type' => 'VARCHAR', 'constraint' => 255],
'query' => ['type' => 'VARCHAR', 'constraint' => 255],
'fragment' => ['type' => 'VARCHAR', 'constraint' => 31],
'views' => ['type' => 'INT', 'default' => 1],
'created_at' => ['type' => 'DATETIME', 'null' => true],
'updated_at' => ['type' => 'DATETIME', 'null' => true],
'session_id' => ['type' => 'varchar', 'constraint' => 32, 'default' => ''],
'user_id' => ['type' => 'int', 'null' => true],
'ip_address' => ['type' => 'bigint', 'null' => true],
'user_agent' => ['type' => 'varchar', 'constraint' => 255, 'default' => ''],
'scheme' => ['type' => 'varchar', 'constraint' => 15, 'default' => ''],
'host' => ['type' => 'varchar', 'constraint' => 63],
'port' => ['type' => 'varchar', 'constraint' => 15, 'default' => ''],
'user' => ['type' => 'varchar', 'constraint' => 31, 'default' => ''],
'pass' => ['type' => 'varchar', 'constraint' => 255, 'default' => ''],
'path' => ['type' => 'varchar', 'constraint' => 255],
'query' => ['type' => 'varchar', 'constraint' => 255, 'default' => ''],
'fragment' => ['type' => 'varchar', 'constraint' => 31, 'default' => ''],
'views' => ['type' => 'int', 'default' => 1],
'created_at' => ['type' => 'datetime', 'null' => true],
'updated_at' => ['type' => 'datetime', 'null' => true],
];

$this->forge->addField('id');
Expand Down
11 changes: 4 additions & 7 deletions src/Models/VisitModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ class VisitModel extends Model
{
protected $table = 'visits';
protected $primaryKey = 'id';
protected $returnType = 'Tatter\Visits\Entities\Visit';

protected $returnType = 'Tatter\Visits\Entities\Visit';
protected $useTimestamps = true;
protected $useSoftDeletes = false;
protected $skipValidation = false;

protected $allowedFields = [
'session_id',
Expand All @@ -26,13 +28,8 @@ class VisitModel extends Model
'fragment',
];

protected $useTimestamps = true;

protected $validationRules = [
protected $validationRules = [
'host' => 'required',
'path' => 'required',
];
protected $validationMessages = [];
protected $skipValidation = false;

}

0 comments on commit 4d5fa6c

Please sign in to comment.