From 7a1fffe0e3e4250553da7d233d84136aafacac0e Mon Sep 17 00:00:00 2001 From: CaioCesarRocha Date: Wed, 5 May 2021 21:08:04 -0300 Subject: [PATCH] First homolog --- backend/create.sql | 6 ++++++ backend/src/main/resources/application-dev.properties | 11 +++++++++++ .../src/main/resources/application-prod.properties | 1 + backend/src/main/resources/application.properties | 5 +++-- backend/system.properties | 1 + 5 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 backend/create.sql create mode 100644 backend/src/main/resources/application-dev.properties create mode 100644 backend/src/main/resources/application-prod.properties create mode 100644 backend/system.properties diff --git a/backend/create.sql b/backend/create.sql new file mode 100644 index 0000000..87ddab1 --- /dev/null +++ b/backend/create.sql @@ -0,0 +1,6 @@ +create table tb_sales (id int8 generated by default as identity, amount float8, date date, deals int4, visited int4, seller_id int8, primary key (id)); +create table tb_sellers (id int8 generated by default as identity, name varchar(255), primary key (id)); +alter table if exists tb_sales add constraint FKp0nn0oixeiw2fq3jivj6vnsu foreign key (seller_id) references tb_sellers; +create table tb_sales (id int8 generated by default as identity, amount float8, date date, deals int4, visited int4, seller_id int8, primary key (id)); +create table tb_sellers (id int8 generated by default as identity, name varchar(255), primary key (id)); +alter table if exists tb_sales add constraint FKp0nn0oixeiw2fq3jivj6vnsu foreign key (seller_id) references tb_sellers; diff --git a/backend/src/main/resources/application-dev.properties b/backend/src/main/resources/application-dev.properties new file mode 100644 index 0000000..5ab694a --- /dev/null +++ b/backend/src/main/resources/application-dev.properties @@ -0,0 +1,11 @@ +#spring.jpa.properties.javax.persistence.schema-generation.create-source=metadata +#spring.jpa.properties.javax.persistence.schema-generation.scripts.action=create +#spring.jpa.properties.javax.persistence.schema-generation.scripts.create-target=create.sql +#spring.jpa.properties.hibernate.hbm2ddl.delimiter=; + +spring.datasource.url=jdbc:postgresql://localhost:5432/dsvendas +spring.datasource.username=postgres +spring.datasource.password=root + +spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true +spring.jpa.hibernate.ddl-auto=none diff --git a/backend/src/main/resources/application-prod.properties b/backend/src/main/resources/application-prod.properties new file mode 100644 index 0000000..630f526 --- /dev/null +++ b/backend/src/main/resources/application-prod.properties @@ -0,0 +1 @@ +spring.datasource.url=${DATABASE_URL} diff --git a/backend/src/main/resources/application.properties b/backend/src/main/resources/application.properties index cc52da4..7882ee3 100644 --- a/backend/src/main/resources/application.properties +++ b/backend/src/main/resources/application.properties @@ -1,2 +1,3 @@ -spring.jpa.open-in-view=false -spring.profiles.active=test \ No newline at end of file +spring.profiles.active=${APP_PROFILE:test} + +spring.jpa.open-in-view=false \ No newline at end of file diff --git a/backend/system.properties b/backend/system.properties new file mode 100644 index 0000000..180a273 --- /dev/null +++ b/backend/system.properties @@ -0,0 +1 @@ +java.runtime.version=11 \ No newline at end of file