activerecord-peoplesoft_models 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +16 -0
- data/.travis.yml +5 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +153 -0
- data/Rakefile +8 -0
- data/activerecord-peoplesoft_models.gemspec +28 -0
- data/console +3 -0
- data/lib/activerecord-peoplesoft_models.rb +1 -0
- data/lib/peoplesoft_models/base.rb +11 -0
- data/lib/peoplesoft_models/effective_scope.rb +62 -0
- data/lib/peoplesoft_models/field.rb +9 -0
- data/lib/peoplesoft_models/record.rb +55 -0
- data/lib/peoplesoft_models/version.rb +3 -0
- data/lib/peoplesoft_models.rb +17 -0
- data/test/config/database.example.yml +7 -0
- data/test/effective_scope_test.rb +60 -0
- data/test/fake_peoplesoft.rb +12 -0
- data/test/fake_peoplesoft.sql +225 -0
- data/test/field_test.rb +10 -0
- data/test/record_keys_test.rb +26 -0
- data/test/record_test.rb +61 -0
- data/test/test_helper.rb +23 -0
- metadata +159 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: dce9b6270234a91ace6d2eedd92aec2be9c65b32
|
4
|
+
data.tar.gz: 427bfc9074b0dc5bf9a0f45e6f5f2533cb53c471
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 86bf5ab3d3d37816f0fa55efcdbc74dc7d942d33942294d2ce6b52b2a5204dcce38b1b7adbf5b0cfad8c58a806203084b151a554b723a8c9ab8182f702ada870
|
7
|
+
data.tar.gz: b9383b8f2048c6b635e4be5a1a28256f5e4896731caa85bbd0d661417e0fc226b4abe3fa6d15d9bd9fb3a201c4cf710c4311e56a85305f239fcf7ce8b7cd2668
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Chris Dinger
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,153 @@
|
|
1
|
+
# Peoplesoft Models for ActiveRecord ![Build Status](https://travis-ci.org/cdinger/activerecord-peoplesoft_models.svg)
|
2
|
+
|
3
|
+
This Rubygem provides an easy way to build ActiveRecord models for reading
|
4
|
+
data from a PeopleSoft database.
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'activerecord-peoplesoft_models', '~> 1.0.0'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
|
16
|
+
$ bundle
|
17
|
+
|
18
|
+
Or install it yourself as:
|
19
|
+
|
20
|
+
$ gem install activerecord-peoplesoft_models
|
21
|
+
|
22
|
+
## Versions
|
23
|
+
|
24
|
+
- Version 1.x works with ActiveRecord 4.2
|
25
|
+
- Version 0.x works with ActiveRecord 4.1
|
26
|
+
|
27
|
+
## Usage
|
28
|
+
|
29
|
+
PeoplesoftModels works by dynamically constructing ActiveRecord classes for
|
30
|
+
accessing PeopleSoft tables. The model names are created under the
|
31
|
+
`PeoplesoftModels` namespace.
|
32
|
+
|
33
|
+
You can use these models directly:
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
PeoplesoftModels::AcadSubplnTbl.first
|
37
|
+
```
|
38
|
+
|
39
|
+
Or subclass them to add your own associations, business logic, or just a more
|
40
|
+
meaningful name:
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
class Minor < PeoplesoftModels::AcadSubplnTbl
|
44
|
+
end
|
45
|
+
```
|
46
|
+
|
47
|
+
These classes:
|
48
|
+
|
49
|
+
- set the table name
|
50
|
+
- set the primary keys
|
51
|
+
- include an `effective` scope (if the table is effective dated)
|
52
|
+
|
53
|
+
```ruby
|
54
|
+
Minor.table_name
|
55
|
+
=> "PS_ACAD_SUBPLN_TBL"
|
56
|
+
|
57
|
+
Minor.primary_keys
|
58
|
+
=> ["institution", "acad_plan", "acad_sub_plan", "effdt"]
|
59
|
+
|
60
|
+
Minor.effective.to_sql
|
61
|
+
=> "SELECT \"PS_ACAD_SUBPLN_TBL\".* FROM \"PS_ACAD_SUBPLN_TBL\" INNER JOIN (SELECT \"PS_ACAD_SUBPLN_TBL\".\"INSTITUTION\", \"PS_ACAD_SUBPLN_TBL\".\"ACAD_PLAN\", \"PS_ACAD_SUBPLN_TBL\".\"ACAD_SUB_PLAN\", MAX(\"PS_ACAD_SUBPLN_TBL\".\"EFFDT\") AS effdt FROM \"PS_ACAD_SUBPLN_TBL\" WHERE (\"PS_ACAD_SUBPLN_TBL\".\"EFFDT\" <= TO_DATE('2014-12-03','YYYY-MM-DD HH24:MI:SS')) GROUP BY institution, acad_plan, acad_sub_plan) EFF_KEYS_PS_ACAD_SUBPLN_TBL ON \"PS_ACAD_SUBPLN_TBL\".\"INSTITUTION\" = EFF_KEYS_PS_ACAD_SUBPLN_TBL.\"INSTITUTION\" AND \"PS_ACAD_SUBPLN_TBL\".\"ACAD_PLAN\" = EFF_KEYS_PS_ACAD_SUBPLN_TBL.\"ACAD_PLAN\" AND \"PS_ACAD_SUBPLN_TBL\".\"ACAD_SUB_PLAN\" = EFF_KEYS_PS_ACAD_SUBPLN_TBL.\"ACAD_SUB_PLAN\" AND \"PS_ACAD_SUBPLN_TBL\".\"EFFDT\" = EFF_KEYS_PS_ACAD_SUBPLN_TBL.\"EFFDT\""
|
62
|
+
```
|
63
|
+
|
64
|
+
## `effective` scope
|
65
|
+
|
66
|
+
The `effective` scope, without arguments, will return only rows that are
|
67
|
+
effective as of today. This scope also accepts a date, which will return rows
|
68
|
+
that are effective as of that date.
|
69
|
+
|
70
|
+
## Example
|
71
|
+
|
72
|
+
```ruby
|
73
|
+
class College < PeoplesoftModels::AcadProgTbl
|
74
|
+
end
|
75
|
+
|
76
|
+
class EnrolledCollege < PeoplesoftModels::AcadProg
|
77
|
+
belongs_to :college, -> { effective }, primary_key: College.primary_key, foreign_key: College.primary_key
|
78
|
+
end
|
79
|
+
|
80
|
+
class Student < PeoplesoftModels::Person
|
81
|
+
has_many :enrolled_colleges, -> { effective }, primary_key: self.primary_key, foreign_key: self.primary_key
|
82
|
+
has_many :colleges, through: :enrolled_colleges
|
83
|
+
end
|
84
|
+
|
85
|
+
student = Student.where(emplid: "1234567").first
|
86
|
+
student.colleges
|
87
|
+
```
|
88
|
+
|
89
|
+
## Using a different database connection
|
90
|
+
|
91
|
+
The `PeoplesoftModels::Base` class exists only as a convenient point for
|
92
|
+
changing the database connection used for accessing PeopleSoft tables. To use a
|
93
|
+
different connection, define an initializer in your app like this:
|
94
|
+
|
95
|
+
```ruby
|
96
|
+
# config/initializers/peoplesoft_models.rb
|
97
|
+
PeoplesoftModels::Base.establish_connection :"peoplesoft_#{Rails.env}"
|
98
|
+
```
|
99
|
+
|
100
|
+
## Schema prefixing
|
101
|
+
|
102
|
+
The `PeoplesoftModels::Base` class can also be configured to prefix the
|
103
|
+
`table_name` of any its subclassed models with the defined schema.
|
104
|
+
|
105
|
+
If your database setup requires you to prefix your tables like, say
|
106
|
+
`HCM.PS_JOB`, you can do this in an intitializer:
|
107
|
+
|
108
|
+
```ruby
|
109
|
+
# config/initializers/peoplesoft_models.rb
|
110
|
+
PeoplesoftModels::Base.schema_name = "HCM"
|
111
|
+
```
|
112
|
+
|
113
|
+
That'll cause any of its models to automatically prepend `HCM` like so:
|
114
|
+
|
115
|
+
```ruby
|
116
|
+
PeoplesoftModels::Job.table_name
|
117
|
+
=> "HCM.PS_JOB"
|
118
|
+
```
|
119
|
+
|
120
|
+
## Required table permissions
|
121
|
+
|
122
|
+
This gem uses PeopleSoft's `PSRECDEFN` and `PSRECFIELD` tables to lookup up table
|
123
|
+
metadata. If access to your PeopleSoft instance is restricted, be sure to ask
|
124
|
+
for access to these tables.
|
125
|
+
|
126
|
+
## Tests
|
127
|
+
|
128
|
+
`bundle exec rake test` runs the test suite. By default, tests that need
|
129
|
+
to hit a database run in an in-memory sqlite3 database.
|
130
|
+
|
131
|
+
You can optionally define other connections in `test/config/database.yml` and
|
132
|
+
use them by referencing a connection in the `DATABASE` environment variable.
|
133
|
+
Tests that alter the database are skipped if you specify a different
|
134
|
+
connection.
|
135
|
+
|
136
|
+
`DATABASE=peoplesoft_dev bundle exec rake test`
|
137
|
+
|
138
|
+
There's also a console available if you want to poke around a real instance of
|
139
|
+
PeopleSoft:
|
140
|
+
|
141
|
+
`DATABASE=peoplesoft_dev ./console`
|
142
|
+
|
143
|
+
## Motivation and principles
|
144
|
+
|
145
|
+
This library is the third crack at trying to solve this problem. The first two
|
146
|
+
iterations where huge, complex, and difficult to maintain. They required
|
147
|
+
the explicit definition of each individual model/keys and they required the
|
148
|
+
understanding of a thick layer of configuration in order to use them.
|
149
|
+
|
150
|
+
This take aims for simplicity. This thing is less than 100 lines of code and it
|
151
|
+
shouldn't need to grow much bigger than that. There's no wild configuration and
|
152
|
+
minimal magic. The goal is to do one thing, do it well, and get out of the
|
153
|
+
developer's way.
|
data/Rakefile
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'peoplesoft_models/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "activerecord-peoplesoft_models"
|
8
|
+
spec.version = PeoplesoftModels::VERSION
|
9
|
+
spec.authors = ["Chris Dinger"]
|
10
|
+
spec.email = ["ding0057@umn.edu"]
|
11
|
+
spec.summary = %q{ActiveRecord models for working with PeopleSoft tables}
|
12
|
+
spec.description = %q{}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency "composite_primary_keys", "~> 8.0"
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
24
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
25
|
+
spec.add_development_dependency "sqlite3", "~> 1.3.10"
|
26
|
+
spec.add_development_dependency "activerecord-oracle_enhanced-adapter", "~> 1.5"
|
27
|
+
spec.add_development_dependency "ruby-oci8", "~> 2.1" unless RUBY_PLATFORM == "java" || !ENV["SKIP_OCI8"].nil?
|
28
|
+
end
|
data/console
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'peoplesoft_models'
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# This base class exists to provide a point to alter the database connection
|
2
|
+
# that a developer is using to connect to PeopleSoft tables. All generated
|
3
|
+
# models inherit from this class instead of ActiveRecord::Base.
|
4
|
+
#
|
5
|
+
module PeoplesoftModels
|
6
|
+
class Base < ActiveRecord::Base
|
7
|
+
cattr_accessor :schema_name
|
8
|
+
|
9
|
+
self.abstract_class = true
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
module PeoplesoftModels
|
2
|
+
module EffectiveScope
|
3
|
+
COLUMNS = ["effdt", "effseq"]
|
4
|
+
|
5
|
+
def effective(as_of = Date.today)
|
6
|
+
table = self.arel_table
|
7
|
+
eff_keys = self.effective_key_values(as_of).as(eff_keys_relation_alias)
|
8
|
+
join_conditions = self.primary_keys.map { |key| table[key].eq(eff_keys[key]) }.reduce(:and)
|
9
|
+
|
10
|
+
self.joins("INNER JOIN #{eff_keys.to_sql} ON #{join_conditions.to_sql}")
|
11
|
+
end
|
12
|
+
|
13
|
+
def effective_key_values(as_of = Date.today)
|
14
|
+
if self.effective_keys.include?("effseq")
|
15
|
+
self.effseq_values
|
16
|
+
else
|
17
|
+
self.effdt_values
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def effdt_values(as_of = Date.today)
|
22
|
+
table = self.arel_table
|
23
|
+
columns = self.non_effective_keys + [table[:effdt].maximum.as("effdt")]
|
24
|
+
|
25
|
+
self.unscoped
|
26
|
+
.select(columns)
|
27
|
+
.where(table[:effdt].lteq(as_of))
|
28
|
+
.group(self.non_effective_keys)
|
29
|
+
end
|
30
|
+
|
31
|
+
def effseq_values(as_of = Date.today)
|
32
|
+
table = self.arel_table
|
33
|
+
effdt_keys = self.effdt_values(as_of).as(effdt_relation_alias)
|
34
|
+
join_columns = self.primary_keys - ["effseq"]
|
35
|
+
columns = join_columns + [table[:effseq].maximum.as("effseq")]
|
36
|
+
join_conditions = join_columns.map { |key| table[key].eq(effdt_keys[key]) }.reduce(:and)
|
37
|
+
|
38
|
+
self.unscoped
|
39
|
+
.select(join_columns + [table[:effseq].maximum.as("effseq")])
|
40
|
+
.joins("INNER JOIN #{effdt_keys.to_sql} ON #{join_conditions.to_sql}")
|
41
|
+
.group(join_columns.map { |key| table[key] })
|
42
|
+
end
|
43
|
+
|
44
|
+
def effective_keys
|
45
|
+
self.primary_keys & COLUMNS
|
46
|
+
end
|
47
|
+
|
48
|
+
def non_effective_keys
|
49
|
+
self.primary_keys - COLUMNS
|
50
|
+
end
|
51
|
+
|
52
|
+
private
|
53
|
+
|
54
|
+
def eff_keys_relation_alias
|
55
|
+
"EFF_KEYS_#{self.table_name.gsub(/^.*\./, "")}"
|
56
|
+
end
|
57
|
+
|
58
|
+
def effdt_relation_alias
|
59
|
+
"EFFDT_#{self.table_name.gsub(/^.*\./, "")}"
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require_relative "effective_scope"
|
2
|
+
|
3
|
+
module PeoplesoftModels
|
4
|
+
class Record < Base
|
5
|
+
self.primary_key = "recname"
|
6
|
+
|
7
|
+
has_many :fields, class_name: "Field",
|
8
|
+
primary_key: self.primary_key,
|
9
|
+
foreign_key: self.primary_key
|
10
|
+
|
11
|
+
def self.table_name
|
12
|
+
[self.schema_name, "PSRECDEFN"].compact.join(".")
|
13
|
+
end
|
14
|
+
|
15
|
+
# A record's table name "PS_" + the record name unless it's specified in
|
16
|
+
# the `sqltablename` field.
|
17
|
+
# http://www.go-faster.co.uk/peopletools/psrecdefn.htm
|
18
|
+
#
|
19
|
+
def table_name
|
20
|
+
@table_name ||= begin
|
21
|
+
schema = self.class.schema_name
|
22
|
+
table = self.sqltablename.blank? ? "PS_#{self.recname}" : self.sqltablename
|
23
|
+
[schema, table].compact.join(".")
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
# The useedit field holds many values that you can get from the stored
|
28
|
+
# integer by applying bit masks. `useedit & 1` determines whether or not a
|
29
|
+
# field is part of the primary key. This operation would be marginally
|
30
|
+
# faster on the database, but doing it in Ruby let's us avoid handling
|
31
|
+
# different syntaxes for the bitwise AND.
|
32
|
+
# http://www.go-faster.co.uk/peopletools/useedit.htm
|
33
|
+
#
|
34
|
+
def keys
|
35
|
+
@keys ||= fields.order(:fieldnum).select do |field|
|
36
|
+
field.useedit & 1 == 1
|
37
|
+
end.map do |field|
|
38
|
+
field.fieldname.downcase
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def effective_dated?
|
43
|
+
@effective_dated ||= self.keys.include?("effdt")
|
44
|
+
end
|
45
|
+
|
46
|
+
def to_model
|
47
|
+
return @model if defined? @model
|
48
|
+
@model = Class.new(Base)
|
49
|
+
@model.table_name = self.table_name
|
50
|
+
@model.primary_keys = self.keys
|
51
|
+
@model.extend(EffectiveScope) if self.effective_dated?
|
52
|
+
@model
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require "composite_primary_keys"
|
2
|
+
require "peoplesoft_models/base"
|
3
|
+
require "peoplesoft_models/version"
|
4
|
+
require "peoplesoft_models/record"
|
5
|
+
require "peoplesoft_models/field"
|
6
|
+
|
7
|
+
module PeoplesoftModels
|
8
|
+
def self.const_missing(name)
|
9
|
+
record_name = name.to_s.demodulize.underscore.upcase
|
10
|
+
|
11
|
+
begin
|
12
|
+
const_set(name, Record.find(record_name).to_model)
|
13
|
+
rescue ActiveRecord::RecordNotFound
|
14
|
+
super(name)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class EffectiveScopeTest < Minitest::Test
|
4
|
+
def test_no_effective_scope_on_non_effective_model
|
5
|
+
assert(!PeoplesoftModels::Person.methods.include?(:effective))
|
6
|
+
end
|
7
|
+
|
8
|
+
def test_effective_scope_on_effdt_model
|
9
|
+
skip_if_using_real_peoplsoft
|
10
|
+
|
11
|
+
model = PeoplesoftModels::AcadProgTbl
|
12
|
+
effdt = Date.today
|
13
|
+
attributes = {institution: 'ASDF', acad_prog: 'BLAH'}
|
14
|
+
|
15
|
+
assert_equal(0, model.count)
|
16
|
+
|
17
|
+
model.create(attributes.merge({effdt: effdt - 1.days}))
|
18
|
+
model.create(attributes.merge({effdt: effdt}))
|
19
|
+
model.create(attributes.merge({effdt: effdt + 1.day}))
|
20
|
+
|
21
|
+
assert_equal(1, model.effective.count)
|
22
|
+
|
23
|
+
effective_row = model.effective.first
|
24
|
+
|
25
|
+
assert_equal(effdt, effective_row.effdt)
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_effective_scope_on_effseq_model
|
29
|
+
skip_if_using_real_peoplsoft
|
30
|
+
|
31
|
+
model = PeoplesoftModels::AcadProg
|
32
|
+
effdt = Date.today
|
33
|
+
attributes = {emplid: '123', acad_career: 'A', stdnt_car_nbr: 1, effseq: 0}
|
34
|
+
|
35
|
+
assert_equal(0, model.count)
|
36
|
+
|
37
|
+
model.create(attributes.merge({effdt: effdt - 3.days}))
|
38
|
+
model.create(attributes.merge({effdt: effdt - 3.days, effseq: 1}))
|
39
|
+
model.create(attributes.merge({effdt: effdt - 3.days, effseq: 2}))
|
40
|
+
model.create(attributes.merge({effdt: effdt}))
|
41
|
+
model.create(attributes.merge({effdt: effdt, effseq: 1}))
|
42
|
+
model.create(attributes.merge({effdt: effdt + 1.day}))
|
43
|
+
|
44
|
+
assert_equal(1, model.effective.count)
|
45
|
+
|
46
|
+
effective_row = model.effective.first
|
47
|
+
|
48
|
+
assert_equal(effdt, effective_row.effdt)
|
49
|
+
assert_equal(1, effective_row.effseq)
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_generated_table_aliases_with_schema_prefix
|
53
|
+
model = PeoplesoftModels::AcadProg
|
54
|
+
|
55
|
+
model.stub(:table_name, "SOME_SCHEMA.PS_ACAD_PROG") do
|
56
|
+
refute(model.send(:eff_keys_relation_alias).include?("."))
|
57
|
+
refute(model.send(:effdt_relation_alias).include?("."))
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class FakePeoplesoft
|
2
|
+
def self.create!
|
3
|
+
create_tables
|
4
|
+
end
|
5
|
+
|
6
|
+
def self.create_tables
|
7
|
+
statements = IO.read(File.join(File.dirname(__FILE__), 'fake_peoplesoft.sql')).split(';')
|
8
|
+
statements.each do |statement|
|
9
|
+
PeoplesoftModels::Base.connection.execute(statement) unless statement.blank?
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,225 @@
|
|
1
|
+
create table PSRECDEFN (
|
2
|
+
recname varchar2(15),
|
3
|
+
sqltablename varchar2(18)
|
4
|
+
);
|
5
|
+
create table PSRECFIELD (
|
6
|
+
recname varchar2(15),
|
7
|
+
fieldname varchar2(18),
|
8
|
+
fieldnum integer,
|
9
|
+
edittable varchar2(15),
|
10
|
+
useedit integer
|
11
|
+
);
|
12
|
+
create table PS_ACAD_PROG (
|
13
|
+
emplid varchar2(11),
|
14
|
+
acad_career varchar2(4),
|
15
|
+
stdnt_car_nbr integer,
|
16
|
+
effdt date,
|
17
|
+
effseq integer,
|
18
|
+
institution varchar2(5),
|
19
|
+
acad_prog varchar2(5),
|
20
|
+
prog_status varchar2(4),
|
21
|
+
prog_action varchar2(4),
|
22
|
+
action_dt date,
|
23
|
+
prog_reason varchar2(4),
|
24
|
+
admit_term varchar2(4),
|
25
|
+
exp_grad_term varchar2(4),
|
26
|
+
req_term varchar2(4),
|
27
|
+
acad_load_appr varchar2(1),
|
28
|
+
campus varchar2(5),
|
29
|
+
degr_chkout_stat varchar2(2),
|
30
|
+
completion_term varchar2(4),
|
31
|
+
acad_prog_dual varchar2(5),
|
32
|
+
joint_prog_appr varchar2(1),
|
33
|
+
adm_appl_nbr varchar2(8),
|
34
|
+
appl_prog_nbr integer,
|
35
|
+
data_from_adm_appl varchar2(1)
|
36
|
+
);
|
37
|
+
create table PS_ACAD_PROG_TBL (
|
38
|
+
institution varchar2(5),
|
39
|
+
acad_prog varchar2(5),
|
40
|
+
effdt date,
|
41
|
+
eff_status varchar2(1),
|
42
|
+
descr varchar2(30),
|
43
|
+
descrshort varchar2(10),
|
44
|
+
acad_career varchar2(4),
|
45
|
+
acad_calendar_id varchar2(4),
|
46
|
+
advisor_edit varchar2(1),
|
47
|
+
level_load_rule varchar2(5),
|
48
|
+
acad_group varchar2(5),
|
49
|
+
acad_plan varchar2(10),
|
50
|
+
campus varchar2(5),
|
51
|
+
first_term_valid varchar2(4),
|
52
|
+
car_ptr_exc_rule varchar2(10),
|
53
|
+
car_ptr_exc_fg varchar2(1),
|
54
|
+
fa_primacy_nbr integer,
|
55
|
+
fa_eligibility varchar2(1),
|
56
|
+
prog_norm_compltn integer,
|
57
|
+
residency_req varchar2(1),
|
58
|
+
cip_code varchar2(13),
|
59
|
+
hegis_code varchar2(8),
|
60
|
+
crse_count_enrl varchar2(1),
|
61
|
+
crse_count_min integer,
|
62
|
+
acad_org varchar2(10),
|
63
|
+
split_owner varchar2(1),
|
64
|
+
acad_prog_dual varchar2(5),
|
65
|
+
grading_scheme varchar2(3),
|
66
|
+
grading_basis varchar2(3),
|
67
|
+
grade_transfer varchar2(3),
|
68
|
+
transcript_level varchar2(2),
|
69
|
+
acad_stdng_rule varchar2(10),
|
70
|
+
assoc_prog_as varchar2(1),
|
71
|
+
calc_as_batch_only varchar2(1),
|
72
|
+
obey_fully_grd_as varchar2(1),
|
73
|
+
excl_trm_cat_as_1 varchar2(1),
|
74
|
+
excl_trm_cat_as_2 varchar2(1),
|
75
|
+
excl_trm_cat_as_3 varchar2(1),
|
76
|
+
honor_award_rule varchar2(10),
|
77
|
+
assoc_prog_ha varchar2(1),
|
78
|
+
calc_ha_batch_only varchar2(1),
|
79
|
+
obey_fully_grd_ha varchar2(1),
|
80
|
+
excl_trm_cat_ha_1 varchar2(1),
|
81
|
+
excl_trm_cat_ha_2 varchar2(1),
|
82
|
+
excl_trm_cat_ha_3 varchar2(1),
|
83
|
+
honor_dt_fg varchar2(4),
|
84
|
+
incomplete_grade varchar2(3),
|
85
|
+
lapse_grade varchar2(1),
|
86
|
+
lapse_to_grade varchar2(3),
|
87
|
+
lapse_days integer,
|
88
|
+
lapse_note_id varchar2(4),
|
89
|
+
print_lapse_date varchar2(1),
|
90
|
+
cmpltd_note_id varchar2(4),
|
91
|
+
print_cmpltd_date varchar2(1),
|
92
|
+
repeat_rule varchar2(10),
|
93
|
+
repeat_grd_ck varchar2(1),
|
94
|
+
cancel_reason varchar2(4),
|
95
|
+
wd_wo_pen_reason varchar2(4),
|
96
|
+
wd_w_pen_grd_bas varchar2(3),
|
97
|
+
wd_w_pen_grade varchar2(3),
|
98
|
+
wd_w_pen2_grade varchar2(3),
|
99
|
+
wd_w_pen2_grd_bas varchar2(3),
|
100
|
+
drop_ret_rsn varchar2(4),
|
101
|
+
drop_pen_grade varchar2(3),
|
102
|
+
drop_pen_grade_2 varchar2(3),
|
103
|
+
drop_pen_grd_bas varchar2(3),
|
104
|
+
drop_pen_grd_bas_2 varchar2(3),
|
105
|
+
oee_ind varchar2(1),
|
106
|
+
repeat_enrl_ctl varchar2(1),
|
107
|
+
repeat_enrl_susp varchar2(1),
|
108
|
+
repeat_grd_susp varchar2(1),
|
109
|
+
repeat_crse_error varchar2(1)
|
110
|
+
);
|
111
|
+
create table PS_PERSON (
|
112
|
+
emplid varchar2(11),
|
113
|
+
birthdate date,
|
114
|
+
birthplace varchar2(30),
|
115
|
+
birthcountry varchar2(3),
|
116
|
+
birthstate varchar2(6),
|
117
|
+
dt_of_death date,
|
118
|
+
last_child_upddtm date
|
119
|
+
);
|
120
|
+
|
121
|
+
insert into PSRECDEFN (RECNAME,SQLTABLENAME) values ('ACAD_PROG',' ');
|
122
|
+
insert into PSRECDEFN (RECNAME,SQLTABLENAME) values ('ACAD_PROG_TBL',' ');
|
123
|
+
insert into PSRECDEFN (RECNAME,SQLTABLENAME) values ('PERSON',' ');
|
124
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG','ACAD_CAREER',2,' ',8391457);
|
125
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG','ACAD_LOAD_APPR',15,' ',8389376);
|
126
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG','ACAD_PROG',7,'ACAD_PROG_SCTY',8405280);
|
127
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG','ACAD_PROG_DUAL',19,'UM_ACADPROG_VW4',8404992);
|
128
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG','ACTION_DT',10,' ',8388864);
|
129
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG','ADMIT_TERM',12,'TERM_TBL',8405280);
|
130
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG','ADM_APPL_NBR',21,' ',8388608);
|
131
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG','APPL_PROG_NBR',22,' ',8388608);
|
132
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG','CAMPUS',16,'HOME_CAMPUS_VW',8405248);
|
133
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG','COMPLETION_TERM',18,'TERM_TBL',8404992);
|
134
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG','DATA_FROM_ADM_APPL',23,' ',8397056);
|
135
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG','DEGR_CHKOUT_STAT',17,' ',8389120);
|
136
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG','EFFDT',4,' ',8388929);
|
137
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG','EFFSEQ',5,' ',8388673);
|
138
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG','EMPLID',1,'PEOPLE_SRCH',8407329);
|
139
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG','EXP_GRAD_TERM',13,'TERM_TBL',8404992);
|
140
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG','INSTITUTION',6,'UM_INST_CAR_VW',8405280);
|
141
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG','JOINT_PROG_APPR',20,' ',8397056);
|
142
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG','PROG_ACTION',9,'PROG_ACTN_SCTY',8405248);
|
143
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG','PROG_REASON',11,'PROG_RSN_TBL',8404992);
|
144
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG','PROG_STATUS',8,' ',8389376);
|
145
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG','REQ_TERM',14,'TERM_TBL',8404992);
|
146
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG','STDNT_CAR_NBR',3,' ',8390753);
|
147
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','ACAD_CALENDAR_ID',8,'ACAD_CAL_TABLE',8405248);
|
148
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','ACAD_CAREER',7,'ACAD_CAR_TBL',8405248);
|
149
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','ACAD_GROUP',11,'ACAD_GROUP_TBL',8405296);
|
150
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','ACAD_ORG',25,'ACAD_ORG_TBL_VW',8404992);
|
151
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','ACAD_PLAN',12,'ACAD_PLAN_TBLVW',8404992);
|
152
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','ACAD_PROG',2,' ',8390945);
|
153
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','ACAD_PROG_DUAL',27,'ACAD_PROG_TBLV2',8404992);
|
154
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','ACAD_STDNG_RULE',32,'ACAD_STDG_RL_VW',8404992);
|
155
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','ADVISOR_EDIT',9,' ',8389376);
|
156
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','ASSOC_PROG_AS',33,' ',8396800);
|
157
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','ASSOC_PROG_HA',40,' ',8396800);
|
158
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','CALC_AS_BATCH_ONLY',34,' ',8396800);
|
159
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','CALC_HA_BATCH_ONLY',41,' ',8396800);
|
160
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','CAMPUS',13,'HOME_CAMPUS_VW',8404992);
|
161
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','CANCEL_REASON',57,'ENRL_RSN_TBL',8404992);
|
162
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','CAR_PTR_EXC_FG',16,' ',8397056);
|
163
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','CAR_PTR_EXC_RULE',15,'CAR_PTR_EXC',8404992);
|
164
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','CIP_CODE',21,'CIP_CODE_TBL',8404992);
|
165
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','CMPLTD_NOTE_ID',53,'TSCRPT_NOTE_TBL',8404992);
|
166
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','CRSE_COUNT_ENRL',23,' ',8397056);
|
167
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','CRSE_COUNT_MIN',24,' ',8388608);
|
168
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','DESCR',5,' ',8388912);
|
169
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','DESCRSHORT',6,' ',8388912);
|
170
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','DROP_PEN_GRADE',64,'DROP_PEN_GRD_VW',8404992);
|
171
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','DROP_PEN_GRADE_2',65,'DRP_PEN_GRD2_VW',8404992);
|
172
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','DROP_PEN_GRD_BAS',66,'GRADE_BASE_E_VW',8404992);
|
173
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','DROP_PEN_GRD_BAS_2',67,'GRADE_BASE_E_VW',8404992);
|
174
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','DROP_RET_RSN',63,'ENRL_RSN_TBL',8404992);
|
175
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','EFFDT',3,' ',8388929);
|
176
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','EFF_STATUS',4,' ',8389376);
|
177
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','EXCL_TRM_CAT_AS_1',36,'LS_XLAT_MC_VW',8404992);
|
178
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','EXCL_TRM_CAT_AS_2',37,'LS_XLAT_MC_VW',8404992);
|
179
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','EXCL_TRM_CAT_AS_3',38,'LS_XLAT_MC_VW',8404992);
|
180
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','EXCL_TRM_CAT_HA_1',43,'LS_XLAT_MC_VW',8404992);
|
181
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','EXCL_TRM_CAT_HA_2',44,'LS_XLAT_MC_VW',8404992);
|
182
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','EXCL_TRM_CAT_HA_3',45,'LS_XLAT_MC_VW',8404992);
|
183
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','FA_ELIGIBILITY',18,' ',8397056);
|
184
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','FA_PRIMACY_NBR',17,' ',8388608);
|
185
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','FIRST_TERM_VALID',14,'TERM_VAL_TBL',8404992);
|
186
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','GRADE_TRANSFER',30,'GRADE_TBL',8404992);
|
187
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','GRADING_BASIS',29,'GRADE_BASIS_TBL',8404992);
|
188
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','GRADING_SCHEME',28,'GRADESCHEME_TBL',8404992);
|
189
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','HEGIS_CODE',22,'HEGIS_CODE_TBL',8404992);
|
190
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','HONOR_AWARD_RULE',39,'HONOR_AWD_RL_VW',8404992);
|
191
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','HONOR_DT_FG',46,' ',8389120);
|
192
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','INCOMPLETE_GRADE',47,'GRADE_INCOMP_VW',8404992);
|
193
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','INSTITUTION',1,'INSTITUTION_TBL',8407329);
|
194
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','LAPSE_DAYS',50,' ',8388608);
|
195
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','LAPSE_GRADE',48,' ',8397056);
|
196
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','LAPSE_NOTE_ID',51,'TSCRPT_NOTE_TBL',8404992);
|
197
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','LAPSE_TO_GRADE',49,'GRADE_LAPSE_VW',8404992);
|
198
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','LEVEL_LOAD_RULE',10,'LVL_LD_RULE_TBL',8405248);
|
199
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','OBEY_FULLY_GRD_AS',35,' ',8397056);
|
200
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','OBEY_FULLY_GRD_HA',42,' ',8397056);
|
201
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','OEE_IND',68,' ',8396800);
|
202
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','PRINT_CMPLTD_DATE',54,' ',8397056);
|
203
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','PRINT_LAPSE_DATE',52,' ',8397056);
|
204
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','PROG_NORM_COMPLTN',19,' ',8388608);
|
205
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','REPEAT_CRSE_ERROR',72,' ',8389376);
|
206
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','REPEAT_ENRL_CTL',69,' ',8389120);
|
207
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','REPEAT_ENRL_SUSP',70,' ',8396800);
|
208
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','REPEAT_GRD_CK',56,' ',8389120);
|
209
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','REPEAT_GRD_SUSP',71,' ',8396800);
|
210
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','REPEAT_RULE',55,'REPEAT_RULE_VW',8404992);
|
211
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','RESIDENCY_REQ',20,' ',8389376);
|
212
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','SPLIT_OWNER',26,' ',8397056);
|
213
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','TRANSCRIPT_LEVEL',31,' ',8389376);
|
214
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','WD_WO_PEN_REASON',58,'ENRL_RSN_TBL',8404992);
|
215
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','WD_W_PEN2_GRADE',61,'WD_W_PEN2_GD_VW',8404992);
|
216
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','WD_W_PEN2_GRD_BAS',62,'GRADE_BASE_E_VW',8404992);
|
217
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','WD_W_PEN_GRADE',60,'WD_W_PEN_GRD_VW',8404992);
|
218
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('ACAD_PROG_TBL','WD_W_PEN_GRD_BAS',59,'GRADE_BASE_E_VW',8404992);
|
219
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('PERSON','BIRTHCOUNTRY',4,'COUNTRY_TBL',8404992);
|
220
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('PERSON','BIRTHDATE',2,' ',8388608);
|
221
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('PERSON','BIRTHPLACE',3,' ',8388608);
|
222
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('PERSON','BIRTHSTATE',5,'BIRTHSTATE_VW',8404992);
|
223
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('PERSON','DT_OF_DEATH',6,' ',8388608);
|
224
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('PERSON','EMPLID',1,' ',8390945);
|
225
|
+
insert into PSRECFIELD (RECNAME,FIELDNAME,FIELDNUM,EDITTABLE,USEEDIT) values ('PERSON','LAST_CHILD_UPDDTM',7,' ',8388608);
|
data/test/field_test.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class RecordKeysTest < Minitest::Test
|
4
|
+
def setup
|
5
|
+
@record = PeoplesoftModels::Record.new(recname: "BLAH")
|
6
|
+
@record.fields.build(fieldname: "a", useedit: 1)
|
7
|
+
@record.fields.build(fieldname: "b", useedit: 2)
|
8
|
+
@record.fields.build(fieldname: "c", useedit: 3)
|
9
|
+
@record.fields.build(fieldname: "d", useedit: 4)
|
10
|
+
@record.save
|
11
|
+
end
|
12
|
+
|
13
|
+
def teardown
|
14
|
+
@record.fields.delete_all
|
15
|
+
@record.destroy
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_key_lookup
|
19
|
+
skip_if_using_real_peoplsoft
|
20
|
+
|
21
|
+
keys = @record.keys
|
22
|
+
|
23
|
+
assert(keys.include?("a"))
|
24
|
+
assert(keys.include?("c"))
|
25
|
+
end
|
26
|
+
end
|
data/test/record_test.rb
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class RecordTest < Minitest::Test
|
4
|
+
def setup
|
5
|
+
@record = PeoplesoftModels::Record.new(recname: "BLAH")
|
6
|
+
end
|
7
|
+
|
8
|
+
def test_blank_table_name
|
9
|
+
@record.stub(:sqltablename, " ") do
|
10
|
+
assert_equal("PS_BLAH", @record.table_name)
|
11
|
+
end
|
12
|
+
|
13
|
+
@record.stub(:sqltablename, nil) do
|
14
|
+
assert_equal("PS_BLAH", @record.table_name)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_nonblank_table_name
|
19
|
+
table = "ASDF"
|
20
|
+
@record.stub(:sqltablename, table) do
|
21
|
+
assert_equal(table, @record.table_name)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_effective_dated
|
26
|
+
@record.stub(:keys, ["blah", "meh", "effdt"]) do
|
27
|
+
assert(@record.effective_dated?)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_not_effective_dated
|
32
|
+
@record.stub(:keys, ["blah", "meh"]) do
|
33
|
+
assert(!@record.effective_dated?)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_not_effective_dated_model
|
38
|
+
@record.stub(:keys, ["blah", "meh"]) do
|
39
|
+
model = @record.to_model
|
40
|
+
assert(model.class != NilClass)
|
41
|
+
assert_equal(Class, model.class)
|
42
|
+
assert(PeoplesoftModels::Base, model.class.superclass)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_schema_prefix
|
47
|
+
schema = "campus_solutions"
|
48
|
+
recname = "blah"
|
49
|
+
PeoplesoftModels::Base.stub(:schema_name, schema) do
|
50
|
+
record = PeoplesoftModels::Record.new(recname: recname)
|
51
|
+
assert(record.table_name == "#{schema}.PS_#{recname}")
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_uses_schema_prefix
|
56
|
+
schema = "some_schema"
|
57
|
+
PeoplesoftModels::Base.stub(:schema_name, schema) do
|
58
|
+
assert(PeoplesoftModels::Record.table_name.match(%r(^#{schema}\.)))
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require "bundler"
|
2
|
+
Bundler.setup
|
3
|
+
require 'activerecord-peoplesoft_models'
|
4
|
+
require 'minitest/autorun'
|
5
|
+
|
6
|
+
if ENV['DATABASE'].blank?
|
7
|
+
ActiveRecord::Base.establish_connection(adapter:"sqlite3", database: ":memory:")
|
8
|
+
require 'fake_peoplesoft'
|
9
|
+
FakePeoplesoft.create!
|
10
|
+
else
|
11
|
+
ActiveRecord::Base.configurations = YAML::load_file(File.join(File.dirname(__FILE__), 'config', 'database.yml'))
|
12
|
+
ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations[ENV['DATABASE']])
|
13
|
+
end
|
14
|
+
|
15
|
+
ActiveRecord::Base.logger = Logger.new(STDOUT )if $0 == "irb"
|
16
|
+
|
17
|
+
class Minitest::Test
|
18
|
+
def skip_if_using_real_peoplsoft
|
19
|
+
unless ENV['DATABASE'].blank?
|
20
|
+
skip "Not running this destructive test on a real PeopleSoft instance"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,159 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: activerecord-peoplesoft_models
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Chris Dinger
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-09-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: composite_primary_keys
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '8.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '8.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.7'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.7'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: sqlite3
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.3.10
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.3.10
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: activerecord-oracle_enhanced-adapter
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.5'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.5'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: ruby-oci8
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '2.1'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '2.1'
|
97
|
+
description: ''
|
98
|
+
email:
|
99
|
+
- ding0057@umn.edu
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- ".gitignore"
|
105
|
+
- ".travis.yml"
|
106
|
+
- Gemfile
|
107
|
+
- LICENSE.txt
|
108
|
+
- README.md
|
109
|
+
- Rakefile
|
110
|
+
- activerecord-peoplesoft_models.gemspec
|
111
|
+
- console
|
112
|
+
- lib/activerecord-peoplesoft_models.rb
|
113
|
+
- lib/peoplesoft_models.rb
|
114
|
+
- lib/peoplesoft_models/base.rb
|
115
|
+
- lib/peoplesoft_models/effective_scope.rb
|
116
|
+
- lib/peoplesoft_models/field.rb
|
117
|
+
- lib/peoplesoft_models/record.rb
|
118
|
+
- lib/peoplesoft_models/version.rb
|
119
|
+
- test/config/database.example.yml
|
120
|
+
- test/effective_scope_test.rb
|
121
|
+
- test/fake_peoplesoft.rb
|
122
|
+
- test/fake_peoplesoft.sql
|
123
|
+
- test/field_test.rb
|
124
|
+
- test/record_keys_test.rb
|
125
|
+
- test/record_test.rb
|
126
|
+
- test/test_helper.rb
|
127
|
+
homepage: ''
|
128
|
+
licenses:
|
129
|
+
- MIT
|
130
|
+
metadata: {}
|
131
|
+
post_install_message:
|
132
|
+
rdoc_options: []
|
133
|
+
require_paths:
|
134
|
+
- lib
|
135
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - ">="
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
140
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
141
|
+
requirements:
|
142
|
+
- - ">="
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '0'
|
145
|
+
requirements: []
|
146
|
+
rubyforge_project:
|
147
|
+
rubygems_version: 2.4.5
|
148
|
+
signing_key:
|
149
|
+
specification_version: 4
|
150
|
+
summary: ActiveRecord models for working with PeopleSoft tables
|
151
|
+
test_files:
|
152
|
+
- test/config/database.example.yml
|
153
|
+
- test/effective_scope_test.rb
|
154
|
+
- test/fake_peoplesoft.rb
|
155
|
+
- test/fake_peoplesoft.sql
|
156
|
+
- test/field_test.rb
|
157
|
+
- test/record_keys_test.rb
|
158
|
+
- test/record_test.rb
|
159
|
+
- test/test_helper.rb
|