3 class MTrackDBSchema_Table {
9 /* compares two tables; returns true if they are identical,
10 * false if the definitions are altered */
11 function sameAs(MTrackDBSchema_Table $other) {
12 if ($this->name != $other->name) {
13 throw new Exception("can only compare tables with the same name!");
15 foreach (array('fields', 'keys', 'triggers') as $propname) {
16 if (!is_array($this->{$propname})) continue;
17 foreach ($this->{$propname} as $f) {
18 if (!isset($other->{$propname}[$f->name])) {
19 # echo "$propname $f->name is new\n";
22 $o = clone $other->{$propname}[$f->name];
27 # echo "$propname $f->name are not equal\n";
33 if (!is_array($other->{$propname})) continue;
34 foreach ($other->{$propname} as $f) {
35 if (!isset($this->{$propname}[$f->name])) {
36 # echo "$propname $f->name was deleted\n";