ryansuitposungkono / openjs-grid

Automatically exported from code.google.com/p/openjs-grid
0 stars 0 forks source link

Added some features you might want. #38

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Deleting records is a bad practice imo.  I always have a column formated 
tinyint and just place a 1 there if a record has been deleted.  So, I updated 
the line in the delete function to be: 

UPDATE {$this->table} SET deleted = 1 WHERE $primaryKey = '$post[primary_key]

===============

Also modded the save method a bit to update the editdate field in my db, 
another good practice I follow:

$sql = "UPDATE {$this->table} SET ".implode(",",$setArray)." WHERE $primaryKey 
= '$rowId'";
            //ts mod
            $sql2 = "UPDATE {$this->table} SET editdate = CURDATE() WHERE $primaryKey = '$rowId'";

            mysql_query($sql);

            mysql_query($sql2);

================

Just thought I would share my input on those two best database practices i 
follow.  I realize that this won't work for everyone and that is why you left 
it out, but thought I would through it out there in case anyone is like me and 
wants a little more tracking and accountability in their DB.

Thanks for the great project,  I like this a lot more than most php crud grids.

Original issue reported on code.google.com by travst...@gmail.com on 5 Nov 2011 at 5:40

GoogleCodeExporter commented 9 years ago
Thanks man, these are great additions. They are pretty custom, but for larger 
projects you would defintely want to add the edit times.

Another good practice is to add the user that edited, and the user that 
created. for larger projects, every table has the following

isActive
isDeleted
createdDate
createdBy
updatedDate
updatedBy

Original comment by Seancla...@gmail.com on 16 Nov 2011 at 5:41