Yii Framework Forum: Doubloon - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Doubloon

#1 User is offline   Roms 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 25-October 10

Posted 25 October 2010 - 05:13 AM

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
0

#2 User is offline   digitalzombie 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 17
  • Joined: 19-August 10

Posted 25 October 2010 - 09:59 AM

View PostRoms, on 25 October 2010 - 05:13 AM, said:

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.
0

#3 User is offline   Backslider 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 363
  • Joined: 23-July 09

Posted 25 October 2010 - 11:06 AM

@Roms - you are not going to last long around here asking the same thing in three different threads
We were all once expert at....... nothing.

yii-language-behavior

My Blog
0

#4 User is offline   jefftulsa 

  • Advanced Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 168
  • Joined: 06-October 08
  • Location:Austin, TX

Posted 25 October 2010 - 11:14 PM

View PostRoms, on 25 October 2010 - 05:13 AM, said:

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



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.
0

#5 User is offline   Backslider 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 363
  • Joined: 23-July 09

Posted 26 October 2010 - 12:15 AM

View Postjefftulsa, on 25 October 2010 - 11:14 PM, said:

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.
We were all once expert at....... nothing.

yii-language-behavior

My Blog
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users