Error in installing custom module in drupal 8

0

I have created a custom form which stores the name of the book and the type of the book. I have created the mymodule.install file but I cant install the module. It shows the following error,

Notice: Undefined index: :normal in Drupal\Core\Database\Driver\mysql\Schema->processField()

I have pasted the .install file, please let me know where the syntax error is:

<?php

 function mymodule_schema() {
 $schema['mymodule'] = [
  'description' => 'Stores book name and book type',
  'fields' => [
    'id' => [
    'description' => 'The primary identifier for the record.',
    'type' => 'serial',
    'unsigned' => TRUE,
    'not null' => TRUE,
  ],

    'book_name' => [
    'description' => 'Name of the book.',
    'type' => 'varchar',
    'length' => 255,
    'not null' => TRUE,
  ],

    'book_type' => [
    'description' => 'The type of book.',
    'type' => 'varchar',
    'length' => 255,
    'not null' => TRUE,
  ],
  'primary key' => ['id'],

  ],
];

 return $schema;
}

Saptaparnee

Posted 2019-07-08T07:17:53.830

Reputation: 1

Answers

0

I had a similar issue. It looks like you had the same problem as I did.

The primary key definition needs to be outside the fields array.

Jordon Davidson

Posted 2019-07-08T07:17:53.830

Reputation: 1