This commit is contained in:
PB
2025-11-23 21:49:18 +01:00
parent d5596b59cb
commit 68d0f3d48d
18 changed files with 268 additions and 54 deletions

View File

@@ -1,5 +1,7 @@
CREATE EXTENSION IF NOT EXISTS "pgcrypto";
CREATE SCHEMA "basket" AUTHORIZATION egommerce;
CREATE TABLE IF NOT EXISTS basket.basket
(
id uuid NOT NULL DEFAULT gen_random_uuid(),

View File

@@ -1,5 +1,7 @@
CREATE EXTENSION IF NOT EXISTS "pgcrypto";
CREATE SCHEMA "catalog" AUTHORIZATION egommerce;
CREATE TABLE catalog.product
(
id uuid NOT NULL DEFAULT gen_random_uuid(),

View File

@@ -0,0 +1 @@
DROP TABLE IF EXISTS config.settings;

View File

@@ -0,0 +1,15 @@
CREATE EXTENSION IF NOT EXISTS "pgcrypto";
CREATE SCHEMA "config" AUTHORIZATION egommerce;
CREATE TABLE IF NOT EXISTS config.settings
(
id uuid NOT NULL DEFAULT gen_random_uuid(),
"name" character varying NOT NULL,
"value" character varying NOT NULL,
PRIMARY KEY (id),
UNIQUE (name)
);
ALTER TABLE IF EXISTS config.settings OWNER to egommerce;

View File

@@ -1,5 +1,7 @@
CREATE EXTENSION IF NOT EXISTS "pgcrypto";
CREATE SCHEMA "identity" AUTHORIZATION egommerce;
CREATE TABLE IF NOT EXISTS identity.users
(
id uuid NOT NULL DEFAULT gen_random_uuid(),

View File

@@ -4,7 +4,3 @@ CREATE DATABASE egommerce;
GRANT ALL PRIVILEGES ON DATABASE egommerce TO egommerce;
CREATE EXTENSION IF NOT EXISTS "pgcrypto";
CREATE SCHEMA "identity" AUTHORIZATION egommerce;
CREATE SCHEMA catalog AUTHORIZATION egommerce;
CREATE SCHEMA basket AUTHORIZATION egommerce;

View File

@@ -1,6 +1,8 @@
CREATE EXTENSION IF NOT EXISTS "pgcrypto";
CREATE TABLE IF NOT EXISTS "ordering"."order"
CREATE SCHEMA "order" AUTHORIZATION egommerce;
CREATE TABLE IF NOT EXISTS "order"."order"
(
id uuid NOT NULL DEFAULT gen_random_uuid(),
"state" character varying NOT NULL DEFAULT 'new',
@@ -9,7 +11,7 @@ CREATE TABLE IF NOT EXISTS "ordering"."order"
PRIMARY KEY (id)
);
CREATE TABLE IF NOT EXISTS "ordering".order_item
CREATE TABLE IF NOT EXISTS "order".order_item
(
id uuid NOT NULL DEFAULT gen_random_uuid(),
order_id uuid NOT NULL,
@@ -21,12 +23,12 @@ CREATE TABLE IF NOT EXISTS "ordering".order_item
PRIMARY KEY (id)
);
ALTER TABLE IF EXISTS "ordering".order_item
ALTER TABLE IF EXISTS "order".order_item
ADD CONSTRAINT order_item_order_fkey FOREIGN KEY (order_id)
REFERENCES "ordering"."order" (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
NOT VALID;
ALTER TABLE IF EXISTS "ordering"."order" OWNER to egommerce;
ALTER TABLE IF EXISTS "ordering".order_item OWNER to egommerce;
ALTER TABLE IF EXISTS "order"."order" OWNER to egommerce;
ALTER TABLE IF EXISTS "order".order_item OWNER to egommerce;