Run the following command to set up the folder:
ansible-playbook app.yaml
Go to the migration folder and run the script:
./db_init.sh
This will create the database.
Go to the alembic/versions folder and locate the file that was just created for this migration. Inside the file replace the upgrade and downgrade with:
def upgrade() -> None:
op.create_table(
'todos',
sa.Column('id', UUID(as_uuid=True), primary_key=True, default=uuid.uuid4),
sa.Column('name', sa.String(100), nullable=False),
sa.Column('status', sa.Boolean, default=False)
)
def downgrade() -> None:
op.drop_table('todos')
Then in the import section add the following:
from sqlalchemy.dialects.postgresql import UUID
import uuid
Run the following script to run the migration:
./db_migrate.sh
Once that is successful run the following script to spin up the server:
./server_start.sh
You can curl the server to make sure that everything is working properly:
curl http://localhost:8000/api/v1/todos/
Run the following command to clean up the folder:
ansible-playbook cleanup.yaml