Doubts before upgrading

But what does it do:

php artisan migrate

I mean, if it’s a DB problem, what does php have to do with it?

I’m sorry if I’m saying something outrageous.

Deploying the application locally and exporting my current IN to import it locally is too much hassle for me. It is not easy as I have to investigate how to deploy IN on an Ubuntu (virtual machine) or on a Raspberry Pi.

When new features are added to the app they often require changes to the database to be supported. Running the migrate commands applies the latest changes to the database.

I will contact my hosting provider to see if they will allow me to execute the command somehow.

Do I have to execute it indicating the directory?

You need to run it in the root folder of the project

Hello again.

I am proposed by my hosting provider to use CRON tasks to execute the command.

Right now I am using a CRON every minute, I took the statement from another post.

Could you help me to create the statement I need to execute now?

Would it be something like this?

cd /path && /usr/bin/php artisan migrate >> /dev/null 2>&1



That looks correct, it needs to run every minute.

But this command should only be executed after updating the files and only once, right?

Not sure I understand, the cron should be configured to run every minute.

Let’s recap.

After overwriting the files and directories with the new version, I should run the php artisan migrate to migrate the DB.

As I don’t have access to the terminal of my web server, since it is a wordpress hosting, they propose me to use the CRON to execute this command.

My doubt is that this command must be executed only once, so my question is how to make the CRON to be executed only once, but now you tell me that it must be every minute.

Every minute I have executed the other CRON so that from the Invoice Ninja GUI the warning does not appear.

Sorry, I didn’t realize you were planning to use the cron to run the migrate command. I thought it was the regular cron. In that case it should only run once. If it runs more than once it won’t cause any problems.

Note: I believe this command requires confirmation, I’m not sure if it will work in the cron.

Could you help me to create the correct CRON statement?

I think the cron is correct I’m just not sure it will work, the migrate command isn’t meant to be run in a cron.

I have searched for information and indeed the php artisan migrate command needs confirmation, so the CRON would not work I think.

I have thought of another possible solution, see what you think.

I am now on version 5.5.28 and the problem is in the jump to the latest version 5.7.22.

What do you think about upgrading to an intermediate version 5.6.x for example and then try to jump to the last one? Or I will have the same problem and it is imperatively necessary to run the php artisan migrate?

I think it would be the same problem.

One option may be to temporarily change APP_ENV in the .env file to development so the app isn’t in production and won’t require confirmation.

I have changed the APP_ENV to development.

I have tried the statement in several ways but the result I get in a log file is this:


Laravel Framework 10.31.0

command [options] [arguments]

-h, --help Display help for the given command. When no command is given display help for the list command
-q, --quiet Do not output any message
-V, --version Display this application version
–ansi|–no-ansi Force (or disable --no-ansi) ANSI output
-n, --no-interaction Do not ask any interactive question
–env[=ENV] The environment the command should run under
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Available commands:
about Display basic information about your application
clear-compiled Remove the compiled class file
completion Dump the shell completion script
db Start a new database CLI session
docs Access the Laravel documentation
down Put the application into maintenance / demo mode
env Display the current framework environment
help Display help for a command
list List commands
migrate Run the database migrations
optimize Cache the framework bootstrap files
serve Serve the application on the PHP development server
tinker Interact with your application
up Bring the application out of maintenance mode
auth:clear-resets Flush expired password reset tokens
cache:clear Flush the application cache
cache:forget Remove an item from the cache
cache:prune-stale-tags Prune stale cache tags from the cache (Redis only)
cache:table Create a migration for the cache database table
channel:list List all registered private broadcast channels
config:cache Create a cache file for faster configuration loading
config:clear Remove the configuration cache file
config:show Display all of the values for a given configuration file
countries:migration Creates a migration following the Laravel-countries specifications.
db:monitor Monitor the number of connections on the specified database
db:seed Seed the database with records
db:show Display information about the given database
db:table Display information about the given database table
db:wipe Drop all tables, views, and types
env:decrypt Decrypt an environment file
env:encrypt Encrypt an environment file
event:cache Discover and cache the application’s events and listeners
event:clear Clear all cached events and listeners
event:generate Generate the missing events and listeners based on registration
event:list List the application’s events and listeners
key:generate Set the application key
lang:publish Publish all language files that are available for customization
make:cast Create a new custom Eloquent cast class
make:channel Create a new channel class
make:command Create a new Artisan command
make:component Create a new view component class
make:controller Create a new controller class
make:data Create a new data class
make:event Create a new event class
make:exception Create a new custom exception class
make:factory Create a new model factory
make:job Create a new job class
make:listener Create a new event listener class
make:mail Create a new email class
make:middleware Create a new middleware class
make:migration Create a new migration file
make:model Create a new Eloquent model class
make:notification Create a new notification class
make:observer Create a new observer class
make:policy Create a new policy class
make:provider Create a new service provider class
make:request Create a new form request class
make:resource Create a new resource
make:rule Create a new validation rule
make:scope Create a new scope class
make:seeder Create a new seeder class
make:test Create a new test class
make:view Create a new view
migrate:fresh Drop all tables and re-run all migrations
migrate:install Create the migration repository
migrate:refresh Reset and re-run all migrations
migrate:reset Rollback all database migrations
migrate:rollback Rollback the last database migration
migrate:status Show the status of each migration
model:prune Prune models that are no longer needed
model:show Show information about an Eloquent model
module:delete Delete a module from the application
module:disable Disable an array of modules.
module:dump Dump-autoload the specified module or for all module.
module:enable Enable the specified module.
module:install Install the specified module by given package name (vendor/name).
module:lang Check missing language keys in the specified module.
module:list Show list of all modules.
module:make Create a new module.
module:make-channel Create a new channel class for the specified module.
module:make-command Generate new Artisan command for the specified module.
module:make-component Create a new component-class for the specified module.
module:make-component-view Create a new component-view for the specified module.
module:make-controller Generate new restful controller for the specified module.
module:make-event Create a new event class for the specified module
module:make-factory Create a new model factory for the specified module.
module:make-job Create a new job class for the specified module
module:make-listener Create a new event listener class for the specified module
module:make-mail Create a new email class for the specified module
module:make-middleware Create a new middleware class for the specified module.
module:make-migration Create a new migration for the specified module.
module:make-model Create a new model for the specified module.
module:make-notification Create a new notification class for the specified module.
module:make-observer Create a new observer for the specified module.
module:make-policy Create a new policy class for the specified module.
module:make-provider Create a new service provider class for the specified module.
module:make-request Create a new form request class for the specified module.
module:make-resource Create a new resource class for the specified module.
module:make-rule Create a new validation rule for the specified module.
module:make-seed Generate new seeder for the specified module.
module:make-test Create a new test class for the specified module.
module:migrate Migrate the migrations from the specified module or from all modules.
module:migrate-fresh Drop all database tables and re-run all migrations
module:migrate-refresh Rollback & re-migrate the modules migrations.
module:migrate-reset Reset the modules migrations.
module:migrate-rollback Rollback the modules migrations.
module:migrate-status Status for all module migrations
module:model-show Show information about an Eloquent model in modules
module:publish Publish a module’s assets to the application
module:publish-config Publish a module’s config files to the application
module:publish-migration Publish a module’s migrations to the application
module:publish-translation Publish a module’s translations to the application
module:route-provider Create a new route service provider for the specified module.
module:seed Run database seeder from the specified module or from all modules.
module:setup Setting up modules folders for first use.
module:unuse Forget the used module with module:use
module:update Update dependencies for the specified module or for all modules.
module:use Use the specified module.
module:v6:migrate Migrate laravel-modules v5 modules statuses to v6.
ninja:backup-files Shift files between object storage locations
ninja:check-data Check/fix data
ninja:check-db Check MultiDB
ninja:create-account Create Single Account
ninja:create-single-account Create Single Sample Account
ninja:create-test-data Create Test Data
ninja:demo-mode Setup demo mode
ninja:design-update Update the system designs when changes are made.
ninja:import Import a v4 migration file
ninja:mobile-localization Generate mobile localization resources
ninja:old-import Massively import the migrations.
ninja:openapi Build OpenApi YAML
ninja:post-update Run basic upgrade commands
ninja:react Builds blade component for react includes
ninja:s3-cleanup Remove orphan folders/files
ninja:send-recurring Sends the recurring invoices
ninja:send-reminders Force send all reminders
ninja:send-test-emails Sends Test Emails to check templates
ninja:sync-users Syncs Invoice Ninja Users
ninja:translations Transform translations to json
ninja:type-check Check Settings Types
notifications:table Create a migration for the notifications table
optimize:clear Remove the cached bootstrap files
package:discover Rebuild the cached package manifest
queue:batches-table Create a migration for the batches database table
queue:clear Delete all of the jobs from the specified queue
queue:failed List all of the failed queue jobs
queue:failed-table Create a migration for the failed queue jobs database table
queue:flush Flush all of the failed queue jobs
queue:forget Delete a failed queue job
queue:listen Listen to a given queue
queue:monitor Monitor the size of the specified queues
queue:prune-batches Prune stale entries from the batches database
queue:prune-failed Prune stale entries from the failed jobs table
queue:restart Restart queue worker daemons after their current job
queue:retry Retry a failed queue job
queue:retry-batch Retry the failed jobs for a batch
queue:table Create a migration for the queue jobs database table
queue:work Start processing jobs on the queue as a daemon
route:cache Create a route cache file for faster route registration
route:clear Remove the route cache file
route:list List all registered routes
schedule:clear-cache Delete the cached mutex files created by scheduler
schedule:interrupt Interrupt the current schedule run
schedule:list List all scheduled tasks
schedule:run Run the scheduled commands
schedule:test Run a scheduled command
schedule:work Start the schedule worker
schema:dump Dump the given database schema
session:table Create a migration for the session database table
storage:link Create the symbolic links configured for the application
stub:publish Publish all stubs that are available for customization
vendor:publish Publish any publishable assets from vendor packages
view:cache Compile all of the application’s Blade templates
view:clear Clear all compiled view files
X-Powered-By: PHP/8.2.12
Content-type: text/html; charset=UTF-8

I’m doing something wrong in the sentence

cd /home/[path] && /usr/bin/php artisan migrate --no-interaction >> /home/[path]/cronlog.log

cd /home/[path] && /usr/bin/php artisan migrate >> /home/[path]/cronlog.log

cd /home/[path] && /usr/bin/php artisan migrate --force >> /home/[path]/cronlog.log

@david do you have any ideas?

Hello again.

I have finally decided to migrate my current Invoice Ninja from my web hosting to a raspberry pi 4 using docker.

I already have docker deployed and running.

Could you help me to migrate my configuration and my DB to the Raspberry?

What files should I import and where, as I see the directory is different.

Thanks again.

You can use mysqldump to transfer your database.

The main file to copy over is the .env file.

From the phpmyadmin of my hosting I have already exported the database in SQL.

How do I import it into the Invoice Ninja docker?

The .env of my hosting is different from the .env of docker (this one has the app key).

Shouldn’t I export/import the template I have designed for invoices and quotes as well?

Sorry, I don’t have much experience with Docker.

Keeping the original APP_KEY value is important, it’s used to encrypt/decrypt data.

The custom templates are stored in the database.