I created three migrations with php artisan make:migration and after that I ran php artisan migrate. This command creating only one table in my database instead of 3.
Related
I'm using spatie/laravel-backup package in my laravel project
When I want to backup via command line everything works fine via command
php artisan backup:run
or
php artisan backup:run --only-db
or
php artisan backup:run --only-files
But when I execute the command from the controller by artisan::call('backup:run'), I have the following error:
Exception message: The dump process failed with exitcode 2 : Misuse of shell builtins : mysqldump: Got error: 2004: Can't create TCP/IP
socket (10106) when trying to connect
note: this error not shown with php artisan backup:run --only-files command
please any help!!
I was using sqlite and just tried to connect to my Mysql database by
changing the env.
php artisan migrate:fresh
Nothing Happened
Here's my .env:-
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=white
DB_USERNAME=root
DB_PASSWORD=
I tried deleting the sqlite file and now it shows me this error :- Database (/home/kabir/Desktop/White/database/database.sqlite) does not exist. (SQL: PRAGMA foreign_keys = ON;)
which is normal
Try clearing config and cache files.
In your terminal try
php artisan cache:clear
The solution to this situation is to run these commands:-
php artisan config:clear
php artisan cache:clear
i am trying to migrate my first migration in laravel 7 project i have created database in phpmyadmin. i have Laragon app for localServer, these are my .env code for database connection
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=portfolio-project
DB_USERNAME=root
DB_PASSWORD=
when i do php artisan migrate it tells me that migrations are migrated, but when i go to phpmyadmin for checking tables it says no tables in this database,
Is there any problem with my phpmyadmin?
O any issue in new version 7 of laravel?
because when i added a phpmyadmin to laragon app there was issue with login password of phpmyadmin,
default password was not working and then i think i edit of its files to make no password at login on phpmyadmin after that i just type root as use and login it works, other old version laravel pakgs are working but this new version of laravel is making this issue at php artisan migrate
Make sure that every time you change your .env file you also do the following commands to clear any cache and make sure you are using the latest changes :
php artisan config:clear
php artisan cache:clear
Also make sure that root has no password and you can login to phpmyadmin without one.
First, close the server and the cmd and start it again then run the following command:
php artisan config:clear
Then run one of these commands:
php artisan migrate:fresh
or
php artisan migrate:refresh
It will drop all tables and recreate them again with the new migrations.
Hope it helps :)
I've dropped my test database then I want to create new database using saved migrations:
2017_03_01_000000_create_api_table.php
2017_03_06_000000_create_beeline_calls.php
2017_03_13_000000_modify_beeline_emails.php
2017_03_14_000000_interactive_forms.php
2017_03_16_000000_model_instances.php
2017_03_24_000000_create_objects.php
2017_03_24_000001_create_objects_tables_v2.php
2017_03_24_000003_make_comments_without_users.php
2017_03_27_000000_add_processed_to_announcements.php
2017_03_29_000000_create_ads_channels.php
2017_03_29_000001_announcement_client.php
2017_04_06_000000_create_filters.php
2017_04_07_000000_create_new_input_types.php
When I run php artisan migrate --pretend
[Doctrine\DBAL\Schema\SchemaException]
There is no column with name 'creator_id' on table 'application_model_instance_announcement_comments'.
But first migration file to run is 2017_03_01_000000_create_api_table.php
Why does it run not from start? Database is empty, migrations table is empty.
As I understand Laravel should run migration files in alphabetical order.
To be able to perform php artisan migrate that table where you are creating the columns can't contain the same column names as in that migration. You must delete it first and with this command
php artisan migrate:refresh
you are doing exactly this
php artisan migrate:rollback
php artisan migrate
There are 2 commands in php artisan migrate:refresh
When changing something in migrations always run these commands:
php artisan cache:clear
php artisan view:clear
php artisan route:clear
composer dump-autoload
It will clear all old stuff and should run smoothly!
I am trying to create a "Basic Task List" according to the Laravel documentation. After I run "php artisan migrate", I can see that that my tables were migrated successfully according to the console, which is Git Bash.
In phpmyadmin, the following databases are visible:
homestead
information_schema
mysql
performance_schema
sys
However, I couldn't find my new "tasks" table anywhere in phpmyadmin. Where is my table located in mysql?
It is in the homestead database.
Check your .env and config/database.php files and you'll see how your database is set.