mirror of
https://github.com/Dannecron/spring-boot-demo.git
synced 2025-12-26 00:32:34 +03:00
move repositories to separate db package
replace jacoco with kover
This commit is contained in:
@@ -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());
|
||||
@@ -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());
|
||||
@@ -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
|
||||
)
|
||||
@@ -1 +0,0 @@
|
||||
alter table product add deleted_at timestamptz default null;
|
||||
@@ -1 +0,0 @@
|
||||
CREATE UNIQUE INDEX product_guid_idx ON product (guid);
|
||||
@@ -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);
|
||||
@@ -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);
|
||||
@@ -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);
|
||||
@@ -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
|
||||
);
|
||||
Reference in New Issue
Block a user