PHP Developers Network
http://forums.devnetwork.net/

laravel: migrate table to specific database
http://forums.devnetwork.net/viewtopic.php?f=72&t=142058
Page 1 of 1

Author:  publicGenome [ Wed Dec 09, 2015 9:14 am ]
Post subject:  laravel: migrate table to specific database

Hello There,

I'm working on laravel4.2

I created a migration file as:
Syntax: [ Download ] [ Hide ]
php artisan migrate:make create_sample_group --create=sample_group --path=app/database/migrations/illumina/
 

Before running the above command I create folder illumina in app/migration

After running the migrate command, I can see file as 2015_12_09_084943_create_sample_group.php
That is today's name, etc

I make a, b, c changes for column names in it. And would like to create respective table which can be done by:

Syntax: [ Download ] [ Hide ]
artisan migrate
 

But I'd like to specify to which database laravel should create this table. Is there a way to do so?

My database.php looks like:
Syntax: [ Download ] [ Hide ]

'default' => 'alpha',

'connections' => array(
'alpha' => array(
            'driver' => 'mysql',
            'host' => 'localhost',
            'database' => 'alpha_1',
            'username' => 'root',
            'password' => '',
            'charset' => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix' => '',
        ),

        'pqr_1' => array(
            'driver' => 'mysql',
            'host' => 'localhost',
            'database' => 'pqr',
            'username' => 'root', //      
            'password' => '',
            'charset' => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix' => '',
        ),
//and so on multiple databases
////
)

 

I'd like to create table in database pqr_1

I don't see documentation of it at

http://laravel.com/docs/4.2/migrations# ... migrations
Looking forward for guidance.

Author:  publicGenome [ Wed Dec 09, 2015 10:15 am ]
Post subject:  Re: laravel: migrate table to specific database


Author:  Swhite [ Mon Feb 08, 2016 11:34 pm ]
Post subject:  Re: laravel: migrate table to specific database

Hey,I'm sharing a link just check this " http://www.sitepoint.com/laravel-migrations/ ".

Hope you find it relevant.
Good luck

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/