开发者

Database structure for a checklist app

开发者 https://www.devze.com 2023-03-09 05:25 出处:网络
I want to create a checklist web app for our team. I will be using MySQL. I dont know much about efficient database design, so I need some guidance.

I want to create a checklist web app for our team. I will be using MySQL. I dont know much about efficient database design, so I need some guidance.

There will be projects and checklists assigned to them. Every project will have some default checklists, and some custom ones if the user adds it.

So far i'm considering using these tables:

User --ID, Name, password, title, etc.

Project --ID, Name

Checklist --ID, name, isDefault

ChecklistItem --ID, text, status

What foreign key fields should I use to have this kind of structure? How will I have default checklists connected to the开发者_Go百科 project?


Fast generation of model:

  1. Each project can have zero or more checklists
  2. Each checklist can have zero or more items
  3. Each user can have zero or more checklist items assigned

I think this can be done better, but this is where you can start.

Database structure for a checklist app


There are some good ressources to help you put together a schema tailored for your needs. I used to start from scratch, but always found myself adding fields and tables as I went along. that gets very painful when you have a bunch of code to adapt over and over for all those afterthoughs. Getting the schema as close to possible the way you want it when finished is a crucial part of proper application design.

I recommend you look at this schema, taken from this page and do a semi detailed sketch of your db model. From such a model, you can use tools such as an ORM or the Zend_Db & friends to enforce it at application level, or use the good old-fashioned approach and code these constraints yourself in your application.

Happy coding!

0

精彩评论

暂无评论...
验证码 换一张
取 消