简体   繁体   中英

database schema is not creating in drupal 8

i am creating a database schema using code in .install file but it's not creating any schema.my modules is work where i have defined the custom form but when i am creating this and run this code it's return empty so what's wrong in this. here is my code:

function drupalup_simple_form_schema()
{
  $schema['drupal_table'] = array
  (
      'fields' =>array
      (

          'id'=>array
          (
            'type'=>'serial',
            'length'=>11,
            'unsigned' =>TRUE,
            'not null'=>TRUE,
          ),

          'uid'=>array
          (
            'type'=>'int',
            'length'=>11,
            'not null'=>TRUE,
            'default'=>0,
          ),

          'first_name'=>array
          (
            'type'=>'varchar',
            'length'=>255,
            'not null'=>FALSE,
            'default'=>'',
          ),

      ),
       'primary key' => array('id'), 
  );

  return $schema;
}
?>```

i am creating a database schema using code in .install file but it's not creating any schema.my modules is work where i have defined the custom form but when i am creating this and run this code it's return empty so what's wrong in this. here is my code:

function drupalup_simple_form_schema()
{
  $schema['drupal_table'] = array
  (
      'fields' =>array
      (

          'id'=>array
          (
            'type'=>'serial',
            'length'=>11,
            'unsigned' =>TRUE,
            'not null'=>TRUE,
          ),

          'uid'=>array
          (
            'type'=>'int',
            'length'=>11,
            'not null'=>TRUE,
            'default'=>0,
          ),

          'first_name'=>array
          (
            'type'=>'varchar',
            'length'=>255,
            'not null'=>FALSE,
            'default'=>'',
          ),

      ),
       'primary key' => array('id'), 
  );

  return $schema;
}
?>```

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM