[TYPO3-dam-devel] RFC #8223: Add DEFAULT '' to field file_path in table tx_dam

Michiel Roos michiel at netcreators.com
Tue May 6 08:28:13 CEST 2008


On May 6, 2008, at 12:06 AM, Benjamin Mack wrote:

> Hey Michiel,
>
> so, after reading these things, the best way should be to remove both
> DEFAULT '' and NOT NULL having only
>
>   myfield TEXT,
>
> ?

yes

Both for text and blob:


diff -ru dam/ext_tables.sql dam.8223/ext_tables.sql
--- dam/ext_tables.sql	2008-05-05 23:35:26.000000000 +0200
+++ dam.8223/ext_tables.sql	2008-05-05 23:37:11.000000000 +0200
@@ -2,7 +2,7 @@
  # Add field to table 'be_groups'
  #
  CREATE TABLE be_groups (
-	tx_dam_mountpoints tinytext NOT NULL
+	tx_dam_mountpoints tinytext
  );


@@ -10,7 +10,7 @@
  # Add field to table 'be_users'
  #
  CREATE TABLE be_users (
-	tx_dam_mountpoints tinytext NOT NULL
+	tx_dam_mountpoints tinytext
  );


@@ -21,7 +21,7 @@
  CREATE TABLE tt_content (
      tx_dam_images int(11) unsigned DEFAULT '0' NOT NULL,
      tx_dam_files int(11) unsigned DEFAULT '0' NOT NULL,
-    ce_flexform mediumtext NOT NULL,
+    ce_flexform mediumtext,
  );


@@ -67,7 +67,7 @@
    # languages
    sys_language_uid int(11) DEFAULT '0' NOT NULL,
    l18n_parent int(11) DEFAULT '0' NOT NULL,
-  l18n_diffsource mediumblob NOT NULL,
+  l18n_diffsource mediumblob,

    # workspaces
    t3ver_oid int(11) DEFAULT '0' NOT NULL,
@@ -87,7 +87,7 @@
    # Service (uri,...), Anything/Sonstiges
    media_type tinyint(4) unsigned DEFAULT '0' NOT NULL,

-  title tinytext NOT NULL,
+  title tinytext,
    category int(11) DEFAULT '0' NOT NULL,


@@ -107,7 +107,7 @@
    file_type_version varchar(9) DEFAULT '' NOT NULL,

    file_name varchar(255) DEFAULT '' NOT NULL,
-  file_path text NOT NULL,
+  file_path text,
    file_size int(11) unsigned DEFAULT '0' NOT NULL,
    file_mtime int(11) unsigned DEFAULT '0' NOT NULL,
    file_inode int(11) DEFAULT '0' NOT NULL,
@@ -142,7 +142,7 @@


    # xml / array
-  meta text NOT NULL,
+  meta text,


    # sku / bestell nr
@@ -152,19 +152,19 @@
    # photographer
    creator varchar(45) DEFAULT '' NOT NULL,

-  keywords tinytext NOT NULL,
-  description text NOT NULL,
+  keywords tinytext,
+  description text,

    # for web or FE applications
    alt_text varchar(255) DEFAULT '' NOT NULL,
-  caption text NOT NULL,
+  caption text,


    # if not set by hand, the first kb of a pdf, doc file for example
-  abstract text NOT NULL,
+  abstract text,

    # for searching and non editable: the first 60 kb of a pdf, doc  
file for example
-  search_content text NOT NULL,
+  search_content text,

    # document language
    language char(3) DEFAULT '' NOT NULL,
@@ -177,7 +177,7 @@
    copyright varchar(128) DEFAULT '' NOT NULL,

    # instructions and notes
-  instructions tinytext NOT NULL,
+  instructions tinytext,

    # created, modified
    # date_cr don`t have to be the file creation time. It is the time  
a photo is shooten not the time the slide is scanned and saved
@@ -240,7 +240,7 @@
    # languages
    sys_language_uid int(11) DEFAULT '0' NOT NULL,
    l18n_parent int(11) DEFAULT '0' NOT NULL,
-  l18n_diffsource mediumblob NOT NULL,
+  l18n_diffsource mediumblob,

    # workspaces
    t3ver_oid int(11) DEFAULT '0' NOT NULL,
@@ -261,11 +261,11 @@
    hidden tinyint(4) unsigned DEFAULT '0' NOT NULL,
    fe_group varchar(100) DEFAULT '0' NOT NULL,

-  title tinytext NOT NULL,
-  nav_title tinytext NOT NULL,
-  subtitle tinytext NOT NULL,
-  keywords text NOT NULL,
-  description text NOT NULL,
+  title tinytext,
+  nav_title tinytext,
+  subtitle tinytext,
+  keywords text,
+  description text,
    PRIMARY KEY (uid),
    KEY parent (pid),
    KEY parent_id (parent_id)
@@ -344,7 +344,7 @@
    item_count int(11) unsigned DEFAULT '0' NOT NULL,

    # short description
-  message tinytext NOT NULL,
+  message tinytext,

    PRIMARY KEY (uid),
    KEY parent (pid),
@@ -360,7 +360,7 @@
    tstamp int(11) unsigned DEFAULT '0' NOT NULL,

    file_name varchar(255) DEFAULT '' NOT NULL,
-  file_path text NOT NULL,
+  file_path text,
    file_size int(11) unsigned DEFAULT '0' NOT NULL,

    # date of file creation
@@ -396,8 +396,8 @@
  	endtime int(11) DEFAULT '0' NOT NULL,
  	fe_group int(11) DEFAULT '0' NOT NULL,
  	type int(11) DEFAULT '0' NOT NULL,
-	title tinytext NOT NULL,
-	definition text NOT NULL,
+	title tinytext,
+	definition text,

  	PRIMARY KEY (uid),
  	KEY parent (pid)



> Michiel Roos wrote:
>> And also: http://bugs.typo3.org/view.php?id=4693
>>
>> On May 5, 2008, at 11:50 PM, Michiel Roos wrote:
>>
>>> -1
>>>
>>> NOT NULL fields need a default value
>>>
>>> but . . .
>>>
>>> http://dev.mysql.com/doc/refman/5.0/en/blob.html states: BLOB and  
>>> TEXT
>>> columns cannot have DEFAULT values
>>>
>>> MySQL will complain when in strict mode when given NOT NULL  
>>> DEFAULT ''
>>> since it will just strip the DEFAULT '' off of the query and then  
>>> the
>>> query will fail. A lot of MySQL implementations ship out in a strict
>>> mode configuration.
>>>
>>> Please look closely at the patch attached to the related
>>> bug: http://bugs.typo3.org/view.php?id=4991
>>>
>>> The + and - are the wrong way around but the idea is that the text  
>>> and
>>> blob fields are created 'cleanly' (without NOT NULL or DEFAULT '').
>>>
>>> Please find attached a possible solution.
>>>
>>> <20080505_8223.diff>
>>>
>>> On May 5, 2008, at 11:01 PM, Benjamin Mack wrote:
>>>
>>>> Hey team,
>>>>
>>>> this is a SVN patch request.
>>>>
>>>> Branches: DAM_1.0 and Trunk (1.1)
>>>>
>>>> BT Reference: http://bugs.typo3.org/view.php?id=8223
>>>>
>>>> Type: Bugfix / Cleanup
>>>>
>>>> Problem: In ext_tables.sql, the field "file_path" of the table
>>>> "tx_dam" has a NOT NULL, but not a DEFAULT '' set. Apparently on  
>>>> some
>>>> installations this causes an error.
>>>>
>>>> Solution: Although I cannot reproduce this, I fully agree with
>>>> setting this option.
>>>>
>>>> Notes: Thanks to Niels Pardon for the initial patch and the  
>>>> reporting.
>>>>
>>>> -- 
>>>> greetings,
>>>> benni.
>>>> -SDG-
>>>> Index: ext_tables.sql
>>>> ===================================================================
>>>> --- ext_tables.sql (revision 9103)
>>>> +++ ext_tables.sql (working copy)
>>>> @@ -91,7 +91,7 @@
>>>>  file_type_version varchar(9) DEFAULT '' NOT NULL,
>>>>
>>>>  file_name varchar(255) DEFAULT '' NOT NULL,
>>>> -  file_path text NOT NULL,
>>>> +  file_path text DEFAULT '' NOT NULL,
>>>>  file_size int(11) unsigned DEFAULT '0' NOT NULL,
>>>>  file_mtime int(11) unsigned DEFAULT '0' NOT NULL,
>>>>  file_inode int(11) DEFAULT '0' NOT NULL,
>>>> Index: ext_tables.sql
>>>> ===================================================================
>>>> --- ext_tables.sql (revision 9104)
>>>> +++ ext_tables.sql (working copy)
>>>> @@ -107,7 +107,7 @@
>>>>  file_type_version varchar(9) DEFAULT '' NOT NULL,
>>>>
>>>>  file_name varchar(255) DEFAULT '' NOT NULL,
>>>> -  file_path text NOT NULL,
>>>> +  file_path text DEFAULT '' NOT NULL,
>>>>  file_size int(11) unsigned DEFAULT '0' NOT NULL,
>>>>  file_mtime int(11) unsigned DEFAULT '0' NOT NULL,
>>>>  file_inode int(11) DEFAULT '0' NOT NULL,
>>>> _______________________________________________
>>>> Before posting to this list, please have a look to the posting  
>>>> rules
>>>> on the following websites:
>>>>
>>>> http://typo3.org/teams/core/core-mailinglist-rules/
>>>> http://typo3.org/development/bug-fixing/diff-and-patch/
>>>> _______________________________________________
>>>> TYPO3-team-dam mailing list
>>>> TYPO3-team-dam at lists.netfielders.de
>>>> <mailto:TYPO3-team-dam at lists.netfielders.de>
>>>> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-team-dam
>>>
>>>
>>> Met vriendelijke groet,
>>>
>>> Michiel Roos
>>>
>>> Netcreators BV :: creation and innovation
>>> www.netcreators.com <http://www.netcreators.com>
>>>
>>> Interesse in werken bij Netcreators?
>>> http://www.netcreators.com/bedrijf/vacatures/
>>>
>>> _______________________________________________
>>> Before posting to this list, please have a look to the posting rules
>>> on the following websites:
>>>
>>> http://typo3.org/teams/core/core-mailinglist-rules/
>>> http://typo3.org/development/bug-fixing/diff-and-patch/
>>> _______________________________________________
>>> TYPO3-team-dam mailing list
>>> TYPO3-team-dam at lists.netfielders.de
>>> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-team-dam
>>
>>
>> Met vriendelijke groet,
>>
>> Michiel Roos
>>
>> Netcreators BV :: creation and innovation
>> www.netcreators.com <http://www.netcreators.com>
>>
>> Interesse in werken bij Netcreators?
>> http://www.netcreators.com/bedrijf/vacatures/
>>
>
> -- 
> greetings,
> benni.
> -SDG-
> _______________________________________________
> Before posting to this list, please have a look to the posting rules
> on the following websites:
>
> http://typo3.org/teams/core/core-mailinglist-rules/
> http://typo3.org/development/bug-fixing/diff-and-patch/
> _______________________________________________
> TYPO3-team-dam mailing list
> TYPO3-team-dam at lists.netfielders.de
> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-team-dam


Met vriendelijke groet,

Michiel Roos

Netcreators BV :: creation and innovation
www.netcreators.com

Interesse in werken bij Netcreators?
http://www.netcreators.com/bedrijf/vacatures/



More information about the TYPO3-team-dam mailing list