Fix: Import was not working as Customer Model changed and borked the initial commit of the database. Created a table in the function to remove dependence from the model.

Now poetry requires "poetry run" before commands to run them in the container. Updated for it.
This commit is contained in:
Amritanshu Agrawal 2021-07-31 16:09:41 +05:30
parent eedc571ade
commit afa4fd4711
2 changed files with 12 additions and 6 deletions

View File

@ -8,7 +8,6 @@ Create Date: 2020-06-04 08:14:34.132248
import sqlalchemy as sa
from alembic import op
from barker.models.customer import Customer
from barker.models.db_setting import DbSetting
from barker.models.modifier_category import ModifierCategory
from barker.models.permission import Permission
@ -77,8 +76,15 @@ def settle_options():
op.execute(so.insert().values(id=8, name="Amount", show_in_choices=False, display_group=1, is_print=False))
op.execute(so.insert().values(id=9, name="Void", show_in_choices=True, display_group=1, is_print=True))
op.execute(so.insert().values(id=10, name="Staff", show_in_choices=True, display_group=4, is_print=True))
customer = table(
"customers",
column("id", postgresql.UUID(as_uuid=True)),
column("name", sa.Unicode(length=255)),
column("phone", sa.Unicode(length=255)),
column("address", sa.Unicode(length=255)),
)
op.execute(
Customer.__table__.insert().values(
customer.insert().values(
id="2c716f4b-0736-429a-ad51-610d7c47cb5e",
name="Cash",
phone="",

View File

@ -39,7 +39,7 @@ docker run -it --link postgres:db --rm --env PGPASSWORD="123456" postgres:alpine
if [ $docker -eq 1 ]
then
docker start "$doname" || exit
docker exec -it "$doname" alembic upgrade 8c06ac60d125 || exit
docker exec -it "$doname" poetry run alembic upgrade 8c06ac60d125 || exit
else
cd "$parent_path"/barker || exit
alembic upgrade 8c06ac60d125 || exit
@ -66,7 +66,7 @@ docker run -it -v "$parent_path"/csv:/mnt --link postgres:db --rm --env PGPASSWO
if [ $docker -eq 1 ]
then
docker start "$doname" || exit
docker exec -it "$doname" alembic upgrade 34fe3d061c5f || exit
docker exec -it "$doname" poetry run alembic upgrade 34fe3d061c5f || exit
else
cd "$parent_path"/barker || exit
alembic upgrade 34fe3d061c5f || exit
@ -85,8 +85,8 @@ docker run -it -v "$parent_path"/csv:/mnt --link postgres:db --rm --env PGPASSWO
if [ $docker -eq 1 ]
then
docker start "$doname" || exit
docker exec -it "$doname" alembic upgrade 48bc1c7c07ce || exit
docker exec -it "$doname" alembic upgrade e5e8acfc6495 || exit
docker exec -it "$doname" poetry run alembic upgrade 48bc1c7c07ce || exit
docker exec -it "$doname" poetry run alembic upgrade e5e8acfc6495 || exit
else
cd "$parent_path"/barker || exit
alembic upgrade 48bc1c7c07ce || exit