Skip to content

Instantly share code, notes, and snippets.

@Dinamiko
Last active November 5, 2015 17:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Dinamiko/8cfdfee822ebf885bacb to your computer and use it in GitHub Desktop.
Save Dinamiko/8cfdfee822ebf885bacb to your computer and use it in GitHub Desktop.
<?php
/**
* Crea la tabla encuesta en la base de datos o la actualiza
*/
function encuesta_database_install() {
global $wpdb;
$table_name = $wpdb->prefix . 'encuesta';
$sql = "CREATE TABLE $table_name (
id mediumint(9) NOT NULL AUTO_INCREMENT,
time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
respuesta VARCHAR(30) DEFAULT '' NOT NULL,
email VARCHAR(100) DEFAULT '' NOT NULL,
UNIQUE KEY id (id)
);";
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
dbDelta( $sql );
update_option( "encuesta_db_version", ENCUESTA_BBDD_VERSION );
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment