简体   繁体   中英

Database structure for a checklist app

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 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.

在此处输入图像描述

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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM