...
. - is_draft , . , , ( , ). , , , ?
is_draft = 1, ORM, , . , , , .
:
. . set is_draft = 1 . . "" -:)
. . . set is_draft = 0. .
, , , /, .
, . , , , , .
- ( ). php serialize() - , json. , ( - ) :
sql:
create table draft
id int primary key auto increment,
entity varchar(64) not null comment 'this way you can find all drafts of say type Email',
contents longblob not null,
modified timestamp comment 'this way you can sort by newer drafts'
modified_by int not null foreign key to user.id comment 'this way you can filter by the user\ drafts'
draft_file :
create table draft_file
id int primary key auto increment,
draft_id int not null foreign key to draft.id on delete cascade,
size int not null comment 'bytes',
mime_type varchar(64) not null,
file_name varchar(255) not null,
contents longblob,
thumbnail blob comment 'this could be an icon for files/documents'
, , , . gui , draft_file id, URL- , gui.
(To ). gui , id, .
"". , draft_file email_attachment , .
this allows you to use long-term drafts, add attachments in the gmail style, while maintaining the integrity of your real entity table.