Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function handle(
$this->info('🔄 Migrating table: '.$table);

if (! $isDryRun) {
$migrationService->migrateTable($table, $chunkSize, function (string $processed, $total): void {
$migrationService->migrateTable($table, $chunkSize, function (string $processed, int $total): void {
$this->line(sprintf(' 📊 Processed %s/%s records', $processed, $total));
});
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,17 @@ class DatabaseMigrationService
*/
public function getSourceTables(): array
{
$tables = DB::connection($this->sourceConnection)
->select('SHOW TABLES');
$tables = DB::connection($this->sourceConnection)->select('SHOW TABLES');

$tableColumn = 'Tables_in_'.DB::connection($this->sourceConnection)->getDatabaseName();

return collect($tables)
->pluck($tableColumn)
->reject(fn ($table): bool => in_array($table, $this->getExcludedTables()))
->reject(fn (string $table): bool => in_array($table, $this->getExcludedTables()))
->values()
->toArray();
}

/**
* Get the number of records in a table
*/
public function getTableRecordCount(string $table): int
{
return DB::connection($this->sourceConnection)
Expand Down Expand Up @@ -73,7 +69,7 @@ public function migrateTable(string $table, int $chunkSize = 1000, ?callable $pr
$totalRecords,
$progressCallback
): void {
$data = $records->map(fn ($record): array => $this->transformRecord((array) $record))->all();
$data = $records->map(fn (object $record): array => $this->transformRecord((array) $record))->all();

DB::connection($this->targetConnection)
->table($table)
Expand Down Expand Up @@ -170,8 +166,7 @@ private function getExcludedTables(): array

private function hasIdColumn(string $table): bool
{
return Schema::connection($this->sourceConnection)
->hasColumn($table, 'id');
return Schema::connection($this->sourceConnection)->hasColumn($table, 'id');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/Listeners/NotifyMentionedUsers.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ public function handle(ReplyWasCreated $event): void
{
User::query()->whereIn('username', $event->reply->mentionedUsers())
->get()
->each(fn ($user) => $user->notify(new YouWereMentioned($event->reply)));
->each(fn (User $user) => $user->notify(new YouWereMentioned($event->reply)));
}
}
40 changes: 21 additions & 19 deletions config/cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
| Default Cache Store
|--------------------------------------------------------------------------
|
| This option controls the default cache connection that gets used while
| using this caching library. This connection is used when another is
| not explicitly specified when executing a given caching function.
| This option controls the default cache store that will be used by the
| framework. This connection is utilized if another isn't explicitly
| specified when running a cache operation inside the application.
|
*/

'default' => env('CACHE_DRIVER', 'file'),
'default' => env('CACHE_STORE', 'database'),

/*
|--------------------------------------------------------------------------
Expand All @@ -28,32 +28,30 @@
| well as their drivers. You may even define multiple stores for the
| same cache driver to group types of items stored in your caches.
|
| Supported drivers: "apc", "array", "database", "file",
| "memcached", "redis", "dynamodb", "null"
| Supported drivers: "array", "database", "file", "memcached",
| "redis", "dynamodb", "octane", "null"
|
*/

'stores' => [

'apc' => [
'driver' => 'apc',
],

'array' => [
'driver' => 'array',
'serialize' => false,
],

'database' => [
'driver' => 'database',
'table' => 'cache',
'connection' => null,
'lock_connection' => null,
'connection' => env('DB_CACHE_CONNECTION'),
'table' => env('DB_CACHE_TABLE', 'cache'),
'lock_connection' => env('DB_CACHE_LOCK_CONNECTION'),
'lock_table' => env('DB_CACHE_LOCK_TABLE'),
],

'file' => [
'driver' => 'file',
'path' => storage_path('framework/cache/data'),
'lock_path' => storage_path('framework/cache/data'),
],

'memcached' => [
Expand All @@ -77,8 +75,8 @@

'redis' => [
'driver' => 'redis',
'connection' => 'cache',
'lock_connection' => 'default',
'connection' => env('REDIS_CACHE_CONNECTION', 'cache'),
'lock_connection' => env('REDIS_CACHE_LOCK_CONNECTION', 'default'),
],

'dynamodb' => [
Expand All @@ -90,19 +88,23 @@
'endpoint' => env('DYNAMODB_ENDPOINT'),
],

'octane' => [
'driver' => 'octane',
],

],

/*
|--------------------------------------------------------------------------
| Cache Key Prefix
|--------------------------------------------------------------------------
|
| When utilizing a RAM based store such as APC or Memcached, there might
| be other applications utilizing the same cache. So, we'll specify a
| value to get prefixed to all our keys so we can avoid collisions.
| When utilizing the APC, database, memcached, Redis, and DynamoDB cache
| stores, there might be other applications using the same cache. For
| that reason, you may prefix every cache key to avoid collisions.
|
*/

'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache'),
'prefix' => env('CACHE_PREFIX', Str::slug((string) env('APP_NAME', 'laravel'), '_').'_cache_'),

];
6 changes: 0 additions & 6 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -1458,12 +1458,6 @@ parameters:
count: 1
path: config/app.php

-
rawMessage: 'Parameter #1 $title of static method Illuminate\Support\Str::slug() expects string, bool|string given.'
identifier: argument.type
count: 1
path: config/cache.php

-
rawMessage: 'Parameter #1 $title of static method Illuminate\Support\Str::slug() expects string, bool|string given.'
identifier: argument.type
Expand Down
49 changes: 0 additions & 49 deletions phpunit.ci.xml

This file was deleted.

77 changes: 43 additions & 34 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,36 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.4/phpunit.xsd" bootstrap="vendor/autoload.php" colors="true" cacheDirectory=".phpunit.cache">
<testsuites>
<testsuite name="Feature">
<directory suffix="Test.php">./tests/Feature</directory>
</testsuite>
<testsuite name="Modules">
<directory suffix="Test.php">./app-modules/*/tests</directory>
</testsuite>
</testsuites>
<coverage/>
<php>
<env name="APP_ENV" value="testing"/>
<env name="APP_KEY" value="base64:NXoQgjw2ZlOxnGbo5ZRhYgTdM6xLYsgYElNAgcTQJkE="/>
<env name="APP_TIMEZONE" value="UTC"/>
<env name="BCRYPT_ROUNDS" value="4"/>
<env name="CACHE_DRIVER" value="array"/>
<env name="DB_CONNECTION" value="pgsql"/>
<env name="DB_HOST" value="pgsql"/>
<env name="DB_PORT" value="5432"/>
<env name="DB_DATABASE" value="testing"/>
<env name="DB_USERNAME" value="sail"/>
<env name="DB_PASSWORD" value="password"/>
<env name="MAIL_MAILER" value="array"/>
<env name="QUEUE_CONNECTION" value="sync"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="TELESCOPE_ENABLED" value="false"/>
<env name="LOG_CHANNEL" value="null"/>
<env name="PEST_PARALLEL_PROCESSES" value="4"/>
</php>
<source>
<include>
<directory suffix=".php">./app</directory>
</include>
</source>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
cacheDirectory=".phpunit.cache"
displayDetailsOnTestsThatTriggerWarnings="true"
>
<testsuites>
<testsuite name="Feature">
<directory>./tests/Feature</directory>
</testsuite>
<testsuite name="Modules">
<directory>./app-modules/*/tests</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory>app</directory>
<directory>app-modules</directory>
</include>
</source>
<php>
<ini name="memory_limit" value="-1"/>
<env name="APP_ENV" value="testing"/>
<env name="APP_KEY" value="base64:NXoQgjw2ZlOxnGbo5ZRhYgTdM6xLYsgYElNAgcTQJkE="/>
<env name="APP_TIMEZONE" value="UTC"/>
<env name="BCRYPT_ROUNDS" value="4"/>
<env name="CACHE_STORE" value="array"/>
<env name="DB_CONNECTION" value="pgsql"/>
<env name="DB_HOST" value="pgsql"/>
<env name="DB_PORT" value="5432"/>
<env name="DB_DATABASE" value="testing"/>
<env name="DB_USERNAME" value="sail"/>
<env name="DB_PASSWORD" value="password"/>
<env name="MAIL_MAILER" value="array"/>
<env name="MEDIA_DISK" value="public"/>
<env name="QUEUE_CONNECTION" value="sync"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="PULSE_ENABLED" value="false"/>
<env name="TELESCOPE_ENABLED" value="false"/>
<env name="LOG_CHANNEL" value="null"/>
<env name="PEST_PARALLEL_PROCESSES" value="4"/>
</php>
</phpunit>