Francis Menguito
05/19/2022, 8:20 AMStack francis-alloy-one-StorageStack
Status: failed
Error: francis-sst-one-orders already exists
Is there a way that it wont error everytime I start and stop my SST?outaTiME
05/19/2022, 1:22 PMFrancis Menguito
05/19/2022, 1:23 PMFrancis Menguito
05/19/2022, 1:24 PMoutaTiME
05/19/2022, 1:29 PMoutaTiME
05/19/2022, 1:31 PMFrancis Menguito
05/19/2022, 1:43 PMthdxr
05/19/2022, 1:48 PMthdxr
05/19/2022, 1:48 PMFrancis Menguito
05/19/2022, 1:52 PM.stack(StorageStack)
thdxr
05/19/2022, 1:53 PMFrancis Menguito
05/19/2022, 1:53 PMimport { StackContext, Table } from "@serverless-stack/resources";
export function StorageStack(ctx: StackContext) {
const appsTable = new Table(ctx.stack, "apps", {
fields: {
appId: "string",
name: "string",
},
primaryIndex: { partitionKey: "appId", sortKey: "name" },
});
// Main Table
const storesTable = new Table(ctx.stack, "stores", {
fields: {
storeId: "string",
url: "string",
defaultCurrency: "string",
storeName: "string",
},
primaryIndex: { partitionKey: "storeId", sortKey: "storeName" },
});
const customersTable = new Table(ctx.stack, "customers", {
fields: {
customerId: "string",
storeId: "string",
createdAt: "string",
},
primaryIndex: { partitionKey: "storeId", sortKey: "createdAt" },
});
// Pivot Table
const customersOrdersTable = new Table(ctx.stack, "customers_orders", {
fields: {
storeId: "string",
customerId: "string",
orderId: "string",
},
primaryIndex: { partitionKey: "storeId", sortKey: "customerId" },
});
const fulfillmentsTable = new Table(ctx.stack, "fulfillments", {
fields: {
fulfillmentId: "string",
storeId: "string",
orderId: "string",
},
primaryIndex: { partitionKey: "storeId", sortKey: "orderId" },
});
const ordersTable = new Table(ctx.stack, "orders", {
fields: {
orderId: "string",
storeId: "string",
appId: "string",
orderNumber: "string",
},
primaryIndex: { partitionKey: "storeId", sortKey: "orderNumber" },
});
const payoutsTable = new Table(ctx.stack, "payouts", {
fields: {
payoutId: "string",
storeId: "string",
status: "string",
},
primaryIndex: { partitionKey: "storeId", sortKey: "status" },
});
const productsTable = new Table(ctx.stack, "products", {
fields: {
productId: "string",
storeId: "string",
appId: "string",
name: "string",
},
primaryIndex: { partitionKey: "storeId", sortKey: "name" },
});
const productVariantsTable = new Table(ctx.stack, "productVariants", {
fields: {
variantId: "string",
storeId: "string",
title: "string",
},
primaryIndex: { partitionKey: "storeId", sortKey: "title" },
});
// Pivot Table
const productsProductVariantsTable = new Table(
ctx.stack,
"products_productVariants",
{
fields: {
storeId: "string",
productId: "string",
variantId: "string",
},
primaryIndex: { partitionKey: "storeId", sortKey: "productId" },
}
);
const transactionsTable = new Table(ctx.stack, "transactions", {
fields: {
transactionId: "string",
storeId: "string",
orderId: "string",
},
primaryIndex: { partitionKey: "storeId", sortKey: "orderId" },
});
return {
appsTable,
customersTable,
fulfillmentsTable,
ordersTable,
payoutsTable,
productsTable,
productVariantsTable,
storesTable,
transactionsTable,
customersOrdersTable,
productsProductVariantsTable,
};
}
Francis Menguito
05/19/2022, 1:54 PMordersTable
? Like add or remove fields?thdxr
05/19/2022, 1:56 PMFrancis Menguito
05/19/2022, 1:57 PMthdxr
05/19/2022, 1:57 PMFrancis Menguito
05/19/2022, 1:57 PMFrancis Menguito
05/19/2022, 1:57 PMthdxr
05/19/2022, 1:58 PMthdxr
05/19/2022, 1:58 PMFrancis Menguito
05/19/2022, 1:59 PMFrancis Menguito
05/19/2022, 1:59 PMthdxr
05/19/2022, 2:00 PMthdxr
05/19/2022, 2:00 PMFrancis Menguito
05/19/2022, 2:18 PMGeoffrey Dagley
05/19/2022, 7:29 PM