Coding Dojo

Edit on Gitlab

ORM

Kata

Same object in database and business

Write a contacts program they use an ORM to read and write Persons from an sqlite3 database

Person has 3 attributes :

Tests DB and production DB

we want to have one test DB named tests.db and one production db file set by environment variable DB_URL

In production Data base we have all this contacts :

Version of schema

add a version schema in your code and database

Migration

Add attribute email and manage the production migration database. The migration should be automatic in 2 ways :

One object for database and one for business

Add a business Person value object they has an address attribute with these rules:

Relation one 2 one

A person has an unique National Identifier, add the national unique number structure build like in France with :

Relation one to many

A Person can know have many phone numbers, add a collections of phones numbers as attribute to Person and a new table Phones in database

Relation many To many

A person has 2 parents and 0 or more children, manage that in your business and in your database.

Inheritance

We have now 2 types of persons:

Student and Employee extends Person.

Save all this information in your database.

Production database

Use a postgres or mysql as Production database.