Database to database (a la CCK without Drupal)

I hope to build a Codeigniter library similar to the Drupal CCK, albeit in an extremely simplified version. I am wondering which database structure will work best to achieve my ultimate goal, which can best be described by the following use case:

Interface:

Existing content types:

  • Page [edit type] [list of all] [add new page]
  • Rating [change type] [list of all] [add new rating]
  • DVD Movie [edit type] [list of all] [add new DVD movie]

[create new content type]

The web developer clicks [create a new content type]:

Form: New Content Type

Enter a name: [ _ Observer Comment ____________ ]

Add field:

  • : [ _Name __________]
  • : [ (< 128 )] ( )
  • : [ x]
  • [ ]

[ ]

- :

:

: [ _ ____________]

:

  • | (< 128 ) |
  • | (< 128 ) |
  • | (< 1024 ) |
  • ForPage | |

:

  • : [ _____________]
  • : [- -]
  • : []
  • [ ]

[ ]

- , ... , ?

1: ( phpmyadmin) - ? ?

2: , :

table ContentType (e.g. "Book")
-- id
-- title

table CustomField (e.g. "Author Name")
-- id
-- ContentTypeID (linking the "Author Name" field to the "Book" type)
-- valueType (linking the field to the correct db table of values)

table DBRecord (e.g. "Lord Of The Rings vol.1")
-- id
-- ContentTypeID (linking the LotR record to the "Book" type)

table ValueText128 (e.g. "J.R.R. Tolkien")
-- id
-- DBRecordID (linking the value to the LotR record)
-- CustomFieldID (linking the Tolkien value to the "Author Name" field)
-- value : char(128)

table ValueSmallInt (e.g. "1954")
-- id
-- DBRecordID (linking the value to the LotR record)
-- CustomFieldID (linking the "1954" value to the "Published Year" field)
-- value : smallInt

...and so on, with a table for each of the datatypes

, , , , , - char (128) ..

- ? CCK? ?

+3
2

, , . , , , .

, , . : "", "", "", "", "" .. , , , . () .

, 2, .

, ad-hoc- , . , ? , , , .

+1

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


All Articles