Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Decimals will allow for such large numbers and allow you to keep the SchemaTool, just set the scale to 0.</p> <pre><code>&lt;?php /** * @Column(type="decimal", precision=20, scale=0, nullable=false, unique=true) */ Protected $facebookId; </code></pre> <p>Checkout a full writeup on why <a href="http://lifeinabash.com/post/21855249367/unsigned-doctrine" rel="nofollow noreferrer">here</a>. [EDIT](link does not work) I have pasted the article below. It was written by me anyways ;)</p> <p><strong>unsigned numbers so large your brain will explode! w/Doctrine 2</strong></p> <p>ORMs have an inherent problem. How do you take a datatype only some RDBMSs support and allow you to use it anyways. Well when it comes to Doctrine 2 and unsigned numbers they got a little lazy.</p> <p>All I want to do is store my 64bit facebook IDs. How hard is that? Well my RDBMS is mySQL so all I really need is an unsigned bigint.</p> <pre><code>&lt;?php /** * @Column(type="bigint", nullable=false, unique=true, columnDefinition="unsigned") */ Protected $facebookId; </code></pre> <p>This seems find and dandy until you read this: </p> <p>columnDefinition: DDL SQL snippet that starts after the column name and specifies the complete (non-portable!) column definition. This attribute allows to make use of advanced RMDBS features. However you should make careful use of this feature and the consequences. SchemaTool will not detect changes on the column correctly anymore if you use “columnDefinition”. Basically this feature let’s you free form unsupported things into the column definition. Making unsigned numbers technically UN-SUPPORTED! Not to mention my dev and QA deployment systems rely heavily on the SchemaTool. We can thank a combination of lazy developers at Doctrine and sqlite3 for this little nugget of crazy town.</p> <p>This immediately prompted a google search. I don’t like thinking if I don’t have to. What did I find? Everybody’s using varchars. VARCHARS!?!? I about had a heart attack. That was just unacceptable.</p> <p>Thus enters decimal. It’s perfect. The storage size is variable and it’s stored in binary so indexing is super fast. We just set the decimal precision to zero and voilà. The ORM can port this to any RDBMS, it’s big enough for us not to care about the unsupported signed/unsigned issue and it’s lightning fast. decimal(20,0) should handle our facebook size of eighteen quintillion four hundred and forty six quadrillion seven hundred and forty four trillion seventy three billion seven hundred and nine million five hundred and fifty one thousand six hundred and fifteen quite nicely.</p> <pre><code>&lt;?php /** * @Column(type="decimal", precision=20, scale=0, nullable=false, unique=true) */ Protected $facebookId; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload