How "perfect" is the database?

I am developing a website to track weight and calorie lifting. I had never developed my own database before, and I decided that I should get as much space as possible before starting coding. Every time I think I am done, it seems to me that it is not perfect. I mainly use MySQL Workbench, but I still have a few questions.

  • How important is it to make the database “excellent” in front of you? How hard is it to refactor the database later?
  • What does the engine option do? Is all the default tables correct now InnoDB Engine? Any problems with this?
  • Are data changes possible after data recording? Maybe not from VARCHAR to INT, but what about VARCHAR (45) - VARCHAR (255)?
  • What are the basic database rules that HAVE follow for a successful design?

I also attached an ERM chart. If anyone could point out any obvious violations, that would be greatly appreciated.

alt text

+3
source share
10 answers

Begin as beautifully as you can, and then make it as imperfect as possible.

+12
source

No practical, operational database is perfect. All warts have.

, , . , . , , .

, , - .

+3

, , , .. , . .

... 1. . . . 2. badges- > userbadges. , PK (id). 3. id (.. User, "userid", "id" "foodid" ). - , .

+2

" SQL" , SQL " " .

Codd (3NF/BCNF ). - ( , ) .., , . . .

:

  • exercise , , - secondary1, secondary2, secondaryN... ! :

  • userid PK (varchar), usernumber int? , . , , ( id), , - . , userid ( username?) ( - " " , ).

  • (userid vs usernumber vs id). , . , , , , .

. .

+2

... exercise. secondary1 to secondary10 -, , , . , , , , ? .

, ( ) , . ( ). , .

+1

. :

1 - . , /.

2 - / UTC . ( datetime unix, . mysql DATETIME.)

, , . mysql , , . , , script, ( ) . . , . ram, , .

+1

, , . Boyce-Codd/5th Normal Form , .

, , . , , , , . YAGNI Agile, , .

, , , , . , , - , . - , , , , .

"". . , , , , .

+1

- . .

, , . , BCNF. , .

. . . CJ . , , .

, , , . , .

.

+1
  • , ; .
  • InnoDB .
  • ALTER , .
  • , (, WHERE) ..
0

!

- , .

, .

0

Source: https://habr.com/ru/post/1780140/


All Articles