Compare commits

...

3 Commits

Author SHA1 Message Date
hackerESQ 3e492475c0 fix: migrations failing on mysql 2025-07-09 21:55:32 -05:00
hackerESQ c454e85ad4 fix: date calculations cause failed tests 2025-07-09 19:37:51 -05:00
David Peng 487322abb5 fix: fix postgresql support (#100)
Fix #81
2025-07-09 19:11:25 -05:00
3 changed files with 12 additions and 6 deletions
@@ -8,6 +8,7 @@ use App\Models\Transaction;
use Database\Seeders\CurrencySeeder; use Database\Seeders\CurrencySeeder;
use Database\Seeders\MarketDataSeeder; use Database\Seeders\MarketDataSeeder;
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Query\Expression;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Artisan; use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
@@ -24,10 +25,15 @@ return new class extends Migration
* Add options column to users table * Add options column to users table
*/ */
Schema::table('users', function (Blueprint $table) { Schema::table('users', function (Blueprint $table) {
$table->json('options')->default(json_encode([
'locale' => config('app.locale', 'en'), $locale = config('app.locale', 'en');
'display_currency' => config('investbrain.base_currency', 'USD'), $currency = config('investbrain.base_currency', 'USD');
]))->after('profile_photo_path');
$default = config('database.default') === 'mysql'
? new Expression("(JSON_OBJECT('locale', '{$locale}', 'display_currency', '{$currency}'))")
: json_encode(['locale' => $locale, 'display_currency' => $currency]);
$table->json('options')->default($default)->after('profile_photo_path');
}); });
/** /**
+1 -1
View File
@@ -62,7 +62,7 @@ RUN apk add --no-cache \
bash \ bash \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \ && docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) \ && docker-php-ext-install -j$(nproc) \
gd pgsql zip pdo_mysql mysqli intl gd pgsql zip pdo_mysql pdo_pgsql mysqli intl
# Remove default nginx config # Remove default nginx config
RUN rm -rf /var/www/html \ RUN rm -rf /var/www/html \
+1 -1
View File
@@ -221,7 +221,7 @@ class DailyChangeTest extends TestCase
$second_transaction = Transaction::create([ $second_transaction = Transaction::create([
'symbol' => 'AAPL', 'symbol' => 'AAPL',
'portfolio_id' => $portfolio->id, 'portfolio_id' => $portfolio->id,
'date' => now()->subYears(3), 'date' => now()->subDays(1080), // 3 years
'quantity' => 1, 'quantity' => 1,
'cost_basis' => 39.89, 'cost_basis' => 39.89,
'transaction_type' => 'BUY', 'transaction_type' => 'BUY',