Make WordPress Core

Ticket #27062: minimalist.php

File minimalist.php, 561 bytes (added by colinhahn, 11 years ago)

Minimalist demonstration of dbDelta error

Line 
1<?php
2/*
3Plugin Name: Minimalist Error
4Plugin URI:
5Description: Minimalist plugin to show error on activate/deactivate/reactivate
6Version: 1.0
7Author: Colin J. Hahn
8Author URI:
9*/
10
11register_activation_hook( __FILE__, 'minimalist_database_setup');
12
13function minimalist_database_setup() {
14
15        global $wpdb;
16        $table = $wpdb->prefix . 'minimalist';
17
18        $sql = "CREATE TABLE $table (
19                id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
20                filler text,
21                PRIMARY KEY  id (id)
22                );";
23
24                require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
25
26                dbDelta( $sql );
27               
28}
29
30?>