laravel change table in PHPMYADMIN without migration - database

I have several tables that I have created through migration. Then, what happens if I change the table structure directly from PHPMYADMIN without using migration? What if my backend team pulls my project, then runs the "php artisan migrate" command. Is the database on my backend team the same as the database that I have?

If you make changes through phpMyAdmin, these will only be visible to you. You should change the migrations, or if you can't change the original because you don't want to reset the database, you should create a new migration to alter the table. Check the documentation for altering tables here: https://laravel.com/docs/5.7/migrations#modifying-columns

Related

Symfony existing table error when updating database

I have the database entities in my Symfony application, I have created another table in the database and I want to download it as an entity in my program. When I execute the following line I get that there are tables that already exist.
php bin/console make:migration
How can I update the entities and create only the ones that are not there?

How to remove all migrations without unapplying them

I have a .NET Core Project with lots of migrations in it. I also have the database (given to me and not generated with migrations on my pc). now
When I try to add a migration I get an error that there are pending migrations and I first need to update database and I you can guess running update-database command gives me:
object ... already exists error
If I remove database update-database command will generate the whole database however there are lots of data in the database that creating data with migrations would wipe them out.
I thought of generating data script from database, then creating database with migrations and then running the script, but the data script is very large and running the script have lots of other issues.
I just need to remove the old migrations but not unapplying them (as it would also remove my tables from database).
And also note that there are no _MigrationHistory Table in the database
If there is no __MigrationHistory table in the database and you want to omit the migrations, you can also comment the Up and Down fields in the migration files and apply migration. It does not affect your database and only add migration record to __MigrationHistory table.
Note: This problem might occur sometimes and using the approach above most probably fix the problem without affecting data. There are of course some other workarounds that can be applied for such a kind of problem.

Update partial database from entity Migration - aspnet mvc

I have deleted and modified somes tables in database sqlserver manually, then I have deleted __MigrationHistory table...
Now, when i run "add-migration" command, it regenare commands for recreate entire structure of database, but I want to syncronize the structure from the model to database, without recreates all tables in database...
the comnand "add-migration -ignoreChanges" is not correct, because the
model of website is different from database, because i have manual
modified somes tables.....
is possibles?
thanks

Prevent docrine from updating schema on one database

I have a Symfony project using a MYSQL database. I setup a second entity manager which accesses a SQL Server database. I'd like the ability for Doctrine to read and write to both databases, which it can do now. But I'd like to prevent Doctrine from updating the database schema, if I were to make a change like that by myself.
Doctrine should not be able to add tables, remove columns, or change the name of columns in the SQL Server database. Doing so would break the legacy application that uses this database.
Is there some setting I can use to make sure the database schema won't change?

migrating database back to original database entity framework migrations

I have made some changes to a database using code first entity framework migrations (lets say db2).
I now want to revert the change made back to the original database. As we want to retain the data on the old database (db1) I cant simple clone it.
Can someone please confirm the right process to do this?
I am assuming I will need to perform a rollback on db2 back to the original state it was in when it was cloned from db1.
I would then switch context so I am pointing at db1.
I then add a migration to generate all the database changes.
I then perform update-database to run make the changes.
Is this correct?
I will then need to run a migration to br
You can use –TargetMigration parameter in order to migrate to a specific version:
Update-Database –TargetMigration: db1
More info.

Resources