alphadb-postgres 1.0.0b53__tar.gz → 1.0.0b54__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/PKG-INFO +1 -1
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/core/update_queries.rs +14 -6
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/mysql_impl/methods/update_queries.rs +62 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/postgres_impl/methods/update_queries.rs +58 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/py/packages/postgres/pyproject.toml +1 -1
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/pyproject.toml +1 -1
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/LICENSE +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/README.md +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/Cargo.lock +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/Cargo.toml +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/LICENSE +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/README.md +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/rustfmt.toml +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/core/engine.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/core/engine_config.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/core/method_types.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/core/mod.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/core/query/build.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/core/query/column/definecolumn.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/core/query/column/mod.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/core/query/default_data.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/core/query/mod.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/core/query/primary_key.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/core/query/table.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/core/runtime_config.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/core/utils/condition.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/core/utils/consolidate/column.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/core/utils/consolidate/default_data.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/core/utils/consolidate/mod.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/core/utils/consolidate/primary_key.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/core/utils/consolidate/table.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/core/utils/consolidate/version_source.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/core/utils/error_messages.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/core/utils/errors.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/core/utils/globals.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/core/utils/json.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/core/utils/mod.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/core/utils/types.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/core/utils/version_number.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/core/utils/version_source.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/core/verification/compatibility.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/core/verification/foreign_key.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/core/verification/index.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/core/verification/issue.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/core/verification/json.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/core/verification/mod.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/core/verification/primary_key.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/core/version_source_verification.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/mod.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/mysql_impl/config.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/mysql_impl/methods/connect.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/mysql_impl/methods/init.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/mysql_impl/methods/mod.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/mysql_impl/methods/status.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/mysql_impl/methods/update.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/mysql_impl/methods/vacate.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/mysql_impl/mod.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/mysql_impl/query/column/definecolumn.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/mysql_impl/query/column/mod.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/mysql_impl/query/constraint/check.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/mysql_impl/query/constraint/foreign_key.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/mysql_impl/query/constraint/mod.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/mysql_impl/query/default_data.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/mysql_impl/query/index/index.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/mysql_impl/query/index/mod.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/mysql_impl/query/mod.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/mysql_impl/query/table/config.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/mysql_impl/query/table/mod.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/mysql_impl/utils/check.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/mysql_impl/utils/connection.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/mysql_impl/utils/errors.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/mysql_impl/utils/mod.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/mysql_impl/verification/compatibility.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/mysql_impl/verification/config.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/mysql_impl/verification/mod.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/postgres_impl/config.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/postgres_impl/methods/connect.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/postgres_impl/methods/init.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/postgres_impl/methods/mod.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/postgres_impl/methods/status.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/postgres_impl/methods/update.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/postgres_impl/methods/vacate.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/postgres_impl/mod.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/postgres_impl/query/column/altercolumn.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/postgres_impl/query/column/definecolumn.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/postgres_impl/query/column/mod.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/postgres_impl/query/constraint/check.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/postgres_impl/query/constraint/foreign_key.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/postgres_impl/query/constraint/mod.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/postgres_impl/query/default_data.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/postgres_impl/query/extension.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/postgres_impl/query/index/index.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/postgres_impl/query/index/mod.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/postgres_impl/query/mod.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/postgres_impl/query/table/config.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/postgres_impl/query/table/mod.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/postgres_impl/utils/check.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/postgres_impl/utils/connection.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/postgres_impl/utils/errors.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/postgres_impl/utils/mod.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/postgres_impl/verification/compatibility.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/postgres_impl/verification/config.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/postgres_impl/verification/mod.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/lib.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/prelude.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/verification.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/version_source/combine.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/version_source/mod.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/version_source/parse.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/py/Cargo.lock +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/py/Cargo.toml +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/py/LICENSE +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/py/README.md +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/py/alphadb.pyi +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/py/packages/mysql/README.md +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/py/packages/mysql/pyproject.toml +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/py/packages/postgres/LICENSE +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/py/packages/postgres/README.md +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/py/requirements.txt +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/py/src/lib.rs +0 -0
- {alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/py/tests/test_alphadb.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: alphadb-postgres
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.0b54
|
|
4
4
|
Classifier: Programming Language :: Rust
|
|
5
5
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
6
6
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
@@ -216,13 +216,21 @@ pub fn update_queries<C>(
|
|
|
216
216
|
for table in object_iter(&version["altertable"]).map_err(with_trace(&version_trace))? {
|
|
217
217
|
version_trace.push(table.clone());
|
|
218
218
|
|
|
219
|
-
queries.push(Query {
|
|
220
|
-
query: alter_table(config.table_config, &version_source, table, version_number)?,
|
|
221
|
-
data: None,
|
|
222
|
-
});
|
|
223
|
-
|
|
224
219
|
// Indexes are standalone CREATE/DROP INDEX statements, emitted
|
|
225
|
-
// separately from the ALTER TABLE query.
|
|
220
|
+
// separately from the ALTER TABLE query. A block with only index
|
|
221
|
+
// keys would otherwise produce an empty, invalid ALTER TABLE.
|
|
222
|
+
let alters_table = get_object_keys(&version["altertable"][table])
|
|
223
|
+
.map_err(with_trace(&version_trace))?
|
|
224
|
+
.iter()
|
|
225
|
+
.any(|key| !matches!(key.as_str(), "add_index" | "modify_index" | "drop_index"));
|
|
226
|
+
|
|
227
|
+
if alters_table {
|
|
228
|
+
queries.push(Query {
|
|
229
|
+
query: alter_table(config.table_config, &version_source, table, version_number)?,
|
|
230
|
+
data: None,
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
|
|
226
234
|
if exists_in_object(&version["altertable"][table], "drop_index").map_err(with_trace(&version_trace))? {
|
|
227
235
|
for index in array_iter(&version["altertable"][table]["drop_index"]).map_err(with_trace(&version_trace))? {
|
|
228
236
|
queries.push(Query {
|
|
@@ -49,3 +49,65 @@ fn config_update_query(latest_version: &str, template_name: &str, db_name: &str)
|
|
|
49
49
|
])),
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
+
|
|
53
|
+
#[cfg(test)]
|
|
54
|
+
mod altertable_index_tests {
|
|
55
|
+
use super::config_update_query;
|
|
56
|
+
use crate::core::method_types::Status;
|
|
57
|
+
use crate::core::update_queries::{update_queries, UpdateQueriesConfig};
|
|
58
|
+
use crate::core::utils::errors::AlphaDBError;
|
|
59
|
+
use crate::engine::mysql_impl::query::default_data::default_data;
|
|
60
|
+
use crate::engine::mysql_impl::query::table::config::MYSQL_TABLE_CONFIG;
|
|
61
|
+
use crate::engine::mysql_impl::query::{createindex, dropindex};
|
|
62
|
+
use crate::engine::AlphaDBEngine;
|
|
63
|
+
use serde_json::json;
|
|
64
|
+
|
|
65
|
+
fn status(_db_name: &str, _connection: &mut ()) -> Result<Status, AlphaDBError> {
|
|
66
|
+
Ok(Status {
|
|
67
|
+
init: true,
|
|
68
|
+
version: Some("0.0.0".to_string()),
|
|
69
|
+
name: "test".to_string(),
|
|
70
|
+
template: None,
|
|
71
|
+
})
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const CONFIG: UpdateQueriesConfig<()> = UpdateQueriesConfig {
|
|
75
|
+
engine: AlphaDBEngine::MySQL,
|
|
76
|
+
status,
|
|
77
|
+
table_config: &MYSQL_TABLE_CONFIG,
|
|
78
|
+
create_index: createindex,
|
|
79
|
+
drop_index: dropindex,
|
|
80
|
+
default_data,
|
|
81
|
+
config_update_query,
|
|
82
|
+
version_extras: None,
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
#[test]
|
|
86
|
+
fn index_only_altertable_emits_no_alter_table() {
|
|
87
|
+
let source = json!({
|
|
88
|
+
"name": "test",
|
|
89
|
+
"version": [
|
|
90
|
+
{
|
|
91
|
+
"_id": "0.0.1",
|
|
92
|
+
"createtable": { "users": { "email": { "type": "VARCHAR", "length": 100 } } }
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"_id": "0.0.2",
|
|
96
|
+
"altertable": {
|
|
97
|
+
"users": {
|
|
98
|
+
"add_index": [{ "name": "users_email_idx", "columns": ["email"] }]
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
]
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
let queries = update_queries(&CONFIG, "test", &mut (), source.to_string(), None, true).unwrap();
|
|
106
|
+
|
|
107
|
+
assert!(
|
|
108
|
+
queries.iter().all(|q| !q.query.starts_with("ALTER TABLE")),
|
|
109
|
+
"{:?}",
|
|
110
|
+
queries.iter().map(|q| &q.query).collect::<Vec<_>>()
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
@@ -95,3 +95,61 @@ fn config_update_query(latest_version: &str, template_name: &str, db_name: &str)
|
|
|
95
95
|
])),
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
|
+
|
|
99
|
+
#[cfg(test)]
|
|
100
|
+
mod altertable_index_tests {
|
|
101
|
+
use super::{config_update_query, drop_index, version_extras};
|
|
102
|
+
use crate::core::method_types::Status;
|
|
103
|
+
use crate::core::update_queries::{update_queries, UpdateQueriesConfig};
|
|
104
|
+
use crate::core::utils::errors::AlphaDBError;
|
|
105
|
+
use crate::engine::postgres_impl::query::createindex;
|
|
106
|
+
use crate::engine::postgres_impl::query::default_data::default_data;
|
|
107
|
+
use crate::engine::postgres_impl::query::table::config::POSTGRES_TABLE_CONFIG;
|
|
108
|
+
use crate::engine::AlphaDBEngine;
|
|
109
|
+
use serde_json::json;
|
|
110
|
+
|
|
111
|
+
fn status(_db_name: &str, _connection: &mut ()) -> Result<Status, AlphaDBError> {
|
|
112
|
+
Ok(Status {
|
|
113
|
+
init: true,
|
|
114
|
+
version: Some("0.0.0".to_string()),
|
|
115
|
+
name: "test".to_string(),
|
|
116
|
+
template: None,
|
|
117
|
+
})
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const CONFIG: UpdateQueriesConfig<()> = UpdateQueriesConfig {
|
|
121
|
+
engine: AlphaDBEngine::PostgreSQL,
|
|
122
|
+
status,
|
|
123
|
+
table_config: &POSTGRES_TABLE_CONFIG,
|
|
124
|
+
create_index: createindex,
|
|
125
|
+
drop_index,
|
|
126
|
+
default_data,
|
|
127
|
+
config_update_query,
|
|
128
|
+
version_extras: Some(version_extras),
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
#[test]
|
|
132
|
+
fn index_only_altertable_emits_no_alter_table() {
|
|
133
|
+
let source = json!({
|
|
134
|
+
"name": "test",
|
|
135
|
+
"version": [
|
|
136
|
+
{
|
|
137
|
+
"_id": "0.0.1",
|
|
138
|
+
"createtable": { "users": { "email": { "type": "VARCHAR", "length": 100 } } }
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"_id": "0.0.2",
|
|
142
|
+
"altertable": {
|
|
143
|
+
"users": {
|
|
144
|
+
"add_index": [{ "name": "users_email_idx", "columns": ["email"] }]
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
]
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
let queries = update_queries(&CONFIG, "test", &mut (), source.to_string(), None, true).unwrap();
|
|
152
|
+
|
|
153
|
+
assert!(queries.iter().all(|q| !q.query.starts_with("ALTER TABLE")), "{:?}", queries.iter().map(|q| &q.query).collect::<Vec<_>>());
|
|
154
|
+
}
|
|
155
|
+
}
|
|
@@ -4,7 +4,7 @@ build-backend = "maturin"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "alphadb-postgres"
|
|
7
|
-
version = "1.0.0-beta.
|
|
7
|
+
version = "1.0.0-beta.54"
|
|
8
8
|
author = "Wibo Kuipers"
|
|
9
9
|
author-email = "wkuipersoss@gmail.com"
|
|
10
10
|
description = "AlphaDB is a versatile tool for managing PostgreSQL database versions, using JSON to define structures and simplify migrations across environments."
|
|
@@ -4,7 +4,7 @@ build-backend = "maturin"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "alphadb-postgres"
|
|
7
|
-
version = "1.0.0-beta.
|
|
7
|
+
version = "1.0.0-beta.54"
|
|
8
8
|
author = "Wibo Kuipers"
|
|
9
9
|
author-email = "wkuipersoss@gmail.com"
|
|
10
10
|
description = "AlphaDB is a versatile tool for managing PostgreSQL database versions, using JSON to define structures and simplify migrations across environments."
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/core/query/column/mod.rs
RENAMED
|
File without changes
|
{alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/core/query/default_data.rs
RENAMED
|
File without changes
|
|
File without changes
|
{alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/core/query/primary_key.rs
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/core/utils/consolidate/column.rs
RENAMED
|
File without changes
|
|
File without changes
|
{alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/core/utils/consolidate/mod.rs
RENAMED
|
File without changes
|
|
File without changes
|
{alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/core/utils/consolidate/table.rs
RENAMED
|
File without changes
|
|
File without changes
|
{alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/core/utils/error_messages.rs
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/core/utils/version_number.rs
RENAMED
|
File without changes
|
{alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/core/utils/version_source.rs
RENAMED
|
File without changes
|
|
File without changes
|
{alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/core/verification/foreign_key.rs
RENAMED
|
File without changes
|
{alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/core/verification/index.rs
RENAMED
|
File without changes
|
{alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/core/verification/issue.rs
RENAMED
|
File without changes
|
{alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/core/verification/json.rs
RENAMED
|
File without changes
|
{alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/core/verification/mod.rs
RENAMED
|
File without changes
|
{alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/core/verification/primary_key.rs
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/mysql_impl/config.rs
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/mysql_impl/methods/mod.rs
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/mysql_impl/mod.rs
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/mysql_impl/query/mod.rs
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/mysql_impl/utils/check.rs
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/mysql_impl/utils/mod.rs
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/postgres_impl/config.rs
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/engine/postgres_impl/mod.rs
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{alphadb_postgres-1.0.0b53 → alphadb_postgres-1.0.0b54}/alphadb/src/version_source/combine.rs
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|