DmitrMakeev commited on
Commit
038b0ae
·
verified ·
1 Parent(s): 2ee4c4d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -0
app.py CHANGED
@@ -174,6 +174,24 @@ def get_all_data():
174
  return jsonify({'status': 'error', 'message': str(e)}), 500
175
 
176
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
177
 
178
 
179
 
 
174
  return jsonify({'status': 'error', 'message': str(e)}), 500
175
 
176
 
177
+ @app.route('/delite_db', methods=['GET'])
178
+ def delete_db():
179
+ try:
180
+ conn = sqlite3.connect("system_data.db") # Используем вашу БД
181
+ cursor = conn.cursor()
182
+
183
+ # ✅ Удаляем все записи из таблицы
184
+ cursor.execute("DELETE FROM system_data")
185
+
186
+ # ✅ Сбрасываем автоинкрементный счётчик ID (для SQLite)
187
+ cursor.execute("DELETE FROM sqlite_sequence WHERE name='system_data'")
188
+
189
+ conn.commit()
190
+ conn.close()
191
+
192
+ return jsonify({'status': 'ok', 'message': 'База данных успешно очищена'})
193
+ except Exception as e:
194
+ return jsonify({'status': 'error', 'message': str(e)}), 500
195
 
196
 
197