creazione di più tabelle in modulo
Buon pomeriggio,
sto facendo un modulo custom ed ho la necessità di creare più tabelle.
Ho creato il file nomemodulo.install e son riuscito a creare la prima tabella, ma non riesco a creare la secondo tabella e mi da errore drupal questo è il contenuto del file...
<?php
/**
* @file
* Install, update and uninstall functions for the GESTIONEUTENTI module.
*/
/**
* Implements hook_schema().
*/
function gestioneutenti_schema() {
$schema= array();
$schema['utentickan'] = [
'description' => 'Memorizza utenti da inserire in ckan',
'fields' => [
'idutente' => [
'description' => 'session id utente',
'type' => 'serial',
'not null' => TRUE,
],
'username' => [
'description' => 'username utente',
'type' => 'varchar',
'length' => 100,
'not null' => FALSE,
],
'nomeCompleto' => [
'description' => "nome completo utente",
'type' => 'varchar',
'length' => 100,
'not null' => FALSE,
],
'email' => [
'description' => "Email utente",
'type' => 'varchar',
'length' => 50,
'not null' => TRUE,
'default' => '',
],
'password' => [
'description' => 'Password utente',
'type' => 'varchar',
'length' => 50,
'not null' => FALSE,
],
'ckankey' => [
'description' => 'Chiave ckan',
'type' => 'varchar',
'length' => 100,
'not null' => FALSE,
],
'dataCreazione' => [
'description' => 'A Unix timestamp indicante la generazione utente.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
],
],
'primary key' => ['idutente'],
'indexes' => [
'indici' => ['username', 'email'],
],
];
/*****/
$schema['organizzazione'] = [
'description' => 'Memorizza organizzazioni di utenti',
'fields' => [
'idOrganizzazione' => [
'description' => 'Id organizzazione',
'type' => 'serial',
'not null' => TRUE,
],
'nomeOrganizzazione' => [
'description' => 'nome organizzazione',
'type' => 'varchar',
'length' => 100,
'not null' => FALSE,
],
'descrizioneOrganizzazione' => [
'description' => "Descrizione organizzazione",
'type' => 'varchar',
'length' => 100,
'not null' => FALSE,
],
'pathDBDrupalImmagine' => [
'description' => 'percorso immagine drupal',
'type' => 'varchar',
'length' => 100,
'not null' => FALSE,
],
'linkImmagine' => [
'description' => 'Link immagine logo organizzazione',
'type' => 'varchar',
'length' => 100,
'not null' => FALSE,
],
'email' => [
'description' => 'Email organizzazione',
'type' => 'varchar',
'length' => 50,
'not null' => FALSE,
],
'telefono' => [
'description' => 'Telefono organizzazione',
'type' => 'varchar',
'length' => 100,
'not null' => FALSE,
],
'url' => [
'description' => 'Url organizzazione',
'type' => 'varchar',
'length' => 100,
'not null' => FALSE,
],
'regione' => [
'description' => 'Regione organizzazione',
'type' => 'varchar',
'length' => 100,
'not null' => FALSE,
],
'codiceIPAIVA' => [
'description' => 'Telefono organizzazione',
'type' => 'varchar',
'length' => 100,
'not null' => FALSE,
],
'dataCreazione' => [
'description' => 'A Unix timestamp indicante la generazione utente.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
],
],
'primary key' => ['description'],
'indexes' => [
'indici' => ['nomeOrganizzazione', 'email'],
],
];
return $schema;
}
dove sbaglio ??
Risposte
Prova a controllare 'primary
Prova a controllare
'primary key' => ['description'],
andato era quello errore, un
andato era quello errore, un copia incolla sbagliato :)