Browse Source

use UNSIGNED for `id` columns

pull/40/head
Michael Save 12 years ago
parent
commit
c96b27eb5b
  1. 10
      README.md
  2. 12
      install.php
  3. 14
      install.sql
  4. 2
      templates/posts.sql

10
README.md

@ -21,11 +21,11 @@ it need one.
Contributing Contributing
------------ ------------
* Use GitHub to submit a pull request. You can contribute to Tinyboard by:
* Send feedbacks * Developing patches/improvements/translations and using GitHub to submit pull requests
* Fix bugs or add features * Providing feedback and suggestions
* Write/Edit the Wiki * Writing/editing documentation
If you need help developing a patch, join our IRC channel. If you need help developing a patch, please join our IRC channel.
Installation Installation
------------- -------------

12
install.php

@ -1,7 +1,7 @@
<?php <?php
// Installation/upgrade file // Installation/upgrade file
define('VERSION', 'v0.9.6-dev-5'); define('VERSION', 'v0.9.6-dev-6');
require 'inc/functions.php'; require 'inc/functions.php';
@ -212,6 +212,16 @@ if (file_exists($config['has_installed'])) {
query("ALTER TABLE `antispam` CHANGE `hash` `hash` CHAR( 40 ) NOT NULL") or error(db_error()); query("ALTER TABLE `antispam` CHANGE `hash` `hash` CHAR( 40 ) NOT NULL") or error(db_error());
case 'v0.9.6-dev-4': case 'v0.9.6-dev-4':
query("ALTER TABLE `news` DROP INDEX `id`, ADD PRIMARY KEY ( `id` )") or error(db_error()); query("ALTER TABLE `news` DROP INDEX `id`, ADD PRIMARY KEY ( `id` )") or error(db_error());
case 'v0.9.6-dev-5':
query("ALTER TABLE `bans` CHANGE `id` `id` INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT") or error(db_error());
query("ALTER TABLE `mods` CHANGE `id` `id` INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT") or error(db_error());
query("ALTER TABLE `news` CHANGE `id` `id` INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT") or error(db_error());
query("ALTER TABLE `noticeboard` CHANGE `id` `id` INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT") or error(db_error());
query("ALTER TABLE `pms` CHANGE `id` `id` INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT") or error(db_error());
query("ALTER TABLE `reports` CHANGE `id` `id` INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT") or error(db_error());
foreach ($boards as $board) {
query(sprintf("ALTER TABLE `posts_%s` CHANGE `id` `id` INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT", $board['uri'])) or error(db_error());
}
case false: case false:
// Update version number // Update version number
file_write($config['has_installed'], VERSION); file_write($config['has_installed'], VERSION);

14
install.sql

@ -44,7 +44,7 @@ CREATE TABLE IF NOT EXISTS `antispam` (
-- --
CREATE TABLE IF NOT EXISTS `bans` ( CREATE TABLE IF NOT EXISTS `bans` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT, `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`ip` varchar(45) NOT NULL, `ip` varchar(45) NOT NULL,
`mod` int(11) NOT NULL COMMENT 'which mod made the ban', `mod` int(11) NOT NULL COMMENT 'which mod made the ban',
`set` int(11) NOT NULL, `set` int(11) NOT NULL,
@ -97,7 +97,7 @@ CREATE TABLE IF NOT EXISTS `cites` (
-- --
CREATE TABLE IF NOT EXISTS `ip_notes` ( CREATE TABLE IF NOT EXISTS `ip_notes` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT, `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`ip` varchar(45) NOT NULL, `ip` varchar(45) NOT NULL,
`mod` int(11) DEFAULT NULL, `mod` int(11) DEFAULT NULL,
`time` int(11) NOT NULL, `time` int(11) NOT NULL,
@ -128,7 +128,7 @@ CREATE TABLE IF NOT EXISTS `modlogs` (
-- --
CREATE TABLE IF NOT EXISTS `mods` ( CREATE TABLE IF NOT EXISTS `mods` (
`id` smallint(6) unsigned NOT NULL AUTO_INCREMENT, `id` smallint(6) UNSIGNED NOT NULL AUTO_INCREMENT,
`username` varchar(30) NOT NULL, `username` varchar(30) NOT NULL,
`password` char(40) NOT NULL COMMENT 'SHA1', `password` char(40) NOT NULL COMMENT 'SHA1',
`type` smallint(1) NOT NULL COMMENT '0: janitor, 1: mod, 2: admin', `type` smallint(1) NOT NULL COMMENT '0: janitor, 1: mod, 2: admin',
@ -163,7 +163,7 @@ CREATE TABLE IF NOT EXISTS `mutes` (
-- --
CREATE TABLE IF NOT EXISTS `news` ( CREATE TABLE IF NOT EXISTS `news` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT, `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`name` text NOT NULL, `name` text NOT NULL,
`time` int(11) NOT NULL, `time` int(11) NOT NULL,
`subject` text NOT NULL, `subject` text NOT NULL,
@ -179,7 +179,7 @@ CREATE TABLE IF NOT EXISTS `news` (
-- --
CREATE TABLE IF NOT EXISTS `noticeboard` ( CREATE TABLE IF NOT EXISTS `noticeboard` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT, `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`mod` int(11) NOT NULL, `mod` int(11) NOT NULL,
`time` int(11) NOT NULL, `time` int(11) NOT NULL,
`subject` text NOT NULL, `subject` text NOT NULL,
@ -194,7 +194,7 @@ CREATE TABLE IF NOT EXISTS `noticeboard` (
-- --
CREATE TABLE IF NOT EXISTS `pms` ( CREATE TABLE IF NOT EXISTS `pms` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT, `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`sender` int(11) NOT NULL, `sender` int(11) NOT NULL,
`to` int(11) NOT NULL, `to` int(11) NOT NULL,
`message` text NOT NULL, `message` text NOT NULL,
@ -210,7 +210,7 @@ CREATE TABLE IF NOT EXISTS `pms` (
-- --
CREATE TABLE IF NOT EXISTS `reports` ( CREATE TABLE IF NOT EXISTS `reports` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT, `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`time` int(11) NOT NULL, `time` int(11) NOT NULL,
`ip` varchar(45) NOT NULL, `ip` varchar(45) NOT NULL,
`board` varchar(120) DEFAULT NULL, `board` varchar(120) DEFAULT NULL,

2
templates/posts.sql

@ -1,5 +1,5 @@
CREATE TABLE IF NOT EXISTS `posts_{{ board }}` ( CREATE TABLE IF NOT EXISTS `posts_{{ board }}` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`thread` int(11) DEFAULT NULL, `thread` int(11) DEFAULT NULL,
`subject` varchar(100) DEFAULT NULL, `subject` varchar(100) DEFAULT NULL,
`email` varchar(30) DEFAULT NULL, `email` varchar(30) DEFAULT NULL,

Loading…
Cancel
Save