2011-07-01 1 views
3

내가 옵션을 추가해야합니다 유형, 대조 및 캐릭터 세트, 예를 들어 :Doctrine에서 기본 유형, 데이터 정렬 및 문자 집합 데이터베이스를 설정하는 방법은 무엇입니까? 내가 심포니 1.4에 대한 교리 1.2 스키마를 구축 할 경우

AlSupplier: 
    options: 
    type: InnoDB 
    collate: utf8_unicode_ci 
    charset: utf8 
    columns: 
    company_name: 
     type: string(255) 

AlCountry: 
    options: 
    type: InnoDB 
    collate: utf8_unicode_ci 
    charset: utf8 
    columns: 
    country_name: 
     type: string(70) 

AlSupplierCategory: 
    actAs: 
    NestedSet: 
     hasManyRoots: true 
     rootColumnName: root_id 
    Searchable: 
     fields: [category_keywords] 
    options: 
    type: InnoDB 
    collate: utf8_unicode_ci 
    charset: utf8 
    columns: 
    category_name: 
     type: string(200) 
    category_description: 
     type: text 
    category_keywords: 
     type: text 

내가 어떻게 (유형, 대조, 캐릭터 세트)를 기본 옵션을 설정할 수 있습니까? 나는이 글을 쓸 때마다 싶지 않다.

답변

4

는 그냥 schema.yml 파일 파일의 상단을 선언하고 그들은 모든 테이블에 적용됩니다 :

options: 
    type: InnoDB 
    collate: utf8_unicode_ci 
    charset: utf8 

자료 : I 톰의 솔루션에 동의 http://www.symfony-project.org/doctrine/1_2/en/04-Schema-Files#chapter_04_global_schema_information

+0

감사합니다! 예를 들어 AlSupplier에 대해 예를 들면 다음과 같습니다. collate를 비활성화하면 할 일이 무엇입니까? –

+0

@Beyed Black ... 확실하지는 않습니다. 먼저 시도해 보는 것이 가장 안전 할 것입니다. 내 생각 엔 테이블 수준에서 선언 한 내용이 전역 설정보다 우선한다는 것입니다. 그게 내가 기대할 수있는 방법이야. – Tom

0

합니다. Another option는 것 -을 정의하기 위해 ProjectConfiguration.php에 - 당신이 InnoDB하지만 (예를 들어, 또한 플러그인에 대한) 전 세계적으로 사용하려는 경우 :

public function configureDoctrineConnection(Doctrine_Connection $connection) 
{ 
    $connection->setAttribute(Doctrine::ATTR_DEFAULT_TABLE_TYPE, 'InnoDB'); 
} 
관련 문제