目前,如果我执行以下操作,它只会生成schema.yml:
./ symfony doctrine:build-schema
但这不会产生关系。
我是否必须手动将它们添加到schema.yml中,还是有办法生成它们?如果我必须手动输入它,下次执行doctrine:build-schema
时不会覆盖它们(用新表刷新模式等)?
这是schema.yml:
Companies:
connection: doctrine
tableName: companies
columns:
company_id:
type: integer(4)
fixed: false
unsigned: false
primary: true
autoincrement: true
company_name:
type: string(100)
fixed: false
unsigned: false
primary: false
notnull: true
autoincrement: false
company_logo:
type: string(100)
fixed: false
unsigned: false
primary: false
notnull: true
autoincrement: false
company_date_added:
type: timestamp(25)
fixed: false
unsigned: false
primary: false
notnull: true
autoincrement: false
Credentials:
connection: doctrine
tableName: credentials
columns:
credential_id:
type: integer(4)
fixed: false
unsigned: false
primary: true
autoincrement: true
credential_name:
type: string(100)
fixed: false
unsigned: false
primary: false
notnull: true
autoincrement: false
company_id:
type: integer(4)
fixed: false
unsigned: false
primary: false
notnull: true
autoincrement: false
credential_date_added:
type: timestamp(25)
fixed: false
unsigned: false
primary: false
default: '0000-00-00 00:00:00'
notnull: true
autoincrement: false
Groups:
connection: doctrine
tableName: groups
columns:
group_id:
type: integer(4)
fixed: false
unsigned: false
primary: true
autoincrement: true
group_name:
type: string(100)
fixed: false
unsigned: false
primary: false
notnull: true
autoincrement: false
company_id:
type: integer(4)
fixed: false
unsigned: false
primary: false
notnull: true
autoincrement: false
group_date_added:
type: timestamp(25)
fixed: false
unsigned: false
primary: false
default: '0000-00-00 00:00:00'
notnull: true
autoincrement: false
GroupsCredentials:
connection: doctrine
tableName: groups_credentials
columns:
group_credential_id:
type: integer(4)
fixed: false
unsigned: false
primary: true
autoincrement: true
group_id:
type: integer(4)
fixed: false
unsigned: false
primary: false
notnull: true
autoincrement: false
credential_id:
type: integer(4)
fixed: false
unsigned: false
primary: false
notnull: true
autoincrement: false
group_credential_date_added:
type: integer(4)
fixed: false
unsigned: false
primary: false
notnull: true
autoincrement: false
Users:
connection: doctrine
tableName: users
columns:
user_id:
type: integer(4)
fixed: false
unsigned: false
primary: true
autoincrement: true
user_username:
type: string(100)
fixed: false
unsigned: false
primary: false
notnull: true
autoincrement: false
user_password:
type: string(100)
fixed: false
unsigned: false
primary: false
notnull: true
autoincrement: false
user_email:
type: string(100)
fixed: false
unsigned: false
primary: false
notnull: true
autoincrement: false
company_id:
type: integer(4)
fixed: false
unsigned: false
primary: false
notnull: true
autoincrement: false
user_date_added:
type: timestamp(25)
fixed: false
unsigned: false
primary: false
notnull: true
autoincrement: false
UsersCredentials:
connection: doctrine
tableName: users_credentials
columns:
user_credential_id:
type: integer(4)
fixed: false
unsigned: false
primary: true
autoincrement: true
user_id:
type: integer(4)
fixed: false
unsigned: false
primary: false
notnull: true
autoincrement: false
credential_id:
type: integer(4)
fixed: false
unsigned: false
primary: false
notnull: true
autoincrement: false
user_credential_date_added:
type: timestamp(25)
fixed: false
unsigned: false
primary: false
default: '0000-00-00 00:00:00'
notnull: true
autoincrement: false
答案 0 :(得分:0)
我最终解决了这个问题。
在MySQL数据库中没有正确设置关系 - 我这是一个愚蠢的错误。