get_charset_collate(); $items = $wpdb->prefix . 'pixelkeep_items'; $log = $wpdb->prefix . 'pixelkeep_log'; dbDelta( "CREATE TABLE {$items} ( id bigint(20) unsigned NOT NULL AUTO_INCREMENT, attachment_id bigint(20) unsigned NOT NULL, size_name varchar(64) NOT NULL, format varchar(16) NOT NULL, is_derivative tinyint(1) unsigned NOT NULL DEFAULT 0, bytes_before bigint(20) unsigned NOT NULL DEFAULT 0, bytes_after bigint(20) unsigned NOT NULL DEFAULT 0, w_before int(10) unsigned NOT NULL DEFAULT 0, h_before int(10) unsigned NOT NULL DEFAULT 0, w_after int(10) unsigned NOT NULL DEFAULT 0, h_after int(10) unsigned NOT NULL DEFAULT 0, method varchar(32) NOT NULL DEFAULT '', quality smallint(5) unsigned DEFAULT NULL, status varchar(20) NOT NULL DEFAULT 'pending', error_code varchar(64) NOT NULL DEFAULT '', backup_path varchar(512) NOT NULL DEFAULT '', checksum char(64) NOT NULL DEFAULT '', created_at datetime NOT NULL, updated_at datetime NOT NULL, PRIMARY KEY (id), UNIQUE KEY attachment_size_format (attachment_id,size_name,format), KEY attachment_id (attachment_id), KEY derivative_format (is_derivative,format), KEY status (status), KEY updated_at (updated_at) ) {$charset};" ); dbDelta( "CREATE TABLE {$log} ( id bigint(20) unsigned NOT NULL AUTO_INCREMENT, level varchar(10) NOT NULL DEFAULT 'info', code varchar(64) NOT NULL DEFAULT '', attachment_id bigint(20) unsigned NOT NULL DEFAULT 0, message text NOT NULL, created_at datetime NOT NULL, PRIMARY KEY (id), KEY attachment_id (attachment_id), KEY created_at (created_at) ) {$charset};" ); // Sites that saved settings before network defaults existed keep them. if ( is_multisite() && false === get_option( Settings::OVERRIDE_OPTION ) && is_array( get_option( Settings::OPTION ) ) ) { update_option( Settings::OVERRIDE_OPTION, true, false ); } update_option( self::VERSION_OPTION, self::SCHEMA_VERSION, false ); } }