Re: Migrations with sharded databases question

2017-01-16 Thread Jeremy Evans
On Monday, January 16, 2017 at 7:37:49 AM UTC-8, Jay Danielian wrote:
>
> I've been able to successfuly setup my sharded databases and load records 
> into it with my custom sharding scheme. So far I run 
> Sequel::Migrator.apply(DB, './migrate') and it picks up my migration 
> scripts. In my migration script I am doing this:
>
> Sequel.migration do 
>   up do 
> DB.each_server do |db|
>   db.create_table(:blah) ... 
>end 
> end
>
>
> And it works great - however I notice that the schema_info table is only 
> in my :default database (the first shard if you will). Is this expected? My 
> table is created with the proper schema in the "second" database shard, and 
> read/writes work fine - so everything is working. Just curious if its 
> expected to only write out the schema_info table on one of the databases.
>

The way you are using the migrator is not the correct way, that's why you 
end up with the schema_info table in only one database.  The correct way to 
do this would be to just have create_table in the migration, and call the 
migrator separately for each shard.  You'll need to use the migrator API 
for this, bin/sequel doesn't support it.

Thanks,
Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sequel-talk+unsubscr...@googlegroups.com.
To post to this group, send email to sequel-talk@googlegroups.com.
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.


Migrations with sharded databases question

2017-01-16 Thread Jay Danielian
I've been able to successfuly setup my sharded databases and load records 
into it with my custom sharding scheme. So far I run 
Sequel::Migrator.apply(DB, './migrate') and it picks up my migration 
scripts. In my migration script I am doing this:

Sequel.migration do 
  up do 
DB.each_server do |db|
  db.create_table(:blah) ... 
   end 
end


And it works great - however I notice that the schema_info table is only in 
my :default database (the first shard if you will). Is this expected? My 
table is created with the proper schema in the "second" database shard, and 
read/writes work fine - so everything is working. Just curious if its 
expected to only write out the schema_info table on one of the databases.

Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sequel-talk+unsubscr...@googlegroups.com.
To post to this group, send email to sequel-talk@googlegroups.com.
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.