Enumerating types for a given column for a model object

67 Views Asked by At

I have an obect called "Task" and each task has a type. In my database design without ORM, i would have a table called TaskTypes and Task table would have foreign key to the TaskTypes table where we define Tasks..

Is there a way to handle this behaviour natively in jugglingdb? Or do i have to create another model called TaskTypes and make Task "belongTo" a TaskType class?

1

There are 1 best solutions below

0
On

The "native" way to handle this would be to define each model.

You can take a slight shortcut with Task.belongsTo('tasktype'); which will add the column tasktypeId for you.