<?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>RubberNeck Designs &#187; Drupal</title>
	<atom:link href="http://www.rubberneckdesigns.com/tag/drupal/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rubberneckdesigns.com</link>
	<description>Drupal Web Developer Notes &#38; Sharing</description>
	<lastBuildDate>Tue, 31 Jan 2012 00:28:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Schema Data Structure Documentation in Drupal</title>
		<link>http://www.rubberneckdesigns.com/drupal-6-drupal-7/schema-data-structure-documentation-in-drupal/</link>
		<comments>http://www.rubberneckdesigns.com/drupal-6-drupal-7/schema-data-structure-documentation-in-drupal/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 23:06:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Drupal 6 & Drupal 7]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[Drupal]]></category>
		<category><![CDATA[Drupal database scheme]]></category>
		<category><![CDATA[Drupal install file]]></category>
		<category><![CDATA[Drupal module install]]></category>

		<guid isPermaLink="false">http://rubberneckdesigns.com/?p=210</guid>
		<description><![CDATA[I have been working on a project on the Drupal 6 platform that requires the web application to recognize dynamically created sub-domains so the functionality of the database can be adjusted according to what sub-domain is in the current URL. To get Drupal 6 to do this, I am creating a custom module. One of [...]]]></description>
			<content:encoded><![CDATA[<p>I have been working on a project on the Drupal 6 platform that requires the web application to recognize dynamically created sub-domains so the functionality of the database can be adjusted according to what sub-domain is in the current URL.</p>
<p>To get Drupal 6 to do this, I am creating a custom module. One of the things I have learned about creating a custom module in Drupal 6 is the implementation of the module&#8217;s “install” file.</p>
<p>If you create a module named say,  my_module.module then the module&#8217;s install file name would be  my_module.install and will reside in the directory named my_module located at&#8230;.</p>
<p>my_site/sites/all/modules/my_module</p>
<p><a href="http://http://drupal.org/node/323314">Drupal 6 Module Install File Documentation</a></p>
<p>The  .install file will be run by Drupal 6 the 1st time my_module has been enabled. The my_module.install file will then be used to run setup procedures as stipulated by your module. The most common task for the my_module.install file to perform is creating database tables and fields. There is no special syntax for the install file. It is simply a PHP file with a .install extension to properly identify it to the Drupal 6 platform.</p>
<p>There is special function used in the .install file called hook_schema(). Where hook would be replaced by the name of your module. For example, if  the module you create is named my_module, then you would create a PHP file and name it my_module.install. Inside that file you will create a function named  my_module_schema(). The my_module_schema() function is used to create arrays representingthe database tables you wish the module to create in the Drupal database. You can see how this works here.</p>
<h3>Why do it this way?</h3>
<p>Once you build the Drupal API Schema there is no more need for  separate CREATE TABLE or ALTER TABLE statements on each database. As a module developer, you only need to create a schema structure and/or use the Drupal Schema API functions, and Drupal takes care of the rest. This greatly simplifies  writing install and update functions.</p>
<p>This way of creating the module install files also allows for support in multiple database platforms.</p>
<p>According to Drupal&#8217;s Blog this also allows for “Several advanced capabilities, such as incremental database updates, a simple and consistent CRUD API, form scaffolding, simpler CCK and Views, schema and data validation, become much easier to implement in future enhancements.”</p>
<p><a href="http://http://drupal.org/node/146866">Schema Data Structure Documentation by Drupal</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.rubberneckdesigns.com/drupal-6-drupal-7/schema-data-structure-documentation-in-drupal/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

