This commit is contained in:
hackerESQ
2024-09-09 14:49:34 -05:00
parent 6bb0ad4980
commit cf38f18085
4 changed files with 9 additions and 76 deletions
-60
View File
@@ -1,60 +0,0 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use Database\Seeders\MarketDataSeeder;
use Illuminate\Support\Facades\Artisan;
class SeedMarketData extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'seed:market-data
{--force : Will seed even if table already has data.}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Seeds baseline market data';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
if (
DB::table('market_data')->count() === 0
|| $this->option('force', false)
) {
Artisan::call('db:seed', [
'--class' => MarketDataSeeder::class,
]);
return;
}
$this->line('Skipped seeding market data... Table already has data!');
}
}
+1 -2
View File
@@ -2,7 +2,6 @@
namespace App\Console\Commands; namespace App\Console\Commands;
use App\Models\Holding;
use Illuminate\Console\Command; use Illuminate\Console\Command;
class SyncDailyChange extends Command class SyncDailyChange extends Command
@@ -38,6 +37,6 @@ class SyncDailyChange extends Command
*/ */
public function handle() public function handle()
{ {
// $this->line('test');
} }
} }
@@ -31,6 +31,11 @@ class CreateMarketDataTable extends Migration
$table->json('meta_data')->nullable(); $table->json('meta_data')->nullable();
$table->timestamps(); $table->timestamps();
}); });
Artisan::call('db:seed', [
'--class' => MarketDataSeeder::class,
'--force' => true
]);
} }
/** /**
+3 -14
View File
@@ -2,14 +2,6 @@
cd /var/www/app cd /var/www/app
if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS
OWNER=$(stat -f '%Su' storage)
else
# Linux
OWNER=$(stat -c '%U' storage)
fi
echo "====================== Running entrypoint script... ====================== " echo "====================== Running entrypoint script... ====================== "
if [ ! -f ".env" ]; then if [ ! -f ".env" ]; then
echo " > Ope, gotta create an .env file!" echo " > Ope, gotta create an .env file!"
@@ -24,9 +16,9 @@ echo "====================== Installing Composer dependencies... ==============
/usr/local/bin/composer install /usr/local/bin/composer install
echo "====================== Validating environment... ====================== " echo "====================== Validating environment... ====================== "
if [ "$OWNER" != "www-data" ]; then if [ $(stat -c '%U' .) != "www-data" ]; then
echo " > Setting correct permissions for storage directory..." echo " > Setting correct permissions for pwd..."
chown -R www-data:www-data storage chown -R www-data:www-data .
fi fi
if ( ! grep -q "^APP_KEY=" ".env" || grep -q "^APP_KEY=$" ".env"); then if ( ! grep -q "^APP_KEY=" ".env" || grep -q "^APP_KEY=$" ".env"); then
@@ -42,8 +34,5 @@ echo "====================== Installing NPM dependencies and building frontend..
echo "====================== Running migrations... ====================== " echo "====================== Running migrations... ====================== "
/usr/local/bin/php artisan migrate --force /usr/local/bin/php artisan migrate --force
echo "====================== Running seeders... ====================== "
/usr/local/bin/php artisan seed:market-data
echo "====================== Spinning up Supervisor daemon... ====================== " echo "====================== Spinning up Supervisor daemon... ====================== "
exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf