get_charset_collate(); // Two spaces after PRIMARY KEY is required by WordPress dbDelta. $sql = "CREATE TABLE {$wpdb->prefix}gridmaster_grids ( id mediumint(9) NOT NULL AUTO_INCREMENT, title text NOT NULL, attributes text NOT NULL, config_json longtext DEFAULT NULL, layout_post_id bigint(20) unsigned DEFAULT 0, schema_version int(11) NOT NULL DEFAULT 1, migration_status varchar(32) NOT NULL DEFAULT 'legacy', dated datetime DEFAULT CURRENT_TIMESTAMP, updated_at datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (id), KEY layout_post_id (layout_post_id), KEY migration_status (migration_status) ) $charset_collate;"; if ( ! function_exists( 'dbDelta' ) ) { require_once ABSPATH . 'wp-admin/includes/upgrade.php'; } dbDelta( $sql ); update_option( 'gridmaster_db_version', self::DB_VERSION ); } } // Initialize the migration class. new DB_Migration();