ScyllaDB University Live | Free Virtual Training Event
Learn more
ScyllaDB Documentation Logo Documentation
  • Server
  • Cloud
  • Tools
    • ScyllaDB Manager
    • ScyllaDB Monitoring Stack
    • ScyllaDB Operator
  • Drivers
    • CQL Drivers
    • DynamoDB Drivers
  • Resources
    • ScyllaDB University
    • Community Forum
    • Tutorials
Download
ScyllaDB Docs ScyllaDB ecommerce shopping cart sample app Data model

Data modelΒΆ

CREATE KEYSPACE IF NOT EXISTS ecommerce WITH replication = { 'class': 'NetworkTopologyStrategy', 'replication_factor': '3' };

CREATE TABLE ecommerce.product (
    id UUID,
    name TEXT,
    price FLOAT,
    img TEXT,
    PRIMARY KEY (id)
);

CREATE TABLE ecommerce.cart (
    user_id TEXT,
    cart_id UUID,
    is_active BOOLEAN,
    PRIMARY KEY (user_id, cart_id)
);
CREATE INDEX cart_is_active ON ecommerce.cart ((user_id), is_active);

CREATE TABLE ecommerce.cart_items (
    user_id TEXT,
    cart_id UUID,
    product_id UUID,
    product_quantity INT,
    PRIMARY KEY (user_id, cart_id, product_id)
) WITH cdc = {'enabled': true, 'preimage': true, 'postimage': true};

Was this page helpful?

PREVIOUS
Getting started
NEXT
Hands-on tutorial
  • Create an issue
  • Edit this page
ScyllaDB ecommerce shopping cart sample app
  • main
  • Getting started
  • Data model
  • Hands-on tutorial
  • GitHub repository
Docs Tutorials University Contact Us About Us
© 2025, ScyllaDB. All rights reserved. | Terms of Service | Privacy Policy | ScyllaDB, and ScyllaDB Cloud, are registered trademarks of ScyllaDB, Inc.
Last updated on 05 May 2025.
Powered by Sphinx 7.4.7 & ScyllaDB Theme 1.8.6