move repositories to separate db package

replace jacoco with kover
This commit is contained in:
Savosin Denis
2025-03-28 14:38:57 +07:00
parent 4f9ad14767
commit d7c051746d
37 changed files with 603 additions and 34 deletions

View File

@@ -1,4 +0,0 @@
insert into product (guid, name, description, price, created_at) values
(gen_random_uuid(), 'salt', 'simple salt', 1200, now()),
(gen_random_uuid(), 'pepper', 'black pepper', 2099, now()),
(gen_random_uuid(), 'sugar', 'sweet sugar', 3129, now());

View File

@@ -1,4 +0,0 @@
insert into city (guid, name, created_at) values
(gen_random_uuid(), 'Kemerovo', now()),
(gen_random_uuid(), 'Novosibirsk', now()),
(gen_random_uuid(), 'Krasnoyarsk', now());

View File

@@ -1,9 +0,0 @@
create table product (
id bigserial primary key,
guid uuid not null,
name varchar(255) not null,
description text,
price bigint not null,
created_at timestamptz not null,
updated_at timestamptz
)

View File

@@ -1 +0,0 @@
alter table product add deleted_at timestamptz default null;

View File

@@ -1 +0,0 @@
CREATE UNIQUE INDEX product_guid_idx ON product (guid);

View File

@@ -1,10 +0,0 @@
create table city (
id bigserial primary key,
guid uuid not null,
name varchar(255) not null,
created_at timestamptz not null,
updated_at timestamptz,
deleted_at timestamptz
);
create unique index city_guid_idx ON city (guid);

View File

@@ -1,14 +0,0 @@
create table customer (
id bigserial primary key,
guid uuid not null,
name varchar(255) not null,
city_id bigint,
created_at timestamptz not null,
updated_at timestamptz,
CONSTRAINT customer_city_foreign
FOREIGN KEY(city_id)
REFERENCES city(id)
ON DELETE SET NULL
);
create unique index customer_guid_idx ON customer (guid);

View File

@@ -1,14 +0,0 @@
create table "order" (
id bigserial primary key,
guid uuid not null,
customer_id bigint not null,
delivered_at timestamptz,
created_at timestamptz not null,
updated_at timestamptz,
CONSTRAINT order_customer_foreign
FOREIGN KEY(customer_id)
REFERENCES customer(id)
ON DELETE CASCADE
);
create unique index order_guid_idx ON "order" (guid);

View File

@@ -1,15 +0,0 @@
create table order_product (
guid uuid primary key,
order_id bigint not null,
product_id bigint not null,
created_at timestamptz not null,
updated_at timestamptz,
CONSTRAINT order_product_order_foreign
FOREIGN KEY(order_id)
REFERENCES "order"(id)
ON DELETE CASCADE,
CONSTRAINT order_product_product_foreign
FOREIGN KEY(product_id)
REFERENCES product(id)
ON DELETE CASCADE
);