Doubloon

Hi!

I read the book "Agile Web Development With Application Yii1.1 and PHP5" and I do not understand why the author uses two table tbl_project_user_assignment:

CREATE TABLE ‘tbl_project_user_assignment’

(

‘PROJECT_ID’ Int (11) NOT NULL,

‘User_id’ int (11) NOT NULL,

‘Create_time’ DATETIME

‘Create_user_id’ INTEGER,

‘Update_time’ DATETIME

‘Update_user_id’ INTEGER,

PRIMARY KEY (‘PROJECT_ID’, ‘user_id’)

) ENGINE = InnoDB

;

And tbl_project_user_role :

create table tbl_project_user_role

(

PROJECT_ID INTEGER NOT NULL,

user_id INTEGER NOT NULL,

role VARCHAR (64) NOT NULL,

PRIMARY KEY (projectId userId, Role)

foreign key (PROJECT_ID) tbl_project references (id)

foreign key (user_id) references tbl_user (id)

foreign key (role) references AuthItem (name)

);

This produces duplicates in the database.

Could you clarify the above please

Read page 190, for the reason why.

@Roms - you are not going to last long around here asking the same thing in three different threads

Yes, these could potentially be consolidated. The first table was introduced earlier (Pre RBAC) in order to provide valid user choices when managing Issues. By the time the application has progressed to Chapter 8 (RBAC), there is really no situation in which a user is associated to a project and not also in one or more expllcit roles. There are several places where this Trackstar application could use a little refactoring…perhaps this is one such place.

Thats the same with any application isn’t it?? :lol:

I think you and your crew did a splendid job.