Create students and teachers
Database tables
-
create a students
table with attributes:first_name:string
,last_name:string
,date_of_birth:date
-
create a teachers
table with attributes:first_name:string
,last_name:string
indexes
- index on :id in students table
- index on :id in teachers table
- uniq index on [:first_name, :last_name, :date_of_birth] in students table
- uniq index on [:first_name, :last_name] in teachers table
Student and Teacher model
- before create hook in order to encrypt [:first_name, :last_name]
- override the getters [:first_name, :last_name] in order to decrypt the database value
- use environment variables for encryption keys
Edited by Tarek