Prev | Current Page 223 | Next

David Berube

"Practical Reporting with Ruby and Rails"

Therefore, salespeople will receive the highest reward for
which they are eligible.
The last model, Reward, refers to the table that you created earlier in this chapter. The
first two models refer to two tables defined by SugarCRM: users and meetings. The users
table looks like this:
CREATE TABLE `users` (
`id` char(36) NOT NULL,
`user_name` varchar(60) default NULL,
`user_hash` varchar(32) default NULL,
`authenticate_id` varchar(100) default NULL,
`sugar_login` tinyint(1) default '1',
`first_name` varchar(30) default NULL,
`last_name` varchar(30) default NULL,
. . .
KEY `user_name_idx` (`user_name`)
) ENGINE= MyISAM DEFAULT CHARSET=utf8;
The meetings table looks like this:
CREATE TABLE `meetings` (
`id` char(36) NOT NULL,
`date_entered` datetime NOT NULL,
`date_modified` datetime NOT NULL,
`assigned_user_id` char(36) default NULL,
. . .
PRIMARY KEY (`id`),
KEY `idx_mtg_name` (`name`),
KEY `idx_meet_par_del` (`parent_id`,`parent_type`,`deleted`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
As you can see, the two tables are related by a foreign key named assigned_user_id in
the meetings table.


Pages:
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235
agencja detektywistyczna Pozycjonowanie kreator www implanty zębów łódź muay thai