Skip to content

Commit b434e67

Browse files
authored
fix: only remove leftovers from previous db (#115)
2 parents 3a53448 + 7ff9832 commit b434e67

3 files changed

Lines changed: 10 additions & 4 deletions

File tree

context_chat_backend/repair/repair4000_date20241108175224.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,10 @@
1515
)
1616

1717
if os.path.exists(vector_db_path):
18-
shutil.rmtree(vector_db_path)
19-
os.makedirs(vector_db_path, mode=0o770)
18+
for n in os.listdir(vector_db_path):
19+
if n == 'pgsql':
20+
continue
21+
if os.path.isdir(os.path.join(vector_db_path, n)):
22+
shutil.rmtree(os.path.join(vector_db_path, n))
23+
else:
24+
os.remove(os.path.join(vector_db_path, n))

context_chat_backend/repair/runner.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ def main():
3636

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

4140
(previous_app_version, repairs_pending) = get_previous_version(version_info_path)
4241

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

5655
if introduced_version < previous_app_version:
5756
print(f'No repairs to run for version {introduced_version}.', flush=True)
58-
break
57+
continue
5958

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

dockerfile_scripts/pgsql/setup.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ fi
3333

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

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

0 commit comments

Comments
 (0)