Get project working locally

This commit is contained in:
Peter Stockings
2024-12-24 00:57:08 +11:00
parent d4fc1868ab
commit 11239fd4f5
22 changed files with 1214 additions and 14 deletions

View File

@@ -0,0 +1,38 @@
"""Change Password Hash column to text0
Revision ID: 59097bee8942
Revises: b409c5bae0bb
Create Date: 2024-12-24 00:35:11.199266
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '59097bee8942'
down_revision = 'b409c5bae0bb'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('user', schema=None) as batch_op:
batch_op.alter_column('password_hash',
existing_type=sa.VARCHAR(length=150),
type_=sa.Text(),
existing_nullable=False)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('user', schema=None) as batch_op:
batch_op.alter_column('password_hash',
existing_type=sa.Text(),
type_=sa.VARCHAR(length=150),
existing_nullable=False)
# ### end Alembic commands ###

View File

@@ -0,0 +1,38 @@
"""Increase length of password_hash column
Revision ID: b409c5bae0bb
Revises: e276f9e056a2
Create Date: 2024-12-24 00:33:58.419416
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'b409c5bae0bb'
down_revision = 'e276f9e056a2'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('user', schema=None) as batch_op:
batch_op.alter_column('username',
existing_type=sa.VARCHAR(length=150),
type_=sa.String(length=255),
existing_nullable=False)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('user', schema=None) as batch_op:
batch_op.alter_column('username',
existing_type=sa.String(length=255),
type_=sa.VARCHAR(length=150),
existing_nullable=False)
# ### end Alembic commands ###

View File

@@ -0,0 +1,59 @@
"""Add tables
Revision ID: e276f9e056a2
Revises:
Create Date: 2024-12-24 00:28:49.674352
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'e276f9e056a2'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('user',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('username', sa.String(length=150), nullable=False),
sa.Column('password_hash', sa.String(length=150), nullable=False),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('username')
)
op.create_table('profile',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('user_id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=100), nullable=True),
sa.Column('email', sa.String(length=150), nullable=True),
sa.Column('profile_pic', sa.Text(), nullable=True),
sa.Column('systolic_threshold', sa.Integer(), nullable=True),
sa.Column('diastolic_threshold', sa.Integer(), nullable=True),
sa.Column('dark_mode', sa.Boolean(), nullable=True),
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('email')
)
op.create_table('reading',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('user_id', sa.Integer(), nullable=False),
sa.Column('timestamp', sa.DateTime(), nullable=False),
sa.Column('systolic', sa.Integer(), nullable=False),
sa.Column('diastolic', sa.Integer(), nullable=False),
sa.Column('heart_rate', sa.Integer(), nullable=False),
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
sa.PrimaryKeyConstraint('id')
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('reading')
op.drop_table('profile')
op.drop_table('user')
# ### end Alembic commands ###