Files
database/migrations/archive/000.462.sql
T
Rikard BartholfandGitHub ddcbd0afb0 Archive old migrations (#426)
* Archive old migrations

* Fix invalid placement of migrations
2024-10-17 11:19:12 +02:00

21 lines
922 B
SQL

-- Store carts in database
DROP TABLE IF EXISTS cart_cookies, cart_users, cart_sessions;
CREATE TABLE cart_sessions (
id INTEGER GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
market_locale_id INTEGER NOT NULL REFERENCES market_locales (id),
public_id TEXT NOT NULL,
active BOOLEAN NOT NULL DEFAULT TRUE,
content TEXT,
revision INTEGER NOT NULL DEFAULT 0,
inactive_reason TEXT,
created timestamp with time zone NOT NULL DEFAULT now(),
last_modified timestamp with time zone NOT NULL DEFAULT now()
);
CREATE UNIQUE INDEX ON cart_sessions (public_id);
-- last_modified reflects the last user interaction/modification of the cart.
-- It it not auto updated via trigger, to avoid having it update on non-user interactions, like us expiring the cart.
COMMENT ON COLUMN cart_sessions.last_modified IS 'Last update of cart contents';