Created
August 17, 2012 06:32
-
-
Save SynnaxCrab/3376459 to your computer and use it in GitHub Desktop.
2057.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sequel' | |
require 'active_support/core_ext' | |
Sequel.extension :migration | |
DB = Sequel.connect(:adapter => 'jdbc', | |
:driver => 'com.microsoft.sqlserver.jdbc.SQLServerDriver', | |
:username => 'vulcan_dev', | |
:password => 'vulcan_dev', | |
#:username => 'read_only', | |
#:password => 'read_only', | |
:uri => 'jdbc:sqlserver://capricorn.office.vertive.com;database=vulcan_us_alex') | |
#:uri => 'jdbc:sqlserver://orion.office.vertive.com;database=vulcan_us') | |
#:uri => 'jdbc:sqlserver://capricorn.office.vertive.com;database=vulcan_us_test') | |
#:uri => 'jdbc:sqlserver://capricorn.office.vertive.com;database=vulcan_sales_master_test') | |
DB_HARPOON = Sequel.connect(:adapter => 'jdbc', | |
:driver => 'jdbc-mysql', | |
:host => 'harpoon', | |
:username => 'harpoonro', | |
:password => '04y)r>NU', | |
:uri => 'jdbc:mysql://starbuck.office.vertive.com/harpoon?tinyInt1isBit=false&zeroDateTimeBehavior=convertToNull') | |
DB_MASTER = Sequel.connect(:adapter => 'jdbc', | |
:driver => 'com.microsoft.sqlserver.jdbc.SQLServerDriver', | |
#:username => 'vulcan_dev', | |
#:password => 'vulcan_dev', | |
:username => 'read_only', | |
:password => 'read_only', | |
:uri => 'jdbc:sqlserver://orion.office.vertive.com;database=vulcan_master') | |
#:uri => 'jdbc:sqlserver://capricorn.office.vertive.com;database=vulcan_master_test') | |
def database_name db | |
db.synchronize do |conn| | |
conn.getCatalog | |
end | |
end | |
p 'connecting' | |
#p "from vulcan" | |
#DB[:email_subscriptions].columns.each do |c| | |
# p c | |
#end | |
#p "from master" | |
#DB_MASTER[:raw_email_subscriptions].columns.each do |c| | |
# p c | |
#end | |
p "Current DB version : " + DB[:schema_info].first[:version].to_s | |
p 'apply migration' | |
v = Sequel::Migrator.apply(DB, "./migrations", 314) | |
p "DB VERSION after migration: " + v.to_s | |
master_db = database_name(DB_MASTER) | |
#p DB_MASTER.schema(:raw_email_subscriptions) | |
#p DB[:email_subscriptions]. | |
# join(:vulcan__raw_email_subscriptions.qualify(master_db), :id => :email_subscriptions__id). | |
# update_sql({ | |
# :email_subscriptions__source_descriptor => :raw_email_subscriptions__source_descriptor, | |
# :email_subscriptions__mail_type => :raw_email_subscriptions__mail_type | |
# }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment