0
作出弱關係我試圖做的是我的User
表和我的Confirmation
表之間的弱關係,Confirmation
Confirmation
弱User
弱。爲了表示它,我的架構如下:使用原則和symfony
User:
actAs: [Timestampable]
connection: doctrine
tableName: User
columns:
id:
type: integer
primary: true
autoincrement: true
username:
type: string(50)
notnull: true
name:
type: string(50)
notnull: true
.
.
.
indexes:
myindex1:
fields:
username:
sorting: ASC
length: 50
type: unique
relations:
Confirmation:
foreignType: one
attributes:
export: all
validate: true
Confirmation:
actAs: [Timestampable]
connection: doctrine
tableName: Confirmation
columns:
user_id:
type: integer
primary: true
hash:
type: string(64)
notnull: true
relations:
User:
local: user_id
foreign: id
type: one
foreignType: one
當運行命令$ php symfony doctrine:build --all --no-confirmation
,我得到這個錯誤輸出:
SQLSTATE[42000]: Syntax error or access violation: 1072 Key column 'id' doesn't exist in table. Failing Query: "CREATE TABLE Confirmation (user_id BIGINT, hash VARCHAR(64) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX id_idx (id), PRIMARY KEY(user_id)) ENGINE = INNODB". Failing Query: CREATE TABLE Confirmation (user_id BIGINT, hash VARCHAR(64) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX id_idx (id), PRIMARY KEY(user_id)) ENGINE = INNODB
因此,它似乎學說在現場生成索引這是沒有定義(id
),你可以在INDEX id_idx (id)
看到。爲什麼學說會生成這個索引?我怎樣才能塑造我想要的東西?
主義文檔不是在人際關係問題非常廣泛,任何一個環節有一個良好的文檔站點將是非常讚賞太...
在此先感謝您的幫助!