Schema markup for product categories and subcategories – how to?

I’ve been wondering about which Schema should I use for an e-commerce site of one of my clients’ website. Can’t show proper code and sensitive information, but I’ll try to explain what I’ve been thinking about.

Right here:

The author says that for category pages I should use ItemList Schema

<script type="application/ld+json">  {  "@context":"",  "@type":"ItemList",  "ItemListElement":  [    {   "@type":"ListItem",    "position":0,    "url":""   },    {    "@type":"ListItem",    "position":1,    "url":""    },    {    "@type":"ListItem",    "position":2,    "url":""    }   ]  } </script> 

Does anyone have an example of how it would look? For example, if I have a category with electric guitars with 5 subcategories that contain certain electric guitar models which would be listed in the schema ListItem. Is that the best schema type for this instance?

Second question – when it comes to subcategories, should I use ItemList Schema?

<script type="application/ld+json"> {     "@context": "",     "@type": "ItemList",     "url": "",     "numberOfItems": "2",     "itemListElement": [           {             "@type": "ListItem",             "position": 1,             "item": {               "@type": "Product",                   "image": "",                   "url": "",                   "name": "Product One",                   "offers": {                       "@type": "Offer",                       "price": "13.00",                       "priceCurrency": "USD",                       "url": ""                   }             }           },           {             "@type": "ListItem",             "position": 2,             "item": {               "@type": "Product",                   "image": "",                   "url": "",                   "name": "Product Two",                   "offers": {                       "@type": "Offer",                       "price": "12.00",                       "priceCurrency": "USD",                       "url": ""                   }               }           }     ] } </script> 

I know that it’s a bit of a gray area for Google when it comes to adding product information on category pages – does that apply also for the subcategory pages?

I would be so thankful for Your help and guidance <3 Cheers

Appropriate database schema for heroes’ skills in a Tower Defense game?

In a Tower Defense game, each hero (or character) has some skills. Each skill has some "chance of appearance" (CoA for short) when attacking enemies and if appeared it has some "hit accuracy" (i.e. hit on enemies) (HA for short) and has effects on the enemies (if hit by the skill) (EoH for short).


Skill #1: Frost 1, CoA: 50%, HA: 100%, EoH: (1) slow enemy down for 4s and (2) yield 200 damage points.

Skill #2: Frost 2, CoA: 100%, HA: 50%, EoH: (1) make enemy frozen for 8s.

I first tried to breakdown skills into "atomic" effects and come up with tables as below:

enter image description here

All looks good?

But now we want to update Skill #1 a bit to make it more complicated:

Skill #1: Frost 1, CoA: 50%, HA: 100%, EoH: (1) slow enemy down by 40% for 4s and (2) yield 200 damage points. (Please pay attention to the 40% here!)

Or even coming up with more complicated skills:

Skill #3: Frost 3, CoA: 20%, HA: 100%, EoH: (1) frozen enemy for the first 4s then slow enemy down by 50% for next 4s and (2) yield 200 more damage points.

Skill #4: Frost 4, CoA: 10%, attack enemy 3 times continuously, each time: HA: 50%, EoH: (1) frozen enemy for the first 2s then slow enemy down by 50% for next 2s and (2) yield 400 more damage points.

Each effect now has more parameters to be specified — which makes my current schema not fit anymore. Please help deal with this!

The most generic e-shop DB schema

Let’s say I create a schema for an e-shop what potentially sells everything: laptops, phones, tires, snacks etc. Considering this, I cannot create a new table/entity for each good category the shop sells and describe the good’s properties by new attributes.

So, I went to more generic model to describe each product To me, it seems fine but as soon as I’ve tried to implement this solution, it’s appeared to impossible to execute any query like

select names and prices of all laptops where ssd capacity >= 512 and weight < 2kg and price <= 2000 money

How is possible to change this schema and keep the ability to store information about any product?

Postgres: Efficient schema for querying with one exact string match and two range matches

The table I need to query:

CREATE TABLE regions (     state text NOT NULL,     zip_begin text NOT NULL,  -- 9-digit zip code     zip_end text NOT NULL,     date_begin date NOT NULL,     date_end date,      data ..., ) 

There are ~50 states and between 0-5M rows per state. The zip and date ranges might overlap.

The following will be one of the most common queries in my OLTP application:

SELECT data FROM regions WHERE state = {state}   AND {date} BETWEEN date_begin AND date_end   AND {zip} BETWEEN zip_begin AND zip_end 

This query usually yields one row, but may sometimes yield more.

From the Postgres docs, it sounds like a GiST index might do what I need, but I don’t really understand how those work.

What should the schema look like for an API-based SaaS product?

I’m building a developer tool product, which will be accessible solely by APIs. Following are a few features I’ve identified that will be needed:

  1. Issuing/refreshing API keys
  2. Purchasing API credits
  3. Subscriptions for API credits
  4. Monitoring usage of API for each user
  5. Deducting an API credit for each call

What all considerations should I take into account when designing a schema for this? Are there any open examples of schemas for such a product? Is there a term for this?

Note that this would be quite similar to what something like Stripe or any API-based SaaS is doing.

Data Schema For Stock Control / Multi Source Inventory

I’m working on a project that involves stock control with multiple stock sources and sales channels. The overall hierarchy I’ve got so far looks like this;

Sales Channels <---- Allocated Stock Sources <---- Stock Locations (warehouses) <--- Stock Sub Locations <---- Shelf / Bin Locations 

As far as rules go for how these entities relate to each other I’ve come up with this;

The system must have one or more sales channels, each sales channel must have 1 or more stock sources, a stock source must have 1 or more stock locations (warehouses / buildings / distribution centres ), a stock location may have 1 or more Bin/Shelf locations.

A product may have 1 or more stock locations, may have one or more sub locations in those stock locations and may have one or more Shelf / Bin location.

First off, is this a solved problem where some reference schema exists I could utilise and save myself some headaches?

If there isn’t a reference design for this situation, Am I best to build a 1 to Many relationship to assign stock to a sub location(s) and another 1 to Many relationship for Shelf Locations (if exists)

Review of Log Messages Database Schema

so i have been tasked to design a log database and i would appreciate some feedback about my design.

I have an application that consists of three basic parts:

  • A frontend
  • A backend
  • A low level component

Each part can create a log message which needs to be stored in a database. The parts(front end, backend, low level component) that create the log messages should be uniquely identified. At the same time when looking at a message it should be possible to see which part created the message.

Each message has a specific type assigned to it and the type can be one of the following destinct values

  • Error,
  • Warning,
  • Info,
  • Debug

The message itself should also be unique, it should have a text that says what is the problem and possibly also a description with extra information about the problem and under which circumstances it could have happened. In addition the time the message was created is very important. Because of the low level component we need microsecond accuracy.


Message : Pump Failure

Description: The pump is not pumping enough oil. Check the amount of oil and also check the temperature of the system.

Finally there are some extra "requirements" that in my opinion could affect the design of the system: The low level component produces a lot of messages in a short amount of time. This could lead to the database reaching its storage limit relatively fast. In that case the older messages should be deleted first. However there are rules that need to be taken into consideration before deleting a message. An info is less important than a warning and a warning is less important than an error. Another rule is unless I have reached a specific threshold I am not allowed to delete messages of a specific type e.g Only if have more than 500 errors am I allowed to start deleting the older errors.

My current design is the following:

Message     Id (PK)     Name varchar     Description varchar 
MessageType     Id (PK)     Name Varchar 
Sender     Id (PK)     Name Varchar 
MessagesLog     Id (PK)     MessageId (FK)     SenderId (FK)     NotificationTypeId(FK)     Date BigInt 

However taking into consideration these extra requirements and thinking that I will need to do a lot of checking on an application level if certain criteria are fullfiled before i delete a record from the database, i thought about creating a seperate table for each message type:

Message     Id (PK)     Name varchar     Description 
Sender     Id (PK)     Name Varchar 
MessagesLogError     Id (PK)     MessageId (FK)     SenderId (FK)     Date BigInt 
MessagesLogWarning     Id (PK)     MessageId (FK)     SenderId (FK)     Date BigInt 
MessagesLogInfo     Id (PK)     MessageId (FK)     SenderId (FK)     Date BigInt 
MessagesLogDebug     Id (PK)     MessageId (FK)     SenderId (FK)     Date BigInt 

What do you think?