Nowe posty

Autor Wątek: symfony schema.yml - blog  (Przeczytany 12909 razy)

  • Gość
symfony schema.yml - blog
« dnia: 2010-12-05, 17:47:42 »
Próbowałem zrobić plik schema.yml pod prosty blog:

user:
  actAs: { Timestampable: ~ }
  columns:
    name:        { type: string(255), unique: false, notnull: true }
    last_name:   { type: string(1024), unique: false, notnull: true }
    email:       { type: string(255), unique: true, notnull: false }
    created_at:  { type: datetime, unique: false, notnull: true }
  relations:
    userauthor:
      class: news
      local: id
      foreign: author_id  
   
news:
  actAs: { Timestampable: ~ }
  columns:
    description: { type: string(255), unique: true,  notnull: true }
    contents:    { type: string(65536), unique: true, notnull: true }
    created_at:  { type: datetime, unique: false, notnull: true }
    author_id:      { type: integer, unique: false, notnull: true }    
  relations:
    author:
      class: user
      local: author_id
      foreign: id
    tagnews:
      class: user
      refClass: newstags
      local: news_id
      foreign: tag_id  
     
tag:
  actAs: { Timestampable: ~ }
  columns:
    name: { type: string(255), unique: true, notnull: true }
    created_at: { type: datetime }
  relations:
    tagnews:
      class: news
      refClass: newstags
      local: tag_id
      foreign: news_id
     

newstags:
  actAs: { Timestampable: ~ }
  columns:
    news_id: { type: integer, unique: false, notnull: true }
    tag_id:  { type: integer, unique: false, notnull: true }
  relations:
    news:
      foreignAlias: newstag
    tag:
      foreignAlias: newstag
Jednak podczas budowania parser wyświetla mnie coś takiego:

Cytuj
SQLSTATE[42000]: Syntax error or access violation: 1170 BLOB/TEXT column 'contents' used in key specification without a key length. Failing Query: "CREATE TABLE news (id BIGINT AUTO_INCREMENT, description VARCHAR(255) NOT NULL UNIQUE, contents TEXT NOT NULL UNIQUE, created_at DATETIME NOT NULL, author_id BIGINT NOT NULL, updated_at DATETIME NOT NULL, INDEX author_id_idx (author_id), PRIMARY KEY(id)) ENGINE = INNODB". Failing Query: CREATE TABLE news (id BIGINT AUTO_INCREMENT, description VARCHAR(255) NOT NULL UNIQUE, contents TEXT NOT NULL UNIQUE, created_at DATETIME NOT NULL, author_id BIGINT NOT NULL, updated_at DATETIME NOT NULL, INDEX author_id_idx (author_id), PRIMARY KEY(id)) ENGINE = INNODB
Co robię źle?