Skip to content

Commit

Permalink
fix: only remove leftovers from previous db (#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyteinsky authored Dec 19, 2024
2 parents 3a53448 + 7ff9832 commit b434e67
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
9 changes: 7 additions & 2 deletions context_chat_backend/repair/repair4000_date20241108175224.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,10 @@
)

if os.path.exists(vector_db_path):
shutil.rmtree(vector_db_path)
os.makedirs(vector_db_path, mode=0o770)
for n in os.listdir(vector_db_path):
if n == 'pgsql':
continue
if os.path.isdir(os.path.join(vector_db_path, n)):
shutil.rmtree(os.path.join(vector_db_path, n))
else:
os.remove(os.path.join(vector_db_path, n))
3 changes: 1 addition & 2 deletions context_chat_backend/repair/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ def main():

all_filenames = os.listdir('context_chat_backend/repair')
repair_filenames = [f for f in all_filenames if f.startswith('repair') and f.endswith('.py')]
repair_filenames.sort(reverse=True)

(previous_app_version, repairs_pending) = get_previous_version(version_info_path)

Expand All @@ -55,7 +54,7 @@ def main():

if introduced_version < previous_app_version:
print(f'No repairs to run for version {introduced_version}.', flush=True)
break
continue

print(f'Running repair {repair_filename}...', flush=True, end='')

Expand Down
2 changes: 2 additions & 0 deletions dockerfile_scripts/pgsql/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ fi

# Ensure the directory exists and has the correct permissions
mkdir -p "$DATA_DIR"
chmod +rx "${APP_PERSISTENT_STORAGE:-persistent_storage}"
chmod +rx "$BASE_DIR"
chown -R postgres:postgres "$DATA_DIR"

if [ ! -d "$DATA_DIR/base" ]; then
Expand Down

0 comments on commit b434e67

Please sign in to comment.