Let's implement one useful feature, which you'll undoubtedly be asked to use one day by the client on a real enterprise-grade application project. It is described like this, in the words of some unknown Mr. Arbitrary Stakeholder:
"When a new Customer is recorded, a date and time of creation and the user who did it, should be recorded. Upon any update of the Customer in the database, a date and time of the update and the user doing it should be recorded."
We, as developers, will translate it to the following specification:
Add four fields to the
customer
table in the database, which are as follows:created_at
: This field is of theinteger
type, holding a Unix timestampcreated_by
: This field is of theinteger
type, and is a foreign key to theuser.id
fieldupdated_at
: This field is of theinteger
type, holding a Unix timestampupdated_by
: This field is of theinteger
type, and is a foreign key to theuser.id
field
When a new...