laravel-mysql-partition
laravel-mysql-partition copied to clipboard
Separate DB connections feature request
Hi I can't seem to create a partition by range on a separate DB connection e.g.
Schema::connection('tracking')->partitionByRange('tracking', 'UNIX_TIMESTAMP(created_at)', [
new Partition('p'.$twodaysago, Partition::RANGE_TYPE, $twodaysago),
new Partition('p'.$yesterday, Partition::RANGE_TYPE, $yesterday),
new Partition('p'.$today, Partition::RANGE_TYPE, $today),
new Partition('p'.$thenextday, Partition::RANGE_TYPE, $thenextday),
]);
gives the error:
Call to undefined method Illuminate\Database\Schema\MySqlBuilder::partitionByRange()
I'd say this would be a good feature to add if not yet implemented, as many using it will have a dedicated DB server. For me it means I'll have to remove the package and do it with a manual DB call.
Hey,
I work with multiple database access and the best way to work with this is to switch your default connection i.e. DB::setDefaultConnection($instance)
, do the transaction and then switch it back.
For migrations, you pass in the --database
flag at the end.