From: Eden Cardim Date: Sun, 25 Jul 2010 16:52:24 +0000 (+0000) Subject: changed user table name to users in order to dodge reserved word X-Git-Tag: v5.8005~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Manual.git;a=commitdiff_plain;h=861a0cddee96ce3d0531caeafb649a1d6cdec787 changed user table name to users in order to dodge reserved word --- diff --git a/lib/Catalyst/Manual/Tutorial/05_Authentication.pod b/lib/Catalyst/Manual/Tutorial/05_Authentication.pod index 8a7ec06..3831d6a 100644 --- a/lib/Catalyst/Manual/Tutorial/05_Authentication.pod +++ b/lib/Catalyst/Manual/Tutorial/05_Authentication.pod @@ -82,10 +82,10 @@ authorization section, Chapter 6). Create a new SQL script file by opening C in your editor and insert: -- - -- Add user and role tables, along with a many-to-many join table + -- Add users and role tables, along with a many-to-many join table -- PRAGMA foreign_keys = ON; - CREATE TABLE user ( + CREATE TABLE users ( id INTEGER PRIMARY KEY, username TEXT, password TEXT, @@ -106,9 +106,9 @@ C in your editor and insert: -- -- Load up some initial test data -- - INSERT INTO user VALUES (1, 'test01', 'mypass', 't01@na.com', 'Joe', 'Blow', 1); - INSERT INTO user VALUES (2, 'test02', 'mypass', 't02@na.com', 'Jane', 'Doe', 1); - INSERT INTO user VALUES (3, 'test03', 'mypass', 't03@na.com', 'No', 'Go', 0); + INSERT INTO users VALUES (1, 'test01', 'mypass', 't01@na.com', 'Joe', 'Blow', 1); + INSERT INTO users VALUES (2, 'test02', 'mypass', 't02@na.com', 'Jane', 'Doe', 1); + INSERT INTO users VALUES (3, 'test03', 'mypass', 't03@na.com', 'No', 'Go', 0); INSERT INTO role VALUES (1, 'user'); INSERT INTO role VALUES (2, 'admin'); INSERT INTO user_role VALUES (1, 1); @@ -146,19 +146,19 @@ files, those changes would have only been written above the C<# DO NOT MODIFY THIS OR ANYTHING ABOVE!> comment and your hand-edited enhancements would have been preserved. -Speaking of "hand-editted enhancements," we should now add the -C relationship information to the User Result Source file. -As with the Book, BookAuthor, and Author files in -L, -L has -automatically created the C and C relationships -for the new User, UserRole, and Role tables. However, as a convenience -for mapping Users to their assigned roles (see -L), we will -also manually add a C relationship. Edit -C add the following information between -the C<# DO NOT MODIFY THIS OR ANYTHING ABOVE!> comment and the closing -C<1;>: +Speaking of "hand-editted enhancements," we should now add the +C relationship information to the User Result Source file. +As with the Book, BookAuthor, and Author files in +L, +L has +automatically created the C and C relationships +for the new User, UserRole, and Role tables. However, as a convenience +for mapping Users to their assigned roles (see +L), we will +also manually add a C relationship. Edit +C add the following information between +the C<# DO NOT MODIFY THIS OR ANYTHING ABOVE!> comment and the closing +C<1;>: # many_to_many(): # args: @@ -168,12 +168,12 @@ C<1;>: # You must already have the has_many() defined to use a many_to_many(). __PACKAGE__->many_to_many(roles => 'user_roles', 'role'); -The code for this update is obviously very similar to the edits we made -to the C and C classes created in Chapter 3 with one -exception: we only defined the C relationship in one -direction. Whereas we felt that we would want to map Authors to Books -B Books to Authors, here we are only adding the convenience -C in the Users to Roles direction. +The code for this update is obviously very similar to the edits we made +to the C and C classes created in Chapter 3 with one +exception: we only defined the C relationship in one +direction. Whereas we felt that we would want to map Authors to Books +B Books to Authors, here we are only adding the convenience +C in the Users to Roles direction. Note that we do not need to make any change to the C schema file. It simply tells DBIC to load all @@ -184,13 +184,13 @@ new table information. =head2 Sanity-Check of the Development Server Reload -We aren't ready to try out the authentication just yet; we only want to -do a quick check to be sure our model loads correctly. Assuming that you -are following along and using the "-r" option on C, -then the development server should automatically reload (if not, press -C to break out of the server if it's running and then enter -C