Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d00645853b | |||
| eb43108aa6 | |||
| 40ff55c97d |
@ -1,3 +1,5 @@
|
|||||||
|
# MOVED PERMANENTLY TO GITHUB
|
||||||
|
https://github.com/michigg/codimd_note_overview
|
||||||
# CodiMD note overview
|
# CodiMD note overview
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
19
src/delete_unused_notes.py
Normal file
19
src/delete_unused_notes.py
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import os
|
||||||
|
import psycopg2
|
||||||
|
|
||||||
|
DB_HOST = os.environ.get('DB_HOST')
|
||||||
|
DB_NAME = os.environ.get('POSTGRES_DB')
|
||||||
|
DB_USER = os.environ.get('POSTGRES_USER')
|
||||||
|
DB_PASSWORD = os.environ.get('POSTGRES_PASSWORD')
|
||||||
|
|
||||||
|
deletion_statement = 'DELETE FROM "Notes" WHERE "content" = \'\';'
|
||||||
|
|
||||||
|
try:
|
||||||
|
conn = psycopg2.connect(host=DB_HOST, database=DB_NAME, user=DB_USER, password=DB_PASSWORD)
|
||||||
|
cur = conn.cursor()
|
||||||
|
cur.execute(deletion_statement)
|
||||||
|
conn.commit()
|
||||||
|
cur.close()
|
||||||
|
conn.close()
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
Loading…
x
Reference in New Issue
Block a user