schema.yml invalide et errno 150
Bonjour, j'ai un problème avec mon schema.yml :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
| Membre:
inheritance:
extends: sfGuardUser
type: simple
columns:
date_naissance: date
lieu: string(45)
relations:
ConversationsPrivees:
class: ConversationPrivee
refClass: MembreConversationPrivee
local: user_id
foreign: conversation_id
foreignAlias: Membres
ConversationPrivee:
columns:
id:
type: integer
unsigned: true
primary: true
autoincrement: true
sujet:
type: string(45)
notnull: true
MembreConversationPrivee:
columns:
user_id: { type: integer, unsigned: true, primary: true }
conversation_id: { type: integer, unsigned: true, primary: true }
relations:
Membre: { onDelete: CASCADE, local: user_id, foreign: id }
ConversationPrivee: { onDelete: CASCADE, local: conversation_id, foreign: id }
MessagePrive:
columns:
id:
type: integer
unsigned: true
primary: true
autoincrement: true
user_id:
type: integer
unsigned: true
notnull: false
conversation_id:
type: integer
unsigned: true
notnull: true
message: string()
created_at: datetime
updated_at: datetime
relations:
ConversationPrivee:
local: conversation_id
foreign: id
foreignAlias: MessagesPrives
onDelete: CASCADE
Membre:
local: user_id
foreign: id
foreignAlias: MessagesPrives
onDelete: SET NULL |
Il y a un Many-To-Many entre ConversationPrivee et Membre.
Déjà, est-il logique et bien formé ? Je me suis inspiré du schema de jobeet.
Ensuite, j'ai une errno 150 classique, mais je vois pas le problème :
General error: 1005 Can't create table 'skepin.#sql-333_bc' (errno: 150). Failing Query: "ALTER TABLE participant ADD CONSTRAINT participant_conversation_id_conversation_privee_id FOREIGN KEY (conversation_id) REFERENCES conversation_privee(id) ON DELETE CASCADE"
Edit : notez que j'ai essayé avec l'exemple de la doc Doctrine :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
| Membre:
inheritance:
extends: sfGuardUser
type: simple
columns:
date_naissance: date
lieu: string(45)
relations:
ConversationsPrivees:
class: ConversationPrivee
local: user_id
foreign: conversation_id
refClass: MembreConversationPrivee
ConversationPrivee:
columns:
id:
type: integer
unsigned: true
primary: true
autoincrement: true
sujet:
type: string(45)
notnull: true
relations:
Participants:
class: Membre
local: conversation_id
foreign: user_id
refClass: MembreConversationPrivee
MembreConversationPrivee:
tableName: participant
columns:
user_id: { type: integer, unsigned: true, primary: true }
conversation_id: { type: integer, unsigned: true, primary: true }
MessagePrive:
columns:
id:
type: integer
unsigned: true
primary: true
autoincrement: true
user_id:
type: integer
unsigned: true
conversation_id:
type: integer
unsigned: true
notnull: true
message: string()
created_at: datetime
updated_at: datetime
relations:
ConversationPrivee:
local: conversation_id
foreign: id
foreignAlias: MessagesPrives
onDelete: CASCADE
Membre:
local: user_id
foreign: id
foreignAlias: Participants
onDelete: SET NULL |
Sans succès : même erreur
EDIT: Erreur trouvée, l'id de sfGuardUser n'est pas unsigned...