Results 1 to 3 of 3

Thread: Creation of mysql table for extension

  1. #1
    New user
    Join Date
    10-01-13.
    Posts
    1

    Default Creation of mysql table for extension

    Hi,

    I have to create mysql table for extension I'm working on. First I defined table in database.sql file and contao created table without any problems but after creating table it reports that all fields in the table need to be altered. But all changes it suggest wouldn't change anything.

    I got suggestion to try defining table in dca but everytinhg stayed the same.

    This is the sample code from dca:

    Code:
    $GLOBALS['TL_DCA']['tl_table']['fields']['userId'] = array
    (
    	'sql'				=> "INT(11) NOT NULL default 0"
    );
    This is what I get when I go to extension manager -> update database:

    Code:
    ALTER TABLE `tl_table` CHANGE `userId` `userId` INT(11) NOT NULL default 0;
    Any suggestions what am I doing wrong?

  2. #2
    Community-Moderator lucina's Avatar
    Join Date
    10-08-10.
    Location
    Issy-les-moulineaux
    Posts
    93

    Default

    Probably you have to enter it this way:
    int(11)NOTNULLdefault'0',
    For specific examples how to create your SQL statements you may have a look at the (german) wiki.

  3. #3
    New user BugBuster's Avatar
    Join Date
    09-27-09.
    Location
    Berlin, Germany
    Posts
    22

    Default

    I use this:

    PHP Code:
        'sql'           => "int(10) unsigned NOT NULL default '0'" 
    Last edited by BugBuster; 10/10/2013 at 14:32.
    Best regards, BugBuster [contao.ninja]
    Modules: Banner, Visitors, Integrity Check, Stardate, Bot Detection, ...

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •