I have several databases that I need to apply migrations to. Is there a way to apply updates to all of them via Doctrine migrations?
I don't know if this is still relevant to you, but you can find answeres here:
Symfony Doctrine Migrations, how can I use multiple entity managers
Related
I am working on a smaller project. I have two tables e.g. properties and agents. One property can have many agents. How can I update data in both tables using one query?
Here is the link to update data in postgres How I can update one to many relation in Postgres?
Supabase uses postgrest under the hood for the RESTful api, currently the suggested solution there is to write an rpc() function and call that.
Alternatively, since Supabase is just PostgreSQL, you always have the option of connecting directly using any postgres client and using the postgres solution you mentioned in your question.
everyone. I use Symfony 4.2 and following database-first approach and have auto-generated entities; But then I need to do some changes in field definitions in entities but I don't want to affect the database structure. Everything works well but if I try to create a migration, doctrine includes all the differences in migrations, and I find no way to prevent this behaviour. I've tried schema_filter: ~^migration_versions$~ but somehow it doesn't help.
So the questions:
1) is it a normal application state on prod when column definitions slightly differ in database and entities?
2) how can I say to doctrine to ignore differences in some tables when creating migrations? Thanks.
When you run bin/console doctrine:migrations:diff it will generate a file in your src\Migrations\ directory. You can edit the generated file to remove whatever you don't want to change before you run bin/console doctrine:migrations:migrate.
I don't suggest doing this on a production server though, and especially if you do so then you should certainly have a backup of your database.
I have a database and I would like to generate migration based on tables that already exists.
How can I do that?
I am running linux ubuntu 16.10 + Mariadb and laravel 5.4
A quick Google shows many packages that will do just this sort of thing for you, like migrations-generator.
You'll probably want to go over any generated migrations as well just to make sure they match what you're after.
I am new to using Laravel, and I'm currently learning about Laravel's database migration and seeding features.
It's working with the command prompt, but I can migrate and seed in phpMyAdmin as well. What are the advantages and disadvantages of migrating and seeding within Laravel as opposed to phpMyAdmin?
From Laravel docs on Migrations & Seeding:
Migrations are a type of version control for your database. They allow a team to modify the database schema and stay up to date on the current schema state.
A simple search for why database migration also gives me some pretty decent results. One of the easiest to understand is a page by FlywayDB (I have no idea who they are until I search this term up):
Database migrations are a great way to regain control of this mess. They allow you to:
Recreate a database from scratch
Make it clear at all times what state a database is in
Migrate in a deterministic way from your current version of the database to a newer one
The illustration they made perhaps explain it more clearly, so you may want to check it out.
In my symfony project i need to generate schema from specific tables not all database tables ,so please tell the way to do if it is possible?
If you use the command build-schema you can generate a schema from the database that is configured for the project. The schema.yml in the config folder should contain all the tables, and you can delete the tables you do not need, and then use the commands build-model, build-form, and build-filters in order to create the classes for the remaining tables. This way, there will only be classes for the tables that you want.
Hope this helps!