mirror of
https://github.com/trailbaseio/trailbase.git
synced 2026-05-25 12:18:58 -05:00
Be stricter in demo mode with respect to schema alterations/deletions.
This commit is contained in:
@@ -29,7 +29,7 @@ pub async fn alter_index_handler(
|
||||
State(state): State<AppState>,
|
||||
Json(request): Json<AlterIndexRequest>,
|
||||
) -> Result<Json<AlterIndexResponse>, Error> {
|
||||
if state.demo_mode() && request.source_schema.name.name.starts_with("_") {
|
||||
if state.demo_mode() {
|
||||
return Err(Error::Precondition("Disallowed in demo".into()));
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ pub async fn alter_table_handler(
|
||||
State(state): State<AppState>,
|
||||
Json(request): Json<AlterTableRequest>,
|
||||
) -> Result<Json<AlterTableResponse>, Error> {
|
||||
if state.demo_mode() && request.source_schema.name.name.starts_with("_") {
|
||||
if state.demo_mode() {
|
||||
return Err(Error::Precondition("Disallowed in demo".into()));
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ pub async fn drop_index_handler(
|
||||
Json(request): Json<DropIndexRequest>,
|
||||
) -> Result<Json<DropIndexResponse>, Error> {
|
||||
let index_name = QualifiedName::parse(&request.name)?;
|
||||
if state.demo_mode() && index_name.name.starts_with("_") {
|
||||
if state.demo_mode() {
|
||||
return Err(Error::Precondition("Disallowed in demo".into()));
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ pub async fn drop_table_handler(
|
||||
Json(request): Json<DropTableRequest>,
|
||||
) -> Result<Json<DropTableResponse>, Error> {
|
||||
let unqualified_table_name = request.name.to_string();
|
||||
if state.demo_mode() && unqualified_table_name.starts_with("_") {
|
||||
if state.demo_mode() {
|
||||
return Err(Error::Precondition("Disallowed in demo".into()));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user