Impossibile aggiungere una chaive esterna
Buongiorno,
non riesco ad aggiungere una chiave esterna,e se provo a fare un alter non mi da nessun errore ma non mi crea la chiave esterna.
In locale sul mio PC funziona, ma nel database di Altervista no.
Queste sono le tabelle che non riesco a collegare:
CREATE TABLE squadre(
id_utente INTEGER(9) NOT NULL,
nome_squadra VARCHAR(100) NOT NULL,
CONSTRAINT pk_squadre_utenti PRIMARY KEY(id_utente, nome_squadra),
CONSTRAINT fk_id_utente FOREIGN KEY (id_utente) REFERENCES utenti(idTelegramUtente)
)ENGINE = InnoDB;
CREATE TABLE squadre_giocatore(
id_utente INTEGER(9) NOT NULL,
nome_squadra VARCHAR(100) NOT NULL,
id_giocatore INTEGER NOT NULL,
CONSTRAINT pk_squadre_giocatori PRIMARY KEY (id_utente, nome_squadra, id_giocatore),
CONSTRAINT fk_squadre FOREIGN KEY (id_utente, nome_squadra) REFERENCES squadre(id_utente, nome_squadra),
CONSTRAINT fk_id_giocatore FOREIGN KEY (id_giocatore) REFERENCES giocatori(id_giocatore)
)ENGINE = InnoDB;