From 035b7848dcf1518c39e5e3834c9f1177e65bfecf Mon Sep 17 00:00:00 2001
From: Georgy Moshkin <gmoshkin@picodata.io>
Date: Fri, 17 Mar 2023 16:56:32 +0300
Subject: [PATCH] chore: remove feature = "schema"

The functionality hidden behind this feature is pretty essential and
it's confusing for the users when they can't use it out of the box.
---
 CHANGELOG.md                | 1 +
 tarantool/Cargo.toml        | 3 +--
 tarantool/src/error.rs      | 1 -
 tarantool/src/index.rs      | 2 --
 tarantool/src/schema/mod.rs | 2 --
 tarantool/src/space.rs      | 7 -------
 6 files changed, 2 insertions(+), 14 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0e0a679f..f083a10d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -68,6 +68,7 @@
 ### Removed
 - `r#async::timeout::Expired` in favor of `r#async::timeout::Error`
 - `tuple::KeyDefItem` in favor of `tuple::KeyDefPart`.
+- `feature = "schema"`. Now the functionality is supported by default
 
 # [0.6.4] Dec 15 2022
 
diff --git a/tarantool/Cargo.toml b/tarantool/Cargo.toml
index 4c4887cf..45b352cf 100644
--- a/tarantool/Cargo.toml
+++ b/tarantool/Cargo.toml
@@ -53,12 +53,11 @@ va_list = "0.1.3"
 [features]
 default = ["net_box", "network_client"]
 net_box = ["refpool"]
-schema = []
 defer = []
 picodata = []
 network_client = []
 test = ["tester"]
-all = ["default", "schema", "defer", "test"]
+all = ["default", "defer", "test"]
 internal_test = ["test", "tlua/test"]
 
 [dev-dependencies]
diff --git a/tarantool/src/error.rs b/tarantool/src/error.rs
index ad039b65..def6f515 100644
--- a/tarantool/src/error.rs
+++ b/tarantool/src/error.rs
@@ -85,7 +85,6 @@ pub enum Error {
     #[error("Lua error: {0}")]
     LuaError(#[from] LuaError),
 
-    #[cfg(feature = "schema")]
     #[error("Space metadata not found")]
     MetaNotFound,
 }
diff --git a/tarantool/src/index.rs b/tarantool/src/index.rs
index aad011d8..874cb37b 100644
--- a/tarantool/src/index.rs
+++ b/tarantool/src/index.rs
@@ -188,7 +188,6 @@ impl<'a> Builder<'a> {
     }
 
     /// Create a new index using the current options.
-    #[cfg(feature = "schema")]
     #[inline(always)]
     pub fn create(self) -> crate::Result<Index> {
         crate::schema::index::create_index(self.space_id, self.name, &self.opts)
@@ -513,7 +512,6 @@ impl Index {
     }
 
     // Drops index.
-    #[cfg(feature = "schema")]
     pub fn drop(&self) -> Result<(), Error> {
         crate::schema::index::drop_index(self.space_id, self.index_id)
     }
diff --git a/tarantool/src/schema/mod.rs b/tarantool/src/schema/mod.rs
index abb2e98b..d47a4f6f 100644
--- a/tarantool/src/schema/mod.rs
+++ b/tarantool/src/schema/mod.rs
@@ -1,5 +1,3 @@
-#![cfg(any(feature = "schema", doc))]
-
 pub mod index;
 pub mod sequence;
 pub mod space;
diff --git a/tarantool/src/space.rs b/tarantool/src/space.rs
index f579e3bf..39494be7 100644
--- a/tarantool/src/space.rs
+++ b/tarantool/src/space.rs
@@ -18,7 +18,6 @@ use serde_json::{Map, Value};
 use crate::error::{Error, TarantoolError};
 use crate::ffi::tarantool as ffi;
 use crate::index::{Index, IndexIterator, IteratorType};
-#[cfg(feature = "schema")]
 use crate::schema::space::SpaceMetadata;
 use crate::tuple::{Encode, ToTupleBuffer, Tuple, TupleBuffer};
 use crate::tuple_from_box_api;
@@ -413,13 +412,11 @@ impl Space {
     /// - `opts` - see SpaceCreateOptions struct.
     ///
     /// Returns a new space.
-    #[cfg(feature = "schema")]
     pub fn create(name: &str, opts: &SpaceCreateOptions) -> Result<Space, Error> {
         crate::schema::space::create_space(name, opts)
     }
 
     /// Drop a space.
-    #[cfg(feature = "schema")]
     pub fn drop(&self) -> Result<(), Error> {
         crate::schema::space::drop_space(self.id)
     }
@@ -481,7 +478,6 @@ impl Space {
     ///
     /// - `name` - name of index to create, which should conform to the rules for object names.
     /// - `opts` - see schema::IndexOptions struct.
-    #[cfg(feature = "schema")]
     pub fn create_index(
         &self,
         name: &str,
@@ -493,7 +489,6 @@ impl Space {
     /// Return an index builder.
     ///
     /// - `name` - name of index to create, which should conform to the rules for object names.
-    #[cfg(feature = "schema")]
     pub fn index_builder<'a>(&self, name: &'a str) -> crate::index::Builder<'a> {
         crate::index::Builder::new(self.id, name)
     }
@@ -803,7 +798,6 @@ impl Space {
     }
 
     // Return space metadata from system `_space` space.
-    #[cfg(feature = "schema")]
     pub fn meta(&self) -> Result<SpaceMetadata, Error> {
         let sys_space: Space = SystemSpace::Space.into();
         let tuple = sys_space.get(&(self.id,))?.ok_or(Error::MetaNotFound)?;
@@ -896,7 +890,6 @@ impl<'a> Builder<'a> {
         self
     }
 
-    #[cfg(feature = "schema")]
     pub fn create(self) -> crate::Result<Space> {
         crate::schema::space::create_space(self.name, &self.opts)
     }
-- 
GitLab