From 74b11ffc3545a0382c5e09dd441a69d827430acf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zombori=20P=C3=A9ter?= Date: Wed, 8 Oct 2025 18:51:02 +0200 Subject: [PATCH] =?UTF-8?q?Adatb=C3=A1zis=20S=C3=A9ma?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Kitaláltam egy egyszerű adatbázis sémát, és az init sql-be feltöltöttem --- .gitignore | 15 +-------------- docker-compose.yml | 18 ++++++++++++++++++ init/01_init.sql | 15 +++++++++++++++ 3 files changed, 34 insertions(+), 14 deletions(-) create mode 100644 docker-compose.yml create mode 100644 init/01_init.sql diff --git a/.gitignore b/.gitignore index 6709d9c..17186c7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,14 +1 @@ -# ---> VirtualEnv -# Virtualenv -# http://iamzed.com/2009/05/07/a-primer-on-virtualenv/ -.Python -[Bb]in -[Ii]nclude -[Ll]ib -[Ll]ib64 -[Ll]ocal -[Ss]cripts -pyvenv.cfg -.venv -pip-selfcheck.json - +db_data diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..884e7ee --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,18 @@ +services: + mariadb: + image: mariadb:11 + container_name: telefonkonyv-db + restart: always + environment: + MARIADB_ROOT_PASSWORD: rootpw + MARIADB_DATABASE: telefonkonyv + MARIADB_USER: appuser + MARIADB_PASSWORD: apppass + ports: + - "3306:3306" + volumes: + - ./db_data:/var/lib/mysql + - ./init:/docker-entrypoint-initdb.d + +volumes: + db_data: diff --git a/init/01_init.sql b/init/01_init.sql new file mode 100644 index 0000000..ad54be8 --- /dev/null +++ b/init/01_init.sql @@ -0,0 +1,15 @@ +CREATE TABLE IF NOT EXISTS users ( + id INT AUTO_INCREMENT PRIMARY KEY, + uname VARCHAR(255) NOT NULL, + pw VARCHAR(255) NOT NULL, + admin BOOLEAN DEFAULT FALSE, + note TEXT +); + +CREATE TABLE IF NOT EXISTS contacts ( + id INT AUTO_INCREMENT PRIMARY KEY, + name VARCHAR(255) NOT NULL, + phone VARCHAR(50) NOT NULL, + address VARCHAR(255), + note TEXT +);