[go: up one dir, main page]

Menu

[r63]: / trunk / install / ideas.php  Maximize  Restore  History

Download this file

37 lines (32 with data), 1.5 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
/**
* Install Ideas Module
*
* This script sets up all the tables for the Ideas Module.
*/
// Drop existing tables
mysql_query("DROP TABLE IF EXISTS `sam_idea`") or die(mysql_error());
mysql_query("DROP TABLE IF EXISTS `sam_idea_vote`") or die(mysql_error());
// Create Idea Table
$sql = "CREATE TABLE `sam_idea` (
`id` INT(11) PRIMARY KEY AUTO_INCREMENT,
`name` VARCHAR(50) NOT NULL,
`description` TEXT NOT NULL,
`votes` INT(11) NOT NULL DEFAULT '0',
`status` VARCHAR(20) NOT NULL DEFAULT 'New',
`reporter` INT(11) NOT NULL DEFAULT '0',
`reported` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
`ticket` INT(11) NOT NULL DEFAULT '0',
KEY `reporter` (`reporter`)
) DEFAULT CHARSET=utf8";
mysql_query($sql) or die('ERROR ' . __FILE__ . ' [' . __LINE__ . ']<br/><br/>' . mysql_error() . "<br/><br/>$sql");
// Create User Table
$sql = "CREATE TABLE `sam_idea_vote` (
`id` INT(11) PRIMARY KEY AUTO_INCREMENT,
`user` INT(11) NOT NULL,
`idea` INT(11) NOT NULL,
`type` CHAR(1) NOT NULL,
KEY `user` (`user`),
KEY `idea` (`idea`)
) DEFAULT CHARSET=utf8";
mysql_query($sql) or die('ERROR ' . __FILE__ . ' [' . __LINE__ . ']<br/><br/>' . mysql_error() . "<br/><br/>$sql");