Skip to content

added a note about database default charsets/collations #1563

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 29, 2012
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions book/doctrine.rst
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,32 @@ information. By convention, this information is usually configured in an
of your project, like inside your Apache configuration, for example. For
more information, see :doc:`/cookbook/configuration/external_parameters`.

.. sidebar:: Setting Up The Database

One mistake even seasoned developers make when starting a Symfony2 project
is forgetting to setup default charset and collation on their database,
ending up with latin type collations, which are default for most databases.
They might even remember to do it the very first time, but forget that
it's all gone after running a relatively common command during development:

.. code-block:: bash

$ app/console doctrine:database:drop --force
$ app/console doctrine:database:create

There's no way to configure these defaults inside doctrine, as it tries to be
as agnostic as possible in terms of enviroment configuration, so only way around it
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so the only way?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bschussek ha-ha, good catch! :D Fixed wording a bit

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I was just referring to the missing "the" :) But hey, even better now!

is to configure server level defaults.

Setting UTF8 defaults for MySQL is as simple as adding a few lines to configuration file
(typically ``my.cnf``):

.. code-block:: ini

[mysqld]
collation-server = utf8_general_ci
character-set-server = utf8

Now that Doctrine knows about your database, you can have it create the database
for you:

Expand Down
2 changes: 1 addition & 1 deletion book/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ If there are any issues, correct them now before moving on.

Note that using the ACL is recommended when you have access to them
on your server because changing the umask is not thread-safe.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra blank spaces here

When everything is fine, click on "Go to the Welcome page" to request your
first "real" Symfony2 webpage:

Expand Down