Skip to content

Commit

Permalink
Issue #30 - fix installer issues re attendance record FK
Browse files Browse the repository at this point in the history
  • Loading branch information
tbar0970 committed Jul 21, 2018
1 parent 0c9e649 commit bc40daa
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 20 deletions.
26 changes: 26 additions & 0 deletions db_objects/attendance_record.class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php
include_once 'include/db_object.class.php';
class Attendance_Record extends db_object
{
// NB This class only exists for the following SQL
// See Attendance_Record_Set for CRUD functionality of this table

function getInitSQL($table_name=NULL)
{
return "
CREATE TABLE `attendance_record` (
`date` date NOT NULL,
`personid` int(11) NOT NULL,
`groupid` int(11) NOT NULL,
`present` tinyint(1) unsigned NOT NULL,
PRIMARY KEY (`date`,`personid`,`groupid`)
) ENGINE=InnoDB ;
";
}

public function getForeignKeys()
{
return Array('personid' => '`_person` (`id`) ON DELETE CASCADE');
}
}
?>
20 changes: 0 additions & 20 deletions db_objects/attendance_record_set.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,26 +70,6 @@ function create()
{
}


function getInitSQL($table_name=NULL)
{
return "
CREATE TABLE `attendance_record` (
`date` date NOT NULL default '0000-00-00',
`personid` int(11) NOT NULL default '0',
`groupid` int(11) NOT NULL default '0',
`present` tinyint(1) unsigned NOT NULL default '0',
PRIMARY KEY (`date`,`personid`,`groupid`),
CONSTRAINT `ar_personid` FOREIGN KEY (personid) REFERENCES _person(id) ON DELETE CASCADE
) ENGINE=InnoDB ;
";
}

public function getForeignKeys()
{
return Array();
}

function load($date, $cohort, $age_brackets, $statuses)
{
$this->date = $date;
Expand Down

0 comments on commit bc40daa

Please sign in to comment.