diff --git a/app/api/prospects/sql/alter_add_name_and_populate.sql b/app/api/prospects/sql/alter_add_name_and_populate.sql new file mode 100644 index 0000000..d91cfa4 --- /dev/null +++ b/app/api/prospects/sql/alter_add_name_and_populate.sql @@ -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); diff --git a/app/api/prospects/sql/alter_drop_mobile_phone.sql b/app/api/prospects/sql/alter_drop_mobile_phone.sql new file mode 100644 index 0000000..efaa04b --- /dev/null +++ b/app/api/prospects/sql/alter_drop_mobile_phone.sql @@ -0,0 +1,2 @@ +-- Migration: Remove mobile_phone column from prospects table +ALTER TABLE prospects DROP COLUMN IF EXISTS mobile_phone; \ No newline at end of file diff --git a/app/api/prospects/sql/alter_drop_other_phone.sql b/app/api/prospects/sql/alter_drop_other_phone.sql new file mode 100644 index 0000000..a78ebf3 --- /dev/null +++ b/app/api/prospects/sql/alter_drop_other_phone.sql @@ -0,0 +1,2 @@ +-- Migration: Remove other_phone column from prospects table +ALTER TABLE prospects DROP COLUMN IF EXISTS other_phone; \ No newline at end of file diff --git a/app/api/prospects/sql/alter_drop_other_photne.sql b/app/api/prospects/sql/alter_drop_other_photne.sql new file mode 100644 index 0000000..7dc9658 --- /dev/null +++ b/app/api/prospects/sql/alter_drop_other_photne.sql @@ -0,0 +1,2 @@ +-- Migration: Remove other_photne column from prospects table +ALTER TABLE prospects DROP COLUMN IF EXISTS other_photne; \ No newline at end of file diff --git a/app/api/prospects/sql/alter_drop_subsidiary_of.sql b/app/api/prospects/sql/alter_drop_subsidiary_of.sql new file mode 100644 index 0000000..f0ea4af --- /dev/null +++ b/app/api/prospects/sql/alter_drop_subsidiary_of.sql @@ -0,0 +1,2 @@ +-- Migration: Remove subsidiary_of column from prospects table +ALTER TABLE prospects DROP COLUMN IF EXISTS subsidiary_of; \ No newline at end of file diff --git a/app/api/prospects/sql/alter_drop_subsidiary_of_organization_id.sql b/app/api/prospects/sql/alter_drop_subsidiary_of_organization_id.sql new file mode 100644 index 0000000..725186d --- /dev/null +++ b/app/api/prospects/sql/alter_drop_subsidiary_of_organization_id.sql @@ -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; \ No newline at end of file diff --git a/app/api/prospects/sql/alter_rename_person_linkinkedin_url_to_linkedin.sql b/app/api/prospects/sql/alter_rename_person_linkinkedin_url_to_linkedin.sql new file mode 100644 index 0000000..6bd61d1 --- /dev/null +++ b/app/api/prospects/sql/alter_rename_person_linkinkedin_url_to_linkedin.sql @@ -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; \ No newline at end of file diff --git a/app/api/prospects/sql/alter_rename_sub_departments_to_department.sql b/app/api/prospects/sql/alter_rename_sub_departments_to_department.sql new file mode 100644 index 0000000..bd1bf81 --- /dev/null +++ b/app/api/prospects/sql/alter_rename_sub_departments_to_department.sql @@ -0,0 +1,2 @@ +-- Migration: Rename sub_departments column to department in prospects table +ALTER TABLE prospects RENAME COLUMN sub_departments TO department; \ No newline at end of file diff --git a/app/api/prospects/sql/run_alter_add_name_and_populate.py b/app/api/prospects/sql/run_alter_add_name_and_populate.py new file mode 100644 index 0000000..e9b3d97 --- /dev/null +++ b/app/api/prospects/sql/run_alter_add_name_and_populate.py @@ -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.") diff --git a/app/api/prospects/sql/run_alter_drop_mobile_phone.py b/app/api/prospects/sql/run_alter_drop_mobile_phone.py new file mode 100644 index 0000000..de88796 --- /dev/null +++ b/app/api/prospects/sql/run_alter_drop_mobile_phone.py @@ -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.') diff --git a/app/api/prospects/sql/run_alter_drop_other_phone.py b/app/api/prospects/sql/run_alter_drop_other_phone.py new file mode 100644 index 0000000..c1af69d --- /dev/null +++ b/app/api/prospects/sql/run_alter_drop_other_phone.py @@ -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.') diff --git a/app/api/prospects/sql/run_alter_drop_other_photne.py b/app/api/prospects/sql/run_alter_drop_other_photne.py new file mode 100644 index 0000000..5d86967 --- /dev/null +++ b/app/api/prospects/sql/run_alter_drop_other_photne.py @@ -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.') diff --git a/app/api/prospects/sql/run_alter_drop_subsidiary_of.py b/app/api/prospects/sql/run_alter_drop_subsidiary_of.py new file mode 100644 index 0000000..256df24 --- /dev/null +++ b/app/api/prospects/sql/run_alter_drop_subsidiary_of.py @@ -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.') diff --git a/app/api/prospects/sql/run_alter_drop_subsidiary_of_organization_id.py b/app/api/prospects/sql/run_alter_drop_subsidiary_of_organization_id.py new file mode 100644 index 0000000..165de6d --- /dev/null +++ b/app/api/prospects/sql/run_alter_drop_subsidiary_of_organization_id.py @@ -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.') diff --git a/app/api/prospects/sql/run_alter_rename_person_linkedin_url_to_linkedin.py b/app/api/prospects/sql/run_alter_rename_person_linkedin_url_to_linkedin.py new file mode 100644 index 0000000..f1c439e --- /dev/null +++ b/app/api/prospects/sql/run_alter_rename_person_linkedin_url_to_linkedin.py @@ -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.') diff --git a/app/api/prospects/sql/run_alter_rename_person_linkinkedin_url_to_linkedin.py b/app/api/prospects/sql/run_alter_rename_person_linkinkedin_url_to_linkedin.py new file mode 100644 index 0000000..35581e0 --- /dev/null +++ b/app/api/prospects/sql/run_alter_rename_person_linkinkedin_url_to_linkedin.py @@ -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.') diff --git a/app/api/prospects/sql/run_alter_rename_sub_departments_to_department.py b/app/api/prospects/sql/run_alter_rename_sub_departments_to_department.py new file mode 100644 index 0000000..7076a10 --- /dev/null +++ b/app/api/prospects/sql/run_alter_rename_sub_departments_to_department.py @@ -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.')