Skip to content

Commit a05f571

Browse files
committed
Add scripts to drop deprecated prospect columns
Add four standalone Python migration scripts to remove deprecated columns from the prospects table: do_not_call, email_confidence, home_phone, and work_direct_phone. Each script uses get_db_connection_direct to execute an ALTER TABLE ... DROP COLUMN IF EXISTS statement, commits the change, closes the DB connection, and prints a completion message. The DROP COLUMN IF EXISTS makes the scripts safe to run idempotently.
1 parent c15f51f commit a05f571

4 files changed

Lines changed: 56 additions & 0 deletions

File tree

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import os
2+
import sys
3+
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../../../..')))
4+
from app.utils.db import get_db_connection_direct
5+
6+
if __name__ == "__main__":
7+
sql = "ALTER TABLE prospects DROP COLUMN IF EXISTS do_not_call;"
8+
conn = get_db_connection_direct()
9+
cur = conn.cursor()
10+
cur.execute(sql)
11+
conn.commit()
12+
cur.close()
13+
conn.close()
14+
print("Migration complete: do_not_call column dropped from prospects table.")
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import os
2+
import sys
3+
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../../../..')))
4+
from app.utils.db import get_db_connection_direct
5+
6+
if __name__ == "__main__":
7+
sql = "ALTER TABLE prospects DROP COLUMN IF EXISTS email_confidence;"
8+
conn = get_db_connection_direct()
9+
cur = conn.cursor()
10+
cur.execute(sql)
11+
conn.commit()
12+
cur.close()
13+
conn.close()
14+
print("Migration complete: email_confidence column dropped from prospects table.")
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import os
2+
import sys
3+
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../../../..')))
4+
from app.utils.db import get_db_connection_direct
5+
6+
if __name__ == "__main__":
7+
sql = "ALTER TABLE prospects DROP COLUMN IF EXISTS home_phone;"
8+
conn = get_db_connection_direct()
9+
cur = conn.cursor()
10+
cur.execute(sql)
11+
conn.commit()
12+
cur.close()
13+
conn.close()
14+
print("Migration complete: home_phone column dropped from prospects table.")
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import os
2+
import sys
3+
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../../../..')))
4+
from app.utils.db import get_db_connection_direct
5+
6+
if __name__ == "__main__":
7+
sql = "ALTER TABLE prospects DROP COLUMN IF EXISTS work_direct_phone;"
8+
conn = get_db_connection_direct()
9+
cur = conn.cursor()
10+
cur.execute(sql)
11+
conn.commit()
12+
cur.close()
13+
conn.close()
14+
print("Migration complete: work_direct_phone column dropped from prospects table.")

0 commit comments

Comments
 (0)