Last active
February 22, 2021 16:21
-
-
Save danielpataki/b45306318d19af77e24f to your computer and use it in GitHub Desktop.
Revisions
-
Daniel Pataki revised this gist
Feb 1, 2015 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -26,6 +26,9 @@ function my_plugin_create_db() { UNIQUE KEY id (id) ) $charset_collate;"; dbDelta( $sql ); update_option( 'my_plugin_version', '2.0' ); } -
Daniel Pataki revised this gist
Feb 1, 2015 . 1 changed file with 10 additions and 9 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ function my_plugin_create_db() { global $wpdb; $version = get_option( 'my_plugin_version', '1.0' ); $charset_collate = $wpdb->get_charset_collate(); $table_name = $wpdb->prefix . 'my_analysis'; @@ -17,14 +17,15 @@ function my_plugin_create_db() { dbDelta( $sql ); if ( version_compare( $version, '2.0' ) < 0 ) { $sql = "CREATE TABLE $table_name ( id mediumint(9) NOT NULL AUTO_INCREMENT, time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, views smallint(5) NOT NULL, clicks smallint(5) NOT NULL, blog_id smallint(5) NOT NULL, UNIQUE KEY id (id) ) $charset_collate;"; dbDelta( $sql ); } -
Daniel Pataki revised this gist
Feb 1, 2015 . 2 changed files with 36 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,31 @@ function my_plugin_create_db() { global $wpdb; $version = get_option( 'my_plugin_version', '1.0' ); $charset_collate = $wpdb->get_charset_collate(); $table_name = $wpdb->prefix . 'my_analysis'; $sql = "CREATE TABLE $table_name ( id mediumint(9) NOT NULL AUTO_INCREMENT, time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, views smallint(5) NOT NULL, clicks smallint(5) NOT NULL, UNIQUE KEY id (id) ) $charset_collate;"; require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); dbDelta( $sql ); if ( version_compare( $version, '2.0' ) < 0 ) { $sql = "CREATE TABLE $table_name ( id mediumint(9) NOT NULL AUTO_INCREMENT, time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, views smallint(5) NOT NULL, clicks smallint(5) NOT NULL, blog_id smallint(5) NOT NULL, UNIQUE KEY id (id) ) $charset_collate;"; } } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1 +1,5 @@ function my_plugin_create_db() { global $wpdb; $version = get_option( 'my_plugin_version', '1.0' ); // ... } -
Daniel Pataki revised this gist
Feb 1, 2015 . 1 changed file with 1 addition and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1 @@ define( 'MY_PLUGIN_VERSION', '1.0' ); -
Daniel Pataki revised this gist
Jan 21, 2015 . 1 changed file with 6 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,6 @@ define( 'MY_PLUGIN_VERSION', '1.0' ); register_activation_hook( __FILE__, 'my_plugin_create_db' ); function my_plugin_create_db() { // Create DB Here } -
Daniel Pataki revised this gist
Jan 21, 2015 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,8 +7,8 @@ function my_plugin_create_db() { $sql = "CREATE TABLE $table_name ( id mediumint(9) NOT NULL AUTO_INCREMENT, time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, views smallint(5) NOT NULL, clicks smallint(5) NOT NULL, UNIQUE KEY id (id) ) $charset_collate;"; -
Daniel Pataki revised this gist
Jan 21, 2015 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,8 +7,8 @@ function my_plugin_create_db() { $sql = "CREATE TABLE $table_name ( id mediumint(9) NOT NULL AUTO_INCREMENT, time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, views tinyint(3) NOT NULL, clicks tinyint(3) NOT NULL, UNIQUE KEY id (id) ) $charset_collate;"; -
Daniel Pataki renamed this gist
Jan 21, 2015 . 1 changed file with 2 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,9 +7,8 @@ function my_plugin_create_db() { $sql = "CREATE TABLE $table_name ( id mediumint(9) NOT NULL AUTO_INCREMENT, time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, views smallint(5) NOT NULL, clicks smalling(5) NOT NULL, UNIQUE KEY id (id) ) $charset_collate;"; -
Daniel Pataki revised this gist
Jan 21, 2015 . 1 changed file with 18 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ function my_plugin_create_db() { global $wpdb; $charset_collate = $wpdb->get_charset_collate(); $table_name = $wpdb->prefix . 'my_analysis'; $sql = "CREATE TABLE $table_name ( id mediumint(9) NOT NULL AUTO_INCREMENT, time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, name tinytext NOT NULL, text text NOT NULL, url varchar(55) DEFAULT '' NOT NULL, UNIQUE KEY id (id) ) $charset_collate;"; require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); dbDelta( $sql ); } -
Daniel Pataki created this gist
Jan 21, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,4 @@ register_activation_hook( __FILE__, 'my_plugin_create_db' ); function my_plugin_create_db() { // Create DB Here }