-2

Hello programmers from around the world.

I am trying to run a migration when a class is executed.

It is currently working like this: When the customer signs up, the class register my customer, so automatically, it should creates a database on my server and runs the migration, but dont run migration.

I need the migration run, but it asks for a console output.

I hope I explained myself well.

Could someone help me?

  • You could take a look at the Doctrine `Executor` class or run the console in a process. But why use a migration at all? Just run the queries directly. If you need further assistance, you should show the code you have so far. – msg Aug 05 '19 at 19:25
  • One database per customer !!! That has got to be a design error !!!!!!!! – RiggsFolly Aug 05 '19 at 19:36
  • @msg I'll have a look, but it would be better if it were for phinx. – Arthur Calazans Aug 05 '19 at 19:42
  • @RiggsFolly My application saves a lot of data per customer, it's a way to optimize. – Arthur Calazans Aug 05 '19 at 19:44

1 Answers1

0

I'm not really sure if migrations is the right concept to use here.

Migrations are kind of version control for a database. Each migration adds a new version. This is an iterative process.

Instead, what you seem to need is firing up a new database (schema) for each client. Not really sure why this makes sense and if it really is the best approach, but if so, you should probably just use a class/function that does this.

wolfgang_rt
  • 154
  • 1
  • 7