Skip to content

Commit 7e24bb9

Browse files
estebanx64alejsdevtiangolo
authored
♻️ Edit refactor models, routes and utils to use UUID instead of id integers (#153)
Co-authored-by: Alejandra <[email protected]> Co-authored-by: User <[email protected]> Co-authored-by: Sebastián Ramírez <[email protected]>
1 parent 2db5d29 commit 7e24bb9

28 files changed

+852
-1216
lines changed

backend/app/alembic/versions/2e7525f9d21b_add_username_and_is_verified_column_.py

Lines changed: 0 additions & 39 deletions
This file was deleted.

backend/app/alembic/versions/30a55259019b_add_column_personal_team_id_to_user_.py

Lines changed: 0 additions & 31 deletions
This file was deleted.

backend/app/alembic/versions/3a7df55f39d3_add_invitations_table.py

Lines changed: 0 additions & 43 deletions
This file was deleted.

backend/app/alembic/versions/4df8ae4a83c0_merge_heads.py

Lines changed: 0 additions & 25 deletions
This file was deleted.

backend/app/alembic/versions/56310da83983_add_organization_table_and_.py

Lines changed: 0 additions & 43 deletions
This file was deleted.

backend/app/alembic/versions/6eb318701c26_merge_heads.py

Lines changed: 0 additions & 25 deletions
This file was deleted.
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
"""Initial setup
2+
3+
Revision ID: 89c9a00d523e
4+
Revises:
5+
Create Date: 2024-07-18 22:25:02.356343
6+
7+
"""
8+
from alembic import op
9+
import sqlalchemy as sa
10+
import sqlmodel.sql.sqltypes
11+
12+
13+
# revision identifiers, used by Alembic.
14+
revision = '89c9a00d523e'
15+
down_revision = None
16+
branch_labels = None
17+
depends_on = None
18+
19+
20+
def upgrade():
21+
# ### commands auto generated by Alembic - please adjust! ###
22+
op.create_table('team',
23+
sa.Column('name', sqlmodel.sql.sqltypes.AutoString(length=255), nullable=False),
24+
sa.Column('description', sqlmodel.sql.sqltypes.AutoString(length=255), nullable=True),
25+
sa.Column('id', sa.Uuid(), nullable=False),
26+
sa.Column('slug', sqlmodel.sql.sqltypes.AutoString(length=255), nullable=False),
27+
sa.PrimaryKeyConstraint('id')
28+
)
29+
op.create_index(op.f('ix_team_slug'), 'team', ['slug'], unique=True)
30+
op.create_table('user',
31+
sa.Column('email', sqlmodel.sql.sqltypes.AutoString(length=255), nullable=False),
32+
sa.Column('is_active', sa.Boolean(), nullable=False),
33+
sa.Column('full_name', sqlmodel.sql.sqltypes.AutoString(length=255), nullable=False),
34+
sa.Column('id', sa.Uuid(), nullable=False),
35+
sa.Column('hashed_password', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
36+
sa.Column('username', sqlmodel.sql.sqltypes.AutoString(length=255), nullable=False),
37+
sa.Column('is_verified', sa.Boolean(), nullable=False),
38+
sa.Column('personal_team_id', sa.Uuid(), nullable=True),
39+
sa.ForeignKeyConstraint(['personal_team_id'], ['team.id'], ),
40+
sa.PrimaryKeyConstraint('id')
41+
)
42+
op.create_index(op.f('ix_user_email'), 'user', ['email'], unique=True)
43+
op.create_index(op.f('ix_user_username'), 'user', ['username'], unique=True)
44+
op.create_table('invitation',
45+
sa.Column('role', sa.Enum('member', 'admin', name='role'), nullable=False),
46+
sa.Column('email', sqlmodel.sql.sqltypes.AutoString(length=255), nullable=False),
47+
sa.Column('id', sa.Uuid(), nullable=False),
48+
sa.Column('team_id', sa.Uuid(), nullable=False),
49+
sa.Column('invited_by_id', sa.Uuid(), nullable=False),
50+
sa.Column('status', sa.Enum('pending', 'accepted', name='invitationstatus'), nullable=False),
51+
sa.Column('created_at', sa.DateTime(), nullable=False),
52+
sa.Column('expires_at', sa.DateTime(), nullable=False),
53+
sa.ForeignKeyConstraint(['invited_by_id'], ['user.id'], ),
54+
sa.ForeignKeyConstraint(['team_id'], ['team.id'], ),
55+
sa.PrimaryKeyConstraint('id')
56+
)
57+
op.create_table('userteamlink',
58+
sa.Column('user_id', sa.Uuid(), nullable=False),
59+
sa.Column('team_id', sa.Uuid(), nullable=False),
60+
sa.Column('role', sa.Enum('member', 'admin', name='role'), nullable=False),
61+
sa.ForeignKeyConstraint(['team_id'], ['team.id'], ),
62+
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
63+
sa.PrimaryKeyConstraint('user_id', 'team_id')
64+
)
65+
# ### end Alembic commands ###
66+
67+
68+
def downgrade():
69+
# ### commands auto generated by Alembic - please adjust! ###
70+
op.drop_table('userteamlink')
71+
op.drop_table('invitation')
72+
op.drop_index(op.f('ix_user_username'), table_name='user')
73+
op.drop_index(op.f('ix_user_email'), table_name='user')
74+
op.drop_table('user')
75+
op.drop_index(op.f('ix_team_slug'), table_name='team')
76+
op.drop_table('team')
77+
# ### end Alembic commands ###

backend/app/alembic/versions/a17996bd5bff_merge_heads.py

Lines changed: 0 additions & 25 deletions
This file was deleted.

backend/app/alembic/versions/a9b76125b71a_remove_is_superuser_from_user_table_and_.py

Lines changed: 0 additions & 44 deletions
This file was deleted.

0 commit comments

Comments
 (0)