Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api
Submodule api updated 1 files
+130 −60 lib/services/events.ts
2 changes: 2 additions & 0 deletions schema/migrate-v1postgres.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ async function migrateProducts() {
name: p.name, // VARCHAR(128) NOT NULL,
price: p.price, // NUMERIC NOT NULL,
promo: Boolean(p.promo), // BOOL,
available_from: p.availableFrom ? new Date(p.availableFrom).toISOString() : null, // TIMESTAMP,
available_until: p.availableUntil ? new Date(p.availableUntil).toISOString() : null, // TIMESTAMP,
created: p.created, // TIMESTAMP DEFAULT NOW(),
// Defaulting to created for migration only
updated: p.created, // TIMESTAMP DEFAULT NOW(),
Expand Down
4 changes: 4 additions & 0 deletions schema/v1schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ CREATE TABLE products (
price NUMERIC NOT NULL,
promo BOOL NOT NULL,
max_quantity INT,
available_from TIMESTAMP,
available_until TIMESTAMP,
target_product_id uuid,
created TIMESTAMP NOT NULL DEFAULT NOW(),
updated TIMESTAMP NOT NULL DEFAULT NOW(),
Expand Down Expand Up @@ -124,6 +126,8 @@ CREATE TABLE products (
)
);
CREATE INDEX ON products (event_id);
CREATE INDEX ON products (available_from);
CREATE INDEX ON products (available_until);


CREATE TYPE promo_status AS ENUM ('active', 'claimed', 'disabled');
Expand Down