-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(backend): Added psycopg2-binary package and fixed non async support
- Loading branch information
Imanuel Febie
committed
Nov 14, 2024
1 parent
398423a
commit c6aea5b
Showing
6 changed files
with
209 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
104 changes: 104 additions & 0 deletions
104
langkah-api/migrations/versions/ca1296c1d73a_first_migration.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
"""first migration | ||
Revision ID: ca1296c1d73a | ||
Revises: | ||
Create Date: 2024-11-14 12:42:02.877254 | ||
""" | ||
from typing import Sequence, Union | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision: str = 'ca1296c1d73a' | ||
down_revision: Union[str, None] = None | ||
branch_labels: Union[str, Sequence[str], None] = None | ||
depends_on: Union[str, Sequence[str], None] = None | ||
|
||
|
||
def upgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.create_table('food_products', | ||
sa.Column('id', sa.UUID(), nullable=False), | ||
sa.Column('code', sa.String(), nullable=False), | ||
sa.Column('name', sa.String(), nullable=False), | ||
sa.Column('brand', sa.String(), nullable=True), | ||
sa.Column('energy_kcal', sa.Integer(), nullable=False), | ||
sa.Column('fat', sa.Float(), nullable=False), | ||
sa.Column('saturated_fat', sa.Float(), nullable=False), | ||
sa.Column('trans_fat', sa.Float(), nullable=False), | ||
sa.Column('carbohydrates', sa.Float(), nullable=False), | ||
sa.Column('sugars', sa.Float(), nullable=False), | ||
sa.Column('fiber', sa.Float(), nullable=True), | ||
sa.Column('proteins', sa.Float(), nullable=False), | ||
sa.Column('salt', sa.Float(), nullable=True), | ||
sa.Column('sodium', sa.Float(), nullable=True), | ||
sa.Column('calcium', sa.Float(), nullable=True), | ||
sa.Column('iron', sa.Float(), nullable=True), | ||
sa.Column('vitamin_a', sa.Float(), nullable=True), | ||
sa.Column('vitamin_c', sa.Float(), nullable=True), | ||
sa.Column('completeness', sa.Float(), nullable=True), | ||
sa.Column('nutriscore_grade', sa.String(), nullable=True), | ||
sa.PrimaryKeyConstraint('id'), | ||
sa.UniqueConstraint('code'), | ||
sa.UniqueConstraint('id') | ||
) | ||
op.create_table('users', | ||
sa.Column('id', sa.UUID(), nullable=False), | ||
sa.Column('name', sa.String(), nullable=False), | ||
sa.Column('avatar', sa.String(), nullable=True), | ||
sa.Column('height', sa.Float(), nullable=False), | ||
sa.Column('sex', sa.Enum('MALE', 'FEMALE', name='sex'), nullable=False), | ||
sa.Column('activity_level', sa.Enum('SEDENTARY', 'LIGHTLY_ACTIVE', 'MODERATELY_ACTIVE', 'VERY_ACTIVE', name='activitylevel'), nullable=False), | ||
sa.Column('goal', sa.Enum('WEIGHT_LOSS', 'MUSCLE_GAIN', 'MAINTAIN', 'BODY_RECOMPOSITION', name='goal'), nullable=False), | ||
sa.Column('daily_caloric_needs', sa.Float(), nullable=True), | ||
sa.PrimaryKeyConstraint('id'), | ||
sa.UniqueConstraint('id') | ||
) | ||
op.create_table('body_metrics', | ||
sa.Column('id', sa.UUID(), nullable=False), | ||
sa.Column('timestamp', sa.Date(), nullable=False), | ||
sa.Column('weight', sa.Float(), nullable=False), | ||
sa.Column('body_fat_percentage', sa.Float(), nullable=True), | ||
sa.Column('muscle_mass', sa.Float(), nullable=True), | ||
sa.Column('waist', sa.Float(), nullable=True), | ||
sa.Column('left_arm', sa.Float(), nullable=True), | ||
sa.Column('right_arm', sa.Float(), nullable=True), | ||
sa.Column('left_leg', sa.Float(), nullable=True), | ||
sa.Column('right_leg', sa.Float(), nullable=True), | ||
sa.Column('chest', sa.Float(), nullable=True), | ||
sa.Column('hips', sa.Float(), nullable=True), | ||
sa.Column('user_id', sa.UUID(), nullable=False), | ||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ), | ||
sa.PrimaryKeyConstraint('id'), | ||
sa.UniqueConstraint('id') | ||
) | ||
op.create_table('meals', | ||
sa.Column('id', sa.UUID(), nullable=False), | ||
sa.Column('name', sa.String(length=222), nullable=False), | ||
sa.Column('timestamp', sa.Date(), nullable=False), | ||
sa.Column('user_id', sa.UUID(), nullable=False), | ||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ), | ||
sa.PrimaryKeyConstraint('id'), | ||
sa.UniqueConstraint('id') | ||
) | ||
op.create_table('meal_food_product', | ||
sa.Column('meal_id', sa.UUID(), nullable=False), | ||
sa.Column('food_product_id', sa.UUID(), nullable=False), | ||
sa.ForeignKeyConstraint(['food_product_id'], ['food_products.id'], ), | ||
sa.ForeignKeyConstraint(['meal_id'], ['meals.id'], ), | ||
sa.PrimaryKeyConstraint('meal_id', 'food_product_id') | ||
) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_table('meal_food_product') | ||
op.drop_table('meals') | ||
op.drop_table('body_metrics') | ||
op.drop_table('users') | ||
op.drop_table('food_products') | ||
# ### end Alembic commands ### |