From ba5f30be9f69d18cbb3ffe2d00ba9cf287b77f43 Mon Sep 17 00:00:00 2001 From: Matheus Date: Tue, 21 Oct 2025 00:11:39 -0300 Subject: fix:criação automática de tabelas MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- compose.yaml | 17 ++++++++++------- database/create_table.sql | 6 ------ database/init_scripts/create_table.sql | 6 ++++++ 3 files changed, 16 insertions(+), 13 deletions(-) delete mode 100644 database/create_table.sql create mode 100644 database/init_scripts/create_table.sql diff --git a/compose.yaml b/compose.yaml index 21f3cea..c5102e4 100644 --- a/compose.yaml +++ b/compose.yaml @@ -29,21 +29,18 @@ services: - mosquitto depends_on: - mosquitto - - postgres: image: postgres:13 container_name: postgres - ports: - - 5432:5432 + networks: + - database environment: POSTGRES_PASSWORD: public POSTGRES_USER: root POSTGRES_DB: control_station volumes: - - $PWD/database/create-table.sql:/docker-entrypoint-initdb.d/init.sql - - + - ${PWD}/database/init_scripts:/docker-entrypoint-initdb.d + - db_data:/var/lib/postgresql/data pgadmin: image: dpage/pgadmin4 container_name: pgadmin @@ -52,7 +49,13 @@ services: - PGADMIN_DEFAULT_PASSWORD=admin ports: - "5050:80" + networks: + - database depends_on: - postgres networks: mosquitto: + database: + +volumes: + db_data: diff --git a/database/create_table.sql b/database/create_table.sql deleted file mode 100644 index 8ee801a..0000000 --- a/database/create_table.sql +++ /dev/null @@ -1,6 +0,0 @@ -create table if not exists climameasures ( - stationname varchar(255), - measurevalue int null, - unit float null, - currenttime timestamp default current_timestamp -); \ No newline at end of file diff --git a/database/init_scripts/create_table.sql b/database/init_scripts/create_table.sql new file mode 100644 index 0000000..8ee801a --- /dev/null +++ b/database/init_scripts/create_table.sql @@ -0,0 +1,6 @@ +create table if not exists climameasures ( + stationname varchar(255), + measurevalue int null, + unit float null, + currenttime timestamp default current_timestamp +); \ No newline at end of file -- cgit v1.2.3