views:

33

answers:

1

Hi!

I have the following schema for the generation of a table/model class named Account:

Account:
  actAs:
    Timestampable: ~
    SoftDelete:
      name: deleted
      type: boolean
  columns:
    branch_code:
      type: integer
      notnull: true
    state_id:
      type: integer
      notnull: true
    state_description:
      type: string(20)
      notnull: true
    number:
      type: integer
      notnull: true
    client_name:
      type: string(100)
      notnull: true
    client_code:
      type: integer
      notnull: true
    associated_do:
      type: integer
      notnull: true
    loan_start_date:
      type: datetime
      notnull: true
    first_missing_payment:
      type: datetime
      notnull: true
    delay:
      type: integer
      notnull: true
    balance:
      type: float
      notnull: true
    limit:
      type: float
      notnull: true
    lawyer_id:
      type: integer
    internal_user_id:
      type: integer
    solicitor_id:
      type: integer
  relations:
     Lawyer:
       local: lawyer_id
       foreign: id
     InternalUser:
       local: internal_user_id
       foreign: id
     Solicitor:
       local: solicitor_id
       foreign: id
     Branch:
       local: branch_code
       foreign: code
     Evolutions:
       type: many
       class: Evolution
       local: id  
       foreign: account_id

When I run the symfony task to reload the database, occurs the error bellow:

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'limit FLOAT(18, 2) NOT NULL, lawyer_id BIGINT, internal_user_id BIGINT, solicito' at line 1. Failing Query: "CREATE TABLE account (id BIGINT AUTO_INCREMENT, branch_code BIGINT NOT NULL, state_id BIGINT NOT NULL, state_description VARCHAR(20) NOT NULL, number BIGINT NOT NULL, client_name VARCHAR(100) NOT NULL, client_code BIGINT NOT NULL, associated_do BIGINT NOT NULL, loan_start_date datetime NOT NULL, first_missing_payment datetime NOT NULL, delay BIGINT NOT NULL, balance FLOAT(18, 2) NOT NULL, limit FLOAT(18, 2) NOT NULL, lawyer_id BIGINT, internal_user_id BIGINT, solicitor_id BIGINT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, deleted TINYINT(1) DEFAULT '0' NOT NULL, INDEX lawyer_id_idx (lawyer_id), INDEX internal_user_id_idx (internal_user_id), INDEX solicitor_id_idx (solicitor_id), INDEX branch_code_idx (branch_code), PRIMARY KEY(id)) ENGINE = INNODB". Failing Query: CREATE TABLE account (id BIGINT AUTO_INCREMENT, branch_code BIGINT NOT NULL, state_id BIGINT NOT NULL, state_description VARCHAR(20) NOT NULL, number BIGINT NOT NULL, client_name VARCHAR(100) NOT NULL, client_code BIGINT NOT NULL, associated_do BIGINT NOT NULL, loan_start_date datetime NOT NULL, first_missing_payment datetime NOT NULL, delay BIGINT NOT NULL, balance FLOAT(18, 2) NOT NULL, limit FLOAT(18, 2) NOT NULL, lawyer_id BIGINT, internal_user_id BIGINT, solicitor_id BIGINT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, deleted TINYINT(1) DEFAULT '0' NOT NULL, INDEX lawyer_id_idx (lawyer_id), INDEX internal_user_id_idx (internal_user_id), INDEX solicitor_id_idx (solicitor_id), INDEX branch_code_idx (branch_code), PRIMARY KEY(id)) ENGINE = INNODB

I checked and re-checked the schema definition for possible errors but everything seems fine to me.

Can anyone give me some help?

Thanks in advance, Best regards!

A: 

Hi!

I was trying to declare a columns named limit which is a SQL reserved keyword.

Best regards!

Rui Gonçalves