# SQL-MVC Better Model ,

So we want to take our simple todo example and turn it into a full collaboration/management tool.


##Step four

We improve the model and we are goiong to call it a new name not to conflict with the first turoial .
So in a new file "Project_model.quicc" we do

```
<#model
CREATE TABLE Projects				--:{as:Table} 
(
  REF PK,							--:{as:pk}
  SUBJECT SHORT_NAME,				--:{as:Text,title:todo,onupdate:"owner=operator.id"}  
  OWNER FK,							--:{as:fk}
  STATUS VARCHAR(10) default ''    	--:{Type:Pick,List:Ticked}  

  CREATED_AT timestamp				--:{as:ts},
  DEAD_LINE timestamp				--:{as:ts},
  SCHEDULED_AT timestamp			--:{as:ts},
  COMPLETED_AT timestamp			--:{as:ts},
     --more events will be placed in a log
  ESTIMATED_HOURS					--:{as:range,range:{0,1000}},
  
  Sub_project_of	FK				--:{as:fk},
  
  DEV_TEAM     FK					--:{as:fk},
  ASSIGNED_TO  FK					--:{as:fk},
  CLASSIFICATION FK					--:{as:fk}
  
);#>
```

Now we can manage our projects, assign it to a team member etc.

Here we use "user defined SQL Datatypes" (SHORT_NAME) (called domains in firebird) to take the brain work out of deciding field sizes (at this moment).

Like PK for primary key, we now use FK for foreign key (link to definitions),



WIP...


#Next

Next step... Better Models [Github - Better_Model](https://github.com/quale-quest/sql-mvc/blob/master/doc/Tutorial_Better_Model.md)


