Location: PHPKode > projects > phpLedMailer > db_schema.php
<?
/*
*
* $Id: db_schema.php,v 1.13 2005/09/08 16:21:22 ledjon Exp $
*
* phpLedMailer - v1.x
*
* by Jon Coulter
* http://www.ledscripts.com/
*
* This file contains the base meta version of the schema
* used when sync'ing database layouts (regardless of db engine).
*  - or -
* In other words... do NOT touch this unless you want to alter the
* structure of your database!
*
* Changes:
* 	- None
*
*/


// meta descriptions of our tables
$meta_tables = array(
	'plm_messages'	=>
		array(
			"messageid I4 AUTO NOTNULL,
				subject C(255) NOTNULL,
				content X NOTNULL,
				contentplain X,
				createdatetime T,
				onhold I2 NULL DEFAULT 0",
			array(
				'constraints' => ', constraint plm_messages_pk PRIMARY KEY (messageid)',
				'mysql' => 'TYPE=InnoDB'
			)
		),
	'plm_subscribers' =>
		array(
			"subscriberid I4 AUTO,
				emailaddr C(250) NOTNULL,
				firstname C(100),
				lastname C(100),
				userfield1 C(200), 
				userfield2 C(200),
				createdatetime T,
				pending I2 DEFAULT 1",
			array(
				'constraints'	=> ', CONSTRAINT plm_subscribers_pk PRIMARY KEY (subscriberid)',
				'mysql' => 'TYPE=InnoDB'
			)
		),
	'plm_users' =>
		array(
			"userid I AUTO,
				username C(100) NOTNULL,
				password C(32) NOT NULL",
			array(
				'constraints'	=> ', CONSTRAINT plm_users_pk PRIMARY KEY (userid)',
				'mysql' => 'TYPE=InnoDB'
			)
		),
	'plm_sub_queue' =>
		array(
			"subqueueid I AUTO,
				keyhash C(32),
				data X NOTNULL,
				action C(1),
				queuedatetime T",
			array(
				'constraints'	=> ', CONSTRAINT plm_sub_queue_pk PRIMARY KEY (subqueueid)',
				'mysql' => 'TYPE=InnoDB'
			)
		),
	'plm_cryptcheck' =>
		array(
			"userid I,
				euserid C(255),
				username C(255),
				password C(255),
				accessdatetime T",
			array(
				'constraints'	=>
					($_db_type == 'mysql' ? ", KEY plm_cryptcheck_mysql_required_key (userid)\n" : null) .
					', CONSTRAINT plm_users_fk FOREIGN KEY (userid) REFERENCES plm_users (userid) ON DELETE CASCADE',
				'mysql' => 'TYPE=InnoDB'
			)
		),
	'plm_message_queue' =>
		array(
			"messageid I4 NOTNULL,
				subscriberid I4 NOTNULL,
				sendcomplete I2 NOTNULL DEFAULT 0,
				senddatetime T",
			array(
				'constraints'	=> ', CONSTRAINT plm_message_queue_pk PRIMARY KEY (messageid, subscriberid), ' .
								   // rig specific to mysql here (go figure!)
								   // this key is a good idea in general, but it has
								   // to be created here for mysql because it wont allow
								   // the foreign key constraint to create otherwise
								   ($_db_type == 'mysql' ? "\nKEY (subscriberid), " : null) .
								   "\nCONSTRAINT plm_message_fk FOREIGN KEY (messageid) REFERENCES plm_messages (messageid) ON DELETE CASCADE," .
								   "\nCONSTRAINT plm_subsciber_fk FOREIGN KEY (subscriberid) REFERENCES plm_subscribers (subscriberid) ON DELETE CASCADE",
				'mysql' => 'TYPE=InnoDB'
			)
		),
	'plm_config'	=>
		array(
			"conf_key C(100) NOTNULL,
				conf_val C(255) NULL",
			array(
				'constraints'	=> ', CONSTRAINT plm_config_pk PRIMARY KEY (conf_key)',
				'mysql'	=> 'TYPE=InnoDB'
			)
		)
);

$meta_indexes = array(
	// table -> indexes -> columns -> constraints
	'plm_sub_queue'	=> 
		array(
			'plm_sub_queue_keyhash'	=>
				array(
					'keyhash',
					array( 'unique' )
				)
		),
	'plm_subscribers'	=>
		array(
			'plm_subscribers_emailaddr'	=>
				array(
					'emailaddr',
					array( 'unique' )
				)
		),
	'plm_users'		=>
		array(
			'plm_users_username'	=>
				array(
					'username',
					array( 'unique' )
				),
			'plm_users_userpass'	=>
				array(
					'username,password',
					array( )
				)
		),
	'plm_cryptcheck'	=>
		array(
			'plm_cryptcheck_userid'	=>
				array(
					'userid',
					array( )
				),
			'plm_cryptcheck_useriduserpass' =>
				array(
					'euserid,username,password',
					array( )
				),
			'plm_cryptcheck_accessdatetime'	=>
				array(
					'accessdatetime',
					array( )
				)
		)
);
?>
Return current item: phpLedMailer