prefix . 'ethebo_bookings'; $charset = $wpdb->get_charset_collate(); dbDelta( "CREATE TABLE {$table} ( id bigint(20) unsigned NOT NULL AUTO_INCREMENT, property_id bigint(20) unsigned NOT NULL, check_in date NOT NULL, check_out date NOT NULL, status varchar(20) NOT NULL DEFAULT 'pending', source varchar(40) NOT NULL DEFAULT 'website', uid varchar(191) NOT NULL DEFAULT '', guest_name varchar(190) NOT NULL DEFAULT '', guest_email varchar(190) NOT NULL DEFAULT '', guest_phone varchar(50) NOT NULL DEFAULT '', guests smallint(5) unsigned NOT NULL DEFAULT 1, total decimal(10,2) NOT NULL DEFAULT 0, notes text NULL, payment_method varchar(20) NOT NULL DEFAULT '', payment_status varchar(20) NOT NULL DEFAULT '', paid_amount decimal(10,2) NOT NULL DEFAULT 0, payment_ref varchar(191) NOT NULL DEFAULT '', created_at datetime NOT NULL, PRIMARY KEY (id), KEY property_dates (property_id,check_in,check_out), KEY source_uid (source,uid) ) {$charset};" ); update_option( 'ethebo_db_version', ETHEBO_DB_VERSION ); } private static function default_types() { // Created only on first install, in the active plugin language. if ( get_terms( array( 'taxonomy' => ETHEBO_Post_Type::TAX, 'hide_empty' => false, 'fields' => 'ids', 'number' => 1 ) ) ) { return; } $types = array( 'Room', 'Apartment', 'Studio', 'Hotel', 'Villa', 'Holiday home', 'Guesthouse' ); foreach ( array_map( 'ethebo__', $types ) as $name ) { if ( ! term_exists( $name, ETHEBO_Post_Type::TAX ) ) { wp_insert_term( $name, ETHEBO_Post_Type::TAX ); } } } }