Development
Database banner seeding

Database CMS seeding

Now that all shopify products are synced to the shophub database, you may consider seeding your database with mock data for CMS banners.

💡
This part requires that your project has been set up in your docker correctly.

Backend docker container id

Once your docker is up and running, we need to connect our terminal to the bash of the docker to run commands. First of all will we need the hash of the backend docker container:

docker ps

This will list all currently running docker container.

List of all docker container and their ids.

Copy the id of the shophub-backend container. In this example this would be fad8383f5e73.

Docker bash

Now we can connect to the dockers bash. Replace <shophub-backend-docker-id> with the id of the docker container.

docker exec -it <shophub-backend-docker-id> bash

Run seeding script

Now we are inside the bash and can run the seeding script, that is located in the backend. So first of all we need to navigate into the backend package

docker shell
cd packages/backend

Now lets run the seeding script.

docker shell
npx ts-node src/db/seed-cms.ts

Once completed we can close the terminated the connection to the docker bash. The database should now be populated with a bunch of mock banners, useful for development and testing.