| 1 |
require 'rubygems' |
|---|
| 2 |
require_gem 'activerecord' |
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
=begin |
|---|
| 6 |
ActiveRecord::Base::establish_connection(:adapter => 'sqlserver', |
|---|
| 7 |
:dsn => 'sql_server_db', |
|---|
| 8 |
:mode => 'odbc', |
|---|
| 9 |
:username => 'sa', |
|---|
| 10 |
:password => 'my_password') |
|---|
| 11 |
=end |
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
ActiveRecord::Base::establish_connection(:adapter => 'postgresql', |
|---|
| 15 |
:database => 'ruby_development', |
|---|
| 16 |
:host => 'localhost', |
|---|
| 17 |
:username => 'postgres', |
|---|
| 18 |
:password => 'postgres') |
|---|
| 19 |
|
|---|
| 20 |
if ActiveRecord::Base.connection.supports_migrations? |
|---|
| 21 |
ActiveRecord::Base.connection.create_table 'NowPlaying', :id => false do |t| |
|---|
| 22 |
t.column "NPId", :primary_key |
|---|
| 23 |
t.column "EPlayListId", :integer |
|---|
| 24 |
t.column "EBubbleId", :integer |
|---|
| 25 |
t.column "ETrackId", :integer |
|---|
| 26 |
t.column "EStoreId", :integer |
|---|
| 27 |
t.column "PlayedDate", :datetime |
|---|
| 28 |
t.column "ContentType", :integer, :default => 1 |
|---|
| 29 |
end |
|---|
| 30 |
else |
|---|
| 31 |
ActiveRecord::Base.connection.execute( |
|---|
| 32 |
%{CREATE TABLE NowPlaying |
|---|
| 33 |
( |
|---|
| 34 |
"NPId" integer, |
|---|
| 35 |
"EPlayListId" integer, |
|---|
| 36 |
"EBubbleId" integer, |
|---|
| 37 |
"ETrackId" integer, |
|---|
| 38 |
"EStoreId" integer, |
|---|
| 39 |
"PlayedDate" date, |
|---|
| 40 |
"ContentType" integer DEFAULT 1 |
|---|
| 41 |
)}) |
|---|
| 42 |
|
|---|
| 43 |
end |
|---|