Skip to content

Commit

Permalink
move comment
Browse files Browse the repository at this point in the history
lmcmicu committed Dec 16, 2023
1 parent fd4e716 commit fd61d7b
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -951,12 +951,6 @@ impl Valve {
pub async fn drop_tables(&self, tables: Vec<&str>) -> Result<&Self, sqlx::Error> {
// DatabaseError

// TODO: This will work fine when the table list is all of the tables in the db,
// but in the case of a partial list, then there is a risk that some of them have
// dependencies on tables not in the list. What we need to do is grab the complete
// list of tables from self.global_config.sorted_table_list and use it as a reference
// for which tables need to be dropped.

for table in tables {
if table != "message" && table != "history" {
let sql = format!(r#"DROP VIEW IF EXISTS "{}_text_view""#, table);
@@ -988,12 +982,6 @@ impl Valve {
pub async fn truncate_tables(&self, tables: Vec<&str>) -> Result<&Self, sqlx::Error> {
// ConfigOrDatabaseError

// TODO: This will work fine when the table list is all of the tables in the db,
// but in the case of a partial list, then there is a risk that some of them have
// dependencies on tables not in the list. What we need to do is grab the complete
// list of tables from self.global_config.sorted_table_list and use it as a reference
// for which tables need to be dropped.

self.create_missing_tables().await?;

// We must use CASCADE in the case of PostgreSQL since we cannot truncate a table, T, that
@@ -1050,6 +1038,12 @@ impl Valve {
) -> Result<&Self, sqlx::Error> {
// ConfigOrDatabaseError

// TODO: This will work fine when the table list is all of the tables in the db,
// but in the case of a partial list, then there is a risk that some of them have
// dependencies on tables not in the list. What we need to do is grab the complete
// list of tables from self.global_config.sorted_table_list and use it as a reference
// for which tables need to be dropped.

self.create_missing_tables().await?;
let mut list_for_deletion = table_list.clone();
list_for_deletion.reverse();

0 comments on commit fd61d7b

Please sign in to comment.