Skip to content

Commit e830d20

Browse files
alembic migration
1 parent 104c564 commit e830d20

File tree

1 file changed

+106
-0
lines changed

1 file changed

+106
-0
lines changed
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
"""postgres matching
2+
3+
Revision ID: 45a668fa6325
4+
Revises: fc7325372396
5+
Create Date: 2022-02-10 16:19:13.283250
6+
7+
"""
8+
from alembic import op
9+
import sqlalchemy as sa
10+
from sqlalchemy.dialects import postgresql
11+
12+
# revision identifiers, used by Alembic.
13+
revision = '45a668fa6325'
14+
down_revision = 'fc7325372396'
15+
branch_labels = None
16+
depends_on = None
17+
18+
19+
def upgrade():
20+
# ### commands auto generated by Alembic - please adjust! ###
21+
op.create_table('manual_matches',
22+
sa.Column('source_type_1', sa.String(), nullable=False),
23+
sa.Column('source_id_1', sa.String(), nullable=False),
24+
sa.Column('source_type_2', sa.String(), nullable=False),
25+
sa.Column('source_id_2', sa.String(), nullable=False),
26+
sa.PrimaryKeyConstraint('source_type_1', 'source_id_1', 'source_type_2', 'source_id_2')
27+
)
28+
op.create_table('salesforcecontacts',
29+
sa.Column('_id', sa.Integer(), nullable=False),
30+
sa.Column('contact_id', sa.String(), nullable=True),
31+
sa.Column('first_name', sa.String(), nullable=True),
32+
sa.Column('last_name', sa.String(), nullable=True),
33+
sa.Column('account_name', sa.String(), nullable=True),
34+
sa.Column('mailing_country', sa.String(), nullable=True),
35+
sa.Column('mailing_street', sa.String(), nullable=True),
36+
sa.Column('mailing_city', sa.String(), nullable=True),
37+
sa.Column('mailing_state_province', sa.String(), nullable=True),
38+
sa.Column('mailing_zip_postal_code', sa.String(), nullable=True),
39+
sa.Column('phone', sa.String(), nullable=True),
40+
sa.Column('mobile', sa.String(), nullable=True),
41+
sa.Column('email', sa.String(), nullable=True),
42+
sa.Column('json', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
43+
sa.Column('created_date', sa.DateTime(), nullable=True),
44+
sa.PrimaryKeyConstraint('_id')
45+
)
46+
op.create_table('shelterluvpeople',
47+
sa.Column('_id', sa.Integer(), nullable=False),
48+
sa.Column('firstname', sa.String(), nullable=True),
49+
sa.Column('lastname', sa.String(), nullable=True),
50+
sa.Column('id', sa.String(), nullable=True),
51+
sa.Column('internal_id', sa.String(), nullable=True),
52+
sa.Column('associated', sa.String(), nullable=True),
53+
sa.Column('street', sa.String(), nullable=True),
54+
sa.Column('apartment', sa.String(), nullable=True),
55+
sa.Column('city', sa.String(), nullable=True),
56+
sa.Column('state', sa.String(), nullable=True),
57+
sa.Column('zip', sa.String(), nullable=True),
58+
sa.Column('email', sa.String(), nullable=True),
59+
sa.Column('phone', sa.String(), nullable=True),
60+
sa.Column('animal_ids', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
61+
sa.Column('json', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
62+
sa.Column('created_date', sa.DateTime(), nullable=True),
63+
sa.PrimaryKeyConstraint('_id')
64+
)
65+
op.create_table('volgistics',
66+
sa.Column('_id', sa.Integer(), nullable=False),
67+
sa.Column('number', sa.String(), nullable=True),
68+
sa.Column('last_name', sa.String(), nullable=True),
69+
sa.Column('first_name', sa.String(), nullable=True),
70+
sa.Column('middle_name', sa.String(), nullable=True),
71+
sa.Column('complete_address', sa.String(), nullable=True),
72+
sa.Column('street_1', sa.String(), nullable=True),
73+
sa.Column('street_2', sa.String(), nullable=True),
74+
sa.Column('street_3', sa.String(), nullable=True),
75+
sa.Column('city', sa.String(), nullable=True),
76+
sa.Column('state', sa.String(), nullable=True),
77+
sa.Column('zip', sa.String(), nullable=True),
78+
sa.Column('all_phone_numbers', sa.String(), nullable=True),
79+
sa.Column('home', sa.String(), nullable=True),
80+
sa.Column('work', sa.String(), nullable=True),
81+
sa.Column('cell', sa.String(), nullable=True),
82+
sa.Column('email', sa.String(), nullable=True),
83+
sa.Column('json', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
84+
sa.Column('created_date', sa.DateTime(), nullable=True),
85+
sa.PrimaryKeyConstraint('_id')
86+
)
87+
op.create_index('idx_pdp_contacts_source_type_and_id', 'pdp_contacts', ['source_type', 'source_id'], unique=False)
88+
op.create_index(op.f('ix_pdp_contacts_email'), 'pdp_contacts', ['email'], unique=False)
89+
op.create_index(op.f('ix_pdp_contacts_mobile'), 'pdp_contacts', ['mobile'], unique=False)
90+
op.create_index(op.f('idx_pdp_contacts_lower_first_name'), 'pdp_contacts', [sa.text('lower(first_name)')], unique=False)
91+
op.create_index(op.f('idx_pdp_contacts_lower_last_name'), 'pdp_contacts', [sa.text('lower(last_name)')], unique=False)
92+
# ### end Alembic commands ###
93+
94+
95+
def downgrade():
96+
# ### commands auto generated by Alembic - please adjust! ###
97+
op.drop_index(op.f('ix_pdp_contacts_lower_last_name'), table_name='pdp_contacts')
98+
op.drop_index(op.f('ix_pdp_contacts_lower_first_name'), table_name='pdp_contacts')
99+
op.drop_index(op.f('ix_pdp_contacts_mobile'), table_name='pdp_contacts')
100+
op.drop_index(op.f('ix_pdp_contacts_email'), table_name='pdp_contacts')
101+
op.drop_index('idx_pdp_contacts_source_type_and_id', table_name='pdp_contacts')
102+
op.drop_table('volgistics')
103+
op.drop_table('shelterluvpeople')
104+
op.drop_table('salesforcecontacts')
105+
op.drop_table('manual_matches')
106+
# ### end Alembic commands ###

0 commit comments

Comments
 (0)