dev1234 dev1234 - 6 months ago 33
SQL Question

Yiic migration for multiple database

Is it possible to run Yiic migrate create command for multiple databases ?

I have a Multi-Tenant Data Architecture, one source code and multiple database for client. each client will use same source code and but a separate database.

Ex. Andrew.Digital.com, Samson.Digital.com will have two database but points to same source code.

So i just want to know is there any possibility to use Yiic migration for multiple databases ?

What is SAAS (Multi-Tenant) https://msdn.microsoft.com/en-us/library/aa479086.aspx

Answer

You can configure more than one connection on your protected/config/console.php

Then, when running the migration, specify the connection id

/yiic migrate --connectionID=db         # The default
/yiic migrate --connectionID=andrew     # connection andrew
/yiic migrate --connectionID=client3    # connection client3
Comments