comparison image/ad_image.install @ 0:d8a3998dac8e ad

ajout module ad
author pierre
date Fri, 20 Feb 2009 14:04:09 +0000
parents
children 948362c2a207
comparison
equal deleted inserted replaced
-1:000000000000 0:d8a3998dac8e
1 <?php
2 // $Id: ad_image.install,v 1.2.2.2.2.6.2.4 2009/02/16 17:06:49 jeremy Exp $
3
4 /**
5 * @file
6 * Ad_image module database schema.
7 *
8 * Copyright (c) 2005-2009.
9 * Jeremy Andrews <jeremy@tag1consulting.com>.
10 */
11
12 /**
13 * Implementation of hook_schema().
14 */
15 function ad_image_schema() {
16 $schema['ad_image'] = array(
17 'description' => 'The ad_image table stores image information such as file ID, title, width, height of corresponding image ads.',
18 'fields' => array(
19 'aid' => array(
20 'type' => 'int',
21 'unsigned' => TRUE,
22 'not null' => TRUE,
23 'default' => 0,
24 ),
25 'fid' => array(
26 'type' => 'int',
27 'unsigned' => TRUE,
28 'not null' => TRUE,
29 'default' => 0,
30 ),
31 'url' => array(
32 'type' => 'varchar',
33 'length' => '255',
34 'not null' => TRUE,
35 'default' => '',
36 ),
37 'tooltip' => array(
38 'type' => 'varchar',
39 'length' => '255',
40 'not null' => TRUE,
41 'default' => '',
42 ),
43 'width' => array(
44 'type' => 'int',
45 'unsigned' => TRUE,
46 'not null' => TRUE,
47 'default' => 0,
48 ),
49 'height' => array(
50 'type' => 'int',
51 'unsigned' => TRUE,
52 'not null' => TRUE,
53 'default' => 0,
54 ),
55 ),
56 'unique keys' => array(
57 'aid' => array('aid')
58 ),
59 );
60 $schema['ad_image_format'] = array(
61 'description' => 'The ad_image_format table stores dimensions for image ads.',
62 'fields' => array(
63 'gid' => array(
64 'type' => 'int',
65 'unsigned' => TRUE,
66 'not null' => TRUE,
67 ),
68 'min_width' => array(
69 'type' => 'int',
70 'unsigned' => TRUE,
71 'not null' => TRUE,
72 'default' => 0,
73 ),
74 'max_width' => array(
75 'type' => 'int',
76 'unsigned' => TRUE,
77 'not null' => TRUE,
78 'default' => 0,
79 ),
80 'min_height' => array(
81 'type' => 'int',
82 'unsigned' => TRUE,
83 'not null' => TRUE,
84 'default' => 0,
85 ),
86 'max_height' => array(
87 'type' => 'int',
88 'unsigned' => TRUE,
89 'not null' => TRUE,
90 'default' => 0,
91 ),
92 ),
93 'primary key' => array('gid'),
94 );
95
96 return $schema;
97 }
98
99
100 /**
101 * ad_image module installation.
102 */
103 function ad_image_install() {
104 drupal_install_schema('ad_image');
105 }
106
107 /**
108 * Allow complete uninstallation of the ad_image module.
109 */
110 function ad_image_uninstall() {
111 // Delete all ad_image content.
112 $result = db_query("SELECT aid FROM {ad_image}");
113 while ($aid = db_result($result)) {
114 node_delete($aid);
115 }
116
117 // Remove tables.
118 drupal_uninstall_schema('ad_image');
119 }