Is it possible to create schemas automatically in the database when xampp is turning on? There is no information about it in the Laravel documentation, documentation says only how to do it manually by writing the command php artisan migrate.
Xampp includes a script called apache_startup.bat in the root directory, you can add the following line to it
c:\xampp\php\php.exe -f /path/to/laravel/app/artisan migrate
Then when the apache server starts, it should run that the equivalent of php artisan migrate to setup the database.
You can do php artisan make:migration [migration-name] - other than that, you have to fill the rest yourself.
Related
I created a sqlite using vim and it created database.sqlite.swp. Then i configure the .env DB_Connection to sqlite.
Afterwards, I run php artisan serve and php artisan migrate but i got error :
Database (C:Laravel/Project/database/database.sqlite) does not exist.
Vim v8.2
Laravel v4
Please help me :<
You have to create new file in this path (C:Laravel/Project/database/) and name it database.sqlite
It is not mentioned in the docs and in the CLI help, it says - Creates the Migration Repository.
What does that mean?
When I run thus command it says - database laravel not found.
Laravel creates a migrations table in your database to keep track of what migrations have already been ran on your database. If you run php artisan migrate:install, this table is created.
This table makes sure that when you run php artisan migrate, migrations that have already been ran on the database are not done again.
When migrating, this table is also created automatically, there is no need to run the install command beforehand.
The reason for your error is probably because you have not set the correct database credentials in either your .env file or config/database.php file.
To be able to run Browser tests directly in my IDE (without using the artisan dusk command), I want to run php artisan serve --env=dusk.local. While it indeed starts the local PHP server, it uses the wrong database. It uses the database specified in .env not the one in .env.dusk.local.
I ran php artisan cache:clear thousands of times, but it doesn't change anything.
Running things like php artisan migrate --env=... works.
Is there a way to achieve my goal without needing to rename my .env.dusk.local file to .env before each test?
This is a bug in Laravel 5.8: https://github.com/laravel/framework/issues/27828
There is currently no solution (other than downgrading to Laravel 5.7).
It has been fixed in the latest release 5.8.7.
I install laravel and create project.
I Configed configuration file database and create database in mysql(mysql runnig in wamp server).
I want use migrate for create table in mysql,but i should wait a lot of time and see error.
What shoud i do?
This could help you run these command in terminal:
php artisan migrate --force
The migrate:refresh will roll back all of your migrations then execute the migrate command.this will re-creates your entire database.
php artisan migrate:refresh
This will absolutely help you,run this command:
php artisan migrate:fresh
if it did't help please chick out this:
https://laravel.com/docs/5.7/migrations
Probably you entered your mysql Server credentials in the database config, but you have to edit the .env file. Values in there overwrite config settings.
sorry for silly question but I'm really facing problem. After migrating all the migration files. When I need another features for my project I have to make another table but When I'm going to migrate the new table using "php artisan migrate:rollback" or "php artisan migrate:rollback step=17" .... all the migration files are migrating this time too and I am losing all previous data. Then How can I migrate only the new one?
To migrate only new migrations is simple: php artisan migrate. The way the process works is that Laravel creates a table in your database called migrations. In that table are the names of the migrations that have been run already. If there are new migrations the above command will work.
You can read more about running migrations in the documentation.
To migrate any new migration created php artisan migrate is the artisan command.
To get the details of all commands php artisan is the artisan command.
To get the details of any specific command php artisan help command-name-here.
In the case of creating a new file, you only need to run php artisan migrate again.
If you want modify original migration file and migrate it again, you can use this package to migrate.
First, install package in your Laravel project:
composer require caloskao/migrate-specific
Register command at app/Console/Kernel.php :
protected $commands = [
\CalosKao\MigrateSpecific::class
];
Now, run this command to migrate your file
php artisan migrate:specific database/migrations/table.php