From d5596b59cb7a2e3336007fa372e5a7f2ccf61dff Mon Sep 17 00:00:00 2001 From: Piotr Biernat Date: Sat, 8 Nov 2025 19:24:12 +0100 Subject: [PATCH] Migrations - uuid fix --- .../basket-svc/0001_create_base_tables.up.sql | 2 ++ .../catalog-svc/0001_create_base_tables.up.sql | 8 +++++--- .../identity-svc/0001_create_base_tables.up.sql | 10 ++++++---- deploy/db_migrations/init/init.sql | 1 - .../order-svc/0001_create_base_tables.up.sql | 2 ++ .../pricing-svc/0001_create_base_tables.up.sql | 2 ++ 6 files changed, 17 insertions(+), 8 deletions(-) diff --git a/deploy/db_migrations/basket-svc/0001_create_base_tables.up.sql b/deploy/db_migrations/basket-svc/0001_create_base_tables.up.sql index 9786ace..87d8d3e 100644 --- a/deploy/db_migrations/basket-svc/0001_create_base_tables.up.sql +++ b/deploy/db_migrations/basket-svc/0001_create_base_tables.up.sql @@ -1,3 +1,5 @@ +CREATE EXTENSION IF NOT EXISTS "pgcrypto"; + CREATE TABLE IF NOT EXISTS basket.basket ( id uuid NOT NULL DEFAULT gen_random_uuid(), diff --git a/deploy/db_migrations/catalog-svc/0001_create_base_tables.up.sql b/deploy/db_migrations/catalog-svc/0001_create_base_tables.up.sql index 1a446e4..6b5e33c 100644 --- a/deploy/db_migrations/catalog-svc/0001_create_base_tables.up.sql +++ b/deploy/db_migrations/catalog-svc/0001_create_base_tables.up.sql @@ -1,11 +1,13 @@ +CREATE EXTENSION IF NOT EXISTS "pgcrypto"; + CREATE TABLE catalog.product ( - id uuid NOT NULL DEFAULT uuid_generate_v4(), + id uuid NOT NULL DEFAULT gen_random_uuid(), "name" character varying NOT NULL, slug character varying NOT NULL, price double precision NOT NULL, - created_at timestamp without time zone NOT NULL DEFAULT now(), - updated_at timestamp without time zone, + created_at timestamp with time zone NOT NULL DEFAULT now(), + updated_at timestamp with time zone, PRIMARY KEY (id) ); diff --git a/deploy/db_migrations/identity-svc/0001_create_base_tables.up.sql b/deploy/db_migrations/identity-svc/0001_create_base_tables.up.sql index 2ab4e7f..5dde11f 100644 --- a/deploy/db_migrations/identity-svc/0001_create_base_tables.up.sql +++ b/deploy/db_migrations/identity-svc/0001_create_base_tables.up.sql @@ -1,6 +1,8 @@ +CREATE EXTENSION IF NOT EXISTS "pgcrypto"; + CREATE TABLE IF NOT EXISTS identity.users ( - id uuid NOT NULL DEFAULT uuid_generate_v4(), + id uuid NOT NULL DEFAULT gen_random_uuid(), username character varying NOT NULL, "password" character varying NOT NULL, email character varying NOT NULL, @@ -13,7 +15,7 @@ CREATE TABLE IF NOT EXISTS identity.users CREATE TABLE IF NOT EXISTS identity.roles ( - id uuid NOT NULL DEFAULT uuid_generate_v4(), + id uuid NOT NULL DEFAULT gen_random_uuid(), name character varying(100) COLLATE pg_catalog."default" NOT NULL, display_name character varying(200) COLLATE pg_catalog."default" NOT NULL, created_at timestamp without time zone NOT NULL DEFAULT now(), @@ -23,7 +25,7 @@ CREATE TABLE IF NOT EXISTS identity.roles CREATE TABLE IF NOT EXISTS identity.users_roles ( - id uuid NOT NULL DEFAULT uuid_generate_v4(), + id uuid NOT NULL DEFAULT gen_random_uuid(), user_id uuid NOT NULL, role_id uuid NOT NULL, PRIMARY KEY (id), @@ -42,7 +44,7 @@ CREATE TABLE IF NOT EXISTS identity.users_roles CREATE TABLE identity.url_access ( - id uuid NOT NULL DEFAULT uuid_generate_v4(), + id uuid NOT NULL DEFAULT gen_random_uuid(), roles json NOT NULL, url character varying(255) NOT NULL, method character varying(10) NOT NULL, diff --git a/deploy/db_migrations/init/init.sql b/deploy/db_migrations/init/init.sql index 868dd64..d8160cd 100644 --- a/deploy/db_migrations/init/init.sql +++ b/deploy/db_migrations/init/init.sql @@ -4,7 +4,6 @@ CREATE DATABASE egommerce; GRANT ALL PRIVILEGES ON DATABASE egommerce TO egommerce; CREATE EXTENSION IF NOT EXISTS "pgcrypto"; -CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; CREATE SCHEMA "identity" AUTHORIZATION egommerce; CREATE SCHEMA catalog AUTHORIZATION egommerce; diff --git a/deploy/db_migrations/order-svc/0001_create_base_tables.up.sql b/deploy/db_migrations/order-svc/0001_create_base_tables.up.sql index 6598556..ea9d7f5 100644 --- a/deploy/db_migrations/order-svc/0001_create_base_tables.up.sql +++ b/deploy/db_migrations/order-svc/0001_create_base_tables.up.sql @@ -1,3 +1,5 @@ +CREATE EXTENSION IF NOT EXISTS "pgcrypto"; + CREATE TABLE IF NOT EXISTS "ordering"."order" ( id uuid NOT NULL DEFAULT gen_random_uuid(), diff --git a/deploy/db_migrations/pricing-svc/0001_create_base_tables.up.sql b/deploy/db_migrations/pricing-svc/0001_create_base_tables.up.sql index c1e7ce4..0933708 100644 --- a/deploy/db_migrations/pricing-svc/0001_create_base_tables.up.sql +++ b/deploy/db_migrations/pricing-svc/0001_create_base_tables.up.sql @@ -1,3 +1,5 @@ +CREATE EXTENSION IF NOT EXISTS "pgcrypto"; + CREATE TABLE IF NOT EXISTS pricing."price" ( id uuid NOT NULL DEFAULT gen_random_uuid()