Sha256: 19334a74c67a945838d22a95a30585e9738b775acc2b86492e554bfe3df75d47

Contents?: true

Size: 1.25 KB

Versions: 17

Compression:

Stored size: 1.25 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

17 entries across 17 versions & 1 rubygems

Version Path
composite_primary_keys-11.3.1 test/setup.rb
composite_primary_keys-8.1.8 test/setup.rb
composite_primary_keys-12.0.0.rc5 test/setup.rb
composite_primary_keys-12.0.0.rc4 test/setup.rb
composite_primary_keys-12.0.0.rc3 test/setup.rb
composite_primary_keys-12.0.0.rc2 test/setup.rb
composite_primary_keys-12.0.0.rc1 test/setup.rb
composite_primary_keys-8.1.7 test/setup.rb
composite_primary_keys-11.2.0 test/setup.rb
composite_primary_keys-11.1.0 test/setup.rb
composite_primary_keys-11.0.3 test/setup.rb
composite_primary_keys-11.0.2 test/setup.rb
composite_primary_keys-10.0.5 test/setup.rb
composite_primary_keys-9.0.10 test/setup.rb
composite_primary_keys-11.0.1 test/setup.rb
composite_primary_keys-11.0.0 test/setup.rb
composite_primary_keys-10.0.4 test/setup.rb