laravel sqlite

1. Run in terminal touch database/database.sqlite 2. APP_NAME="Digital Arts Multi-vendor Code and Music store" APP_ENV=local APP_KEY=base64:gpDb8Scl0VK+8FZuBsHHH9AWC97wJnI8XH760XCEDxw= APP_DEBUG=true APP_LOG_LEVEL=debug APP_URL=http://192.168.64.2/mart/3/ DB_CONNECTION=sqlite DB_DATABASE=../database/database.sqlite BROADCAST_DRIVER=log CACHE_DRIVER=file SESSION_DRIVER=file QUEUE_DRIVER=sync REDIS_HOST=127.0.0.1 REDIS_PASSWORD=null REDIS_PORT=6379 MAIL_DRIVER=smtp MAIL_HOST= MAIL_PORT= MAIL_USERNAME= MAIL_PASSWORD= MAIL_ENCRYPTION=tls MAIL_FROM_ADDRESS= MAIL_FROM_NAME="israel360 SHOP" MAILGUN_DOMAIN= MAILGUN_SECRET= ----------- In order to answer this part of the OP's question: "Any ideas how I can get artisan migrate to create an sqlite db in laravel 5?" In some cases where deployment and migrations need to be scripted I use a Service Provider to check the Sqlite DB exists and if not create it. Here are the steps: 1) Create a Provider and save it to app/Providers/SqliteServiceProvider.php [ //... /* * Application Service Providers... */ App\Providers\AppServiceProvider::class, App\Providers\AuthServiceProvider::class, // App\Providers\BroadcastServiceProvider::class, App\Providers\EventServiceProvider::class, App\Providers\RouteServiceProvider::class, App\Providers\SqliteServiceProvider::class, // <--- HERE ], 3) Add/replace the following to the 'connections' element of config/database.php 'sqlite' => [ 'driver' => 'sqlite', 'database' => env('DB_DATABASE', database_path('database.sqlite')), 'prefix' => '', 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true), ], 4) In my .env file I add this: DB_SQLITE_FILEPATH=/full/path/to/mysqlitefilename.sqlite ...but if you prefer you can skip this step and the DB will be created as database/database.sqlite. 5) Run your migration as usual and the sqlite file should be created then populated.

Post a comment

0 Comments