0

I have a problem but with the following code. I am creating the following Schema:

  $schema['billfold'] = [
    'description' => 'Stores example person entries for demonstration purposes.',
    'fields' => [
      'pid' => [
        'type' => 'serial',
        'not null' => TRUE,
        'description' => 'Primary Key: Unique person ID.',
      ],
      'data' => [
        'type' => 'datetime_default',
        'not null' => TRUE,
        'description' => 'The date when the update has been done.',
      ],
    ]
  ];

How Can I set the type "Datetime" and default value of ON UPDATE (for istance)???

  • I did it only from phpMyAdmin – Emilio May 28 at 10:49
  • Drupal's DB schema APIs don't support MySQL triggers (probably because they're not available in every DBMS). Continue adding them manually, or maybe as part of an update hook. For DBMS-specific types, you can use, for example, mysql_type instead of type. See api.drupal.org/api/drupal/includes%21database%21schema.inc/… for more info – Clive May 28 at 11:14
  • @Clive thank you for your suggestion! – Emilio May 29 at 8:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.