Skip to content

Commit 5660948

Browse files
committed
add patient migration
1 parent b980aec commit 5660948

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
"""Add Patient base model
2+
3+
Revision ID: 1cabfca3d8c8
4+
Revises: 1a31ce608336
5+
Create Date: 2025-03-02 16:54:50.053566
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 = '1cabfca3d8c8'
15+
down_revision = '1a31ce608336'
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('patient',
23+
sa.Column('full_name', sqlmodel.sql.sqltypes.AutoString(length=255), nullable=False),
24+
sa.Column('description', sqlmodel.sql.sqltypes.AutoString(length=255), nullable=True),
25+
sa.Column('email', sqlmodel.sql.sqltypes.AutoString(length=55), nullable=False),
26+
sa.Column('phone_number', sqlmodel.sql.sqltypes.AutoString(length=20), nullable=False),
27+
sa.Column('height', sa.Float(), nullable=False),
28+
sa.Column('weight', sa.Float(), nullable=False),
29+
sa.Column('gender', sa.Integer(), nullable=False),
30+
sa.Column('birth_date', sa.TIMESTAMP(timezone=True), nullable=False),
31+
sa.Column('id', sa.Uuid(), nullable=False),
32+
sa.Column('owner_id', sa.Uuid(), nullable=False),
33+
sa.Column('created_datetime', sa.TIMESTAMP(timezone=True), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False),
34+
sa.ForeignKeyConstraint(['owner_id'], ['user.id'], ondelete='CASCADE'),
35+
sa.PrimaryKeyConstraint('id')
36+
)
37+
# ### end Alembic commands ###
38+
39+
40+
def downgrade():
41+
# ### commands auto generated by Alembic - please adjust! ###
42+
op.drop_table('patient')
43+
# ### end Alembic commands ###

0 commit comments

Comments
 (0)