Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/api/prospects/sql/alter_add_name_and_populate.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-- Migration: Add name column and populate with first_name + ' ' + last_name
ALTER TABLE prospects ADD COLUMN IF NOT EXISTS name TEXT;
UPDATE prospects SET name = CONCAT_WS(' ', first_name, last_name);
2 changes: 2 additions & 0 deletions app/api/prospects/sql/alter_drop_mobile_phone.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- Migration: Remove mobile_phone column from prospects table
ALTER TABLE prospects DROP COLUMN IF EXISTS mobile_phone;
2 changes: 2 additions & 0 deletions app/api/prospects/sql/alter_drop_other_phone.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- Migration: Remove other_phone column from prospects table
ALTER TABLE prospects DROP COLUMN IF EXISTS other_phone;
2 changes: 2 additions & 0 deletions app/api/prospects/sql/alter_drop_other_photne.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- Migration: Remove other_photne column from prospects table
ALTER TABLE prospects DROP COLUMN IF EXISTS other_photne;
2 changes: 2 additions & 0 deletions app/api/prospects/sql/alter_drop_subsidiary_of.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- Migration: Remove subsidiary_of column from prospects table
ALTER TABLE prospects DROP COLUMN IF EXISTS subsidiary_of;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- Migration: Remove subsidiary_of_organization_id column from prospects table
ALTER TABLE prospects DROP COLUMN IF EXISTS subsidiary_of_organization_id;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- Migration: Rename person_linkinkedin_url column to linkedin in prospects table
ALTER TABLE prospects RENAME COLUMN person_linkinkedin_url TO linkedin;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- Migration: Rename sub_departments column to department in prospects table
ALTER TABLE prospects RENAME COLUMN sub_departments TO department;
17 changes: 17 additions & 0 deletions app/api/prospects/sql/run_alter_add_name_and_populate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import os
import sys
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../../../..')))
from app.utils.db import get_db_connection_direct

if __name__ == "__main__":
sql = """
ALTER TABLE prospects ADD COLUMN IF NOT EXISTS name TEXT;
UPDATE prospects SET name = CONCAT_WS(' ', first_name, last_name);
"""
conn = get_db_connection_direct()
cur = conn.cursor()
cur.execute(sql)
conn.commit()
cur.close()
conn.close()
print("Migration complete: name column added and populated in prospects table.")
14 changes: 14 additions & 0 deletions app/api/prospects/sql/run_alter_drop_mobile_phone.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import os
import sys
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../../../..')))
from app.utils.db import get_db_connection_direct

if __name__ == "__main__":
sql = "ALTER TABLE prospects DROP COLUMN IF EXISTS mobile_phone;"
conn = get_db_connection_direct()
cur = conn.cursor()
cur.execute(sql)
conn.commit()
cur.close()
conn.close()
print('Migration complete: mobile_phone column dropped from prospects table.')
14 changes: 14 additions & 0 deletions app/api/prospects/sql/run_alter_drop_other_phone.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import os
import sys
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../../../..')))
from app.utils.db import get_db_connection_direct

if __name__ == "__main__":
sql = "ALTER TABLE prospects DROP COLUMN IF EXISTS other_phone;"
conn = get_db_connection_direct()
cur = conn.cursor()
cur.execute(sql)
conn.commit()
cur.close()
conn.close()
print('Migration complete: other_phone column dropped from prospects table.')
14 changes: 14 additions & 0 deletions app/api/prospects/sql/run_alter_drop_other_photne.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import os
import sys
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../../../..')))
from app.utils.db import get_db_connection_direct

if __name__ == "__main__":
sql = "ALTER TABLE prospects DROP COLUMN IF EXISTS other_photne;"
conn = get_db_connection_direct()
cur = conn.cursor()
cur.execute(sql)
conn.commit()
cur.close()
conn.close()
print('Migration complete: other_photne column dropped from prospects table.')
14 changes: 14 additions & 0 deletions app/api/prospects/sql/run_alter_drop_subsidiary_of.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import os
import sys
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../../../..')))
from app.utils.db import get_db_connection_direct

if __name__ == "__main__":
sql = "ALTER TABLE prospects DROP COLUMN IF EXISTS subsidiary_of;"
conn = get_db_connection_direct()
cur = conn.cursor()
cur.execute(sql)
conn.commit()
cur.close()
conn.close()
print('Migration complete: subsidiary_of column dropped from prospects table.')
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import os
import sys
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../../../..')))
from app.utils.db import get_db_connection_direct

if __name__ == "__main__":
sql = "ALTER TABLE prospects DROP COLUMN IF EXISTS subsidiary_of_organization_id;"
conn = get_db_connection_direct()
cur = conn.cursor()
cur.execute(sql)
conn.commit()
cur.close()
conn.close()
print('Migration complete: subsidiary_of_organization_id column dropped from prospects table.')
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import os
import sys
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../../../..')))
from app.utils.db import get_db_connection_direct

if __name__ == "__main__":
sql = "ALTER TABLE prospects RENAME COLUMN person_linkedin_url TO linkedin;"
conn = get_db_connection_direct()
cur = conn.cursor()
cur.execute(sql)
conn.commit()
cur.close()
conn.close()
print('Migration complete: person_linkedin_url column renamed to linkedin in prospects table.')
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import os
import sys
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../../../..')))
from app.utils.db import get_db_connection_direct

if __name__ == "__main__":
sql = "ALTER TABLE prospects RENAME COLUMN person_linkinkedin_url TO linkedin;"
conn = get_db_connection_direct()
cur = conn.cursor()
cur.execute(sql)
conn.commit()
cur.close()
conn.close()
print('Migration complete: person_linkinkedin_url column renamed to linkedin in prospects table.')
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import os
import sys
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../../../..')))
from app.utils.db import get_db_connection_direct

if __name__ == "__main__":
sql = "ALTER TABLE prospects RENAME COLUMN sub_departments TO department;"
conn = get_db_connection_direct()
cur = conn.cursor()
cur.execute(sql)
conn.commit()
cur.close()
conn.close()
print('Migration complete: sub_departments column renamed to department in prospects table.')
Loading