<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Delivering Quality &#187; database schema</title>
	<atom:link href="http://www.markdeepwell.com/tag/database-schema/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.markdeepwell.com</link>
	<description>A Software Developers View of the World</description>
	<lastBuildDate>Thu, 29 Jul 2010 16:44:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>An Alternative to symfony&#8217;s schema.yml</title>
		<link>http://www.markdeepwell.com/2009/08/an-alternative-to-symfonys-schema-yml/</link>
		<comments>http://www.markdeepwell.com/2009/08/an-alternative-to-symfonys-schema-yml/#comments</comments>
		<pubDate>Mon, 03 Aug 2009 04:13:07 +0000</pubDate>
		<dc:creator>Mark</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[database schema]]></category>
		<category><![CDATA[Propel]]></category>
		<category><![CDATA[symfony]]></category>

		<guid isPermaLink="false">http://www.markdeepwell.com/?p=96</guid>
		<description><![CDATA[The symfony web framework provides two methods for building the database model files when using the Propel Object-relational mapping (ORM) toolkit. The recommended method by the symfony team is to use the schema.yml file, where you explicitly explain your table structure. The second method is to generate a schema.xml file directly from the database. schema.yml: [...]]]></description>
			<content:encoded><![CDATA[<p>The symfony web framework provides two methods for building the database model files when using the <a href="http://propel.phpdb.org/">Propel Object-relational mapping</a> (ORM) toolkit. The  recommended method by the symfony team is to use the  <a href="http://www.symfony-project.org/book/1_2/08-Inside-the-Model-Layer#chapter_08_symfony_s_database_schema">schema.yml</a> file, where you explicitly explain your table structure. The second method is to generate a <a href="http://www.symfony-project.org/book/1_2/08-Inside-the-Model-Layer#chapter_08_sub_beyond_the_schema_yml_the_schema_xml">schema.xml</a> file directly from the database.</p>
<h3>schema.yml:<img class="alignright size-full wp-image-97" title="symfony schema yml" src="http://www.markdeepwell.com/wp-content/uploads/2009/08/symfony-schema-yml.png" alt="symfony schema yml" width="209" height="102" /></h3>
<p>Just edit config/schema.yml and list your tables, columns, column types, and foreign keys in YAML form. Build the model files by running:</p>
<pre>./symfony propel-build-model</pre>
<p>Pros:</p>
<ul>
<li> Interfaces better with  plugins because most, if not all, plugins use the schema.yml method</li>
<li>Can be used to create the database tables</li>
<li>Overall easier to use because it is the most common method</li>
</ul>
<p>Cons:</p>
<ul>
<li> Requires duplicate data by having the database structure in a text file, which can be outdated when the database is updated directly</li>
</ul>
<h3>schema.xml:</h3>
<p>To create the model files simply run:</p>
<pre>./symfony propel-build-schema xml
./symfony propel-build-model</pre>
<p>Pros:</p>
<ul>
<li>Supports ALL  database features</li>
<li>Supports the most complex schemas</li>
</ul>
<p>Cons:</p>
<ul>
<li>Errors while building the XML file are cryptic and time consuming to track down (eg: om-template)</li>
</ul>
<h3>Comparison</h3>
<p>The schema.yml method supports most projects with relative ease, but is limiting if you need to use more advanced database features that are not supported (propel only supports limited <a href="http://propel.phpdb.org/trac/wiki/Users/Documentation/1.3/ColumnTypes">column types</a>). Although, there are tricks to get around these limitations. For example, if you need to use column types that aren&#8217;t supported, like ENUM, you can simply declare the column as a varchar and Propel won&#8217;t know any better. This works fine for ENUM because it&#8217;s simply a text field, but may work for other column types too.</p>
<p>I recommend the schema.xml file for projects that have a very complex schema that cannot be represented in the yml file, or for projects already using XML files to define the database scheme.</p>
<p>I have used both methods on different large projects and have found the schema.yml method to provide faster  application development, have more  developer support, and easier to work with. I full recommend use of the schema.yml method in all but the most exceptional projects.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.markdeepwell.com/2009/08/an-alternative-to-symfonys-schema-yml/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
