Sha256: 7ce12ab49fdcbee932a8ba9ab6142ddb8e5be3259c403c985953460635949527

Contents?: true

Size: 1.2 KB

Versions: 87

Compression:

Stored size: 1.2 KB

Contents

# setup_db.rb
require 'dbi'

# Run "createdb cpk_test" first

teacher_to_school = %Q{
  create table teacher_to_school(
    schoolid varchar(8),
    teacherid varchar(8),
    datebegin date,
    teacherrole varchar(20),
    primary key (schoolid, teacherid)
  );

}

globe_teacher = %Q{
  create table globe_teacher(
    teacherid varchar(8) primary key,
    currentschoolid varchar(8),
    userid varchar(16)
  );

}

globe_school = %Q{
  create table globe_school(
    schoolid varchar(8) primary key,
    schoolname varchar(100) not null,
    city varchar(35) not null
  )

}

add_records = [
  "insert into globe_teacher values ('ZZGLOBEY', 'ZZGLOBE1',
'dberger');",
  "insert into globe_school values ('ZZCOUCAR', 'NCAR Foothills Lab',
'Boulder');",
  "insert into globe_school values ('ZZGLOBE1', 'The GLOBE Program',
'Boulder');",
  "insert into teacher_to_school values('ZZGLOBE1', 'ZZGLOBEY', '1-JUN-2010', 'GLOBE OFFICE');",
  "insert into teacher_to_school values('ZZCOUCAR', 'ZZGLOBEY', '1-AUG-2010', 'GLOBE Teacher');"
]

DBI.connect('dbi:Pg:cpk_test', 'postgres') do |dbh|
  dbh.execute(teacher_to_school)
  dbh.execute(globe_teacher)
  dbh.execute(globe_school)
  add_records.each{ |sql| dbh.execute(sql) }
end 

Version data entries

87 entries across 87 versions & 1 rubygems

Version Path
composite_primary_keys-9.0.9 test/setup.rb
composite_primary_keys-11.0.0.rc2 test/setup.rb
composite_primary_keys-10.0.3 test/setup.rb
composite_primary_keys-11.0.0.rc1 test/setup.rb
composite_primary_keys-11.0.0.beta4 test/setup.rb
composite_primary_keys-11.0.0.beta3 test/setup.rb
composite_primary_keys-11.0.0.beta2 test/setup.rb
composite_primary_keys-11.0.0.beta1 test/setup.rb
composite_primary_keys-10.0.2 test/setup.rb
composite_primary_keys-10.0.1 test/setup.rb
composite_primary_keys-9.0.8 test/setup.rb
composite_primary_keys-10.0.0 test/setup.rb
composite_primary_keys-9.0.7 test/setup.rb
composite_primary_keys-8.1.6 test/setup.rb
composite_primary_keys-9.0.6 test/setup.rb
composite_primary_keys-9.0.5 test/setup.rb
composite_primary_keys-8.1.5 test/setup.rb
composite_primary_keys-9.0.4 test/setup.rb
composite_primary_keys-9.0.2 test/setup.rb
composite_primary_keys-9.0.1 test/setup.rb