From d209afb032c6eb5013a054d8e41c1f06ad8a73f1 Mon Sep 17 00:00:00 2001 From: truettwo Date: Thu, 20 Feb 2025 15:35:08 +0300 Subject: [PATCH] lb --- pom.xml | 27 ++++----- src/main/resources/META-INF/MANIFEST.MF | 3 + src/main/resources/application.yml | 33 +++-------- src/main/resources/data.sql | 56 ------------------- .../db/changelog/db.changelog-master.xml | 9 +++ 5 files changed, 35 insertions(+), 93 deletions(-) create mode 100644 src/main/resources/META-INF/MANIFEST.MF delete mode 100644 src/main/resources/data.sql create mode 100644 src/main/resources/db/changelog/db.changelog-master.xml diff --git a/pom.xml b/pom.xml index 32b099f..950ba18 100644 --- a/pom.xml +++ b/pom.xml @@ -57,20 +57,21 @@ spring-boot-starter-security - io.springfox - springfox-boot-starter - 3.0.0 - - - io.springfox - springfox-boot-starter - 3.0.0 - - - io.springfox - springfox-swagger-ui - 3.0.0 + org.liquibase + liquibase-core + + + + + + org.springframework.boot + spring-boot-maven-plugin + 2.3.0.RELEASE + + + + \ No newline at end of file diff --git a/src/main/resources/META-INF/MANIFEST.MF b/src/main/resources/META-INF/MANIFEST.MF new file mode 100644 index 0000000..929f41e --- /dev/null +++ b/src/main/resources/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Main-Class: com.example.nto.App + diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index c6bfd72..ae950db 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,28 +1,13 @@ spring: - datasource: - url: jdbc:h2:mem:testdb + url: jdbc:h2:mem:testdb # Укажи нужную базу (например, PostgreSQL) + username: sa + password: + driver-class-name: org.h2.Driver - h2: - console: - #enabled: false - enabled: true + liquibase: + change-log: classpath:/db/changelog/db.changelog-1.0.xml - jpa: - #generate-ddl: false - generate-ddl: true - - hibernate: - #ddl-auto: none - ddl-auto: create-drop - - # Показываем запросы - show-sql: true - - # Своевременный запуск data.sql - defer-datasource-initialization: true - - spring-doc: - swagger-ui: - path: /swagger-ui.html - operationsSorter: method \ No newline at end of file + sql: + init: + mode:never \ No newline at end of file diff --git a/src/main/resources/data.sql b/src/main/resources/data.sql deleted file mode 100644 index 4ef9c05..0000000 --- a/src/main/resources/data.sql +++ /dev/null @@ -1,56 +0,0 @@ --- Создание таблицы employee -CREATE TABLE IF NOT EXISTS employee ( - id INT PRIMARY KEY AUTO_INCREMENT, - login VARCHAR(255) UNIQUE NOT NULL, - name VARCHAR(255) NOT NULL, - photo VARCHAR(255), - position VARCHAR(255), - last_visit TIMESTAMP, - password VARCHAR(255) NOT NULL, -- Зашифрованный пароль - role VARCHAR(50) NOT NULL, - status VARCHAR(20) DEFAULT 'works', -- Новый статус - last_entry_code BIGINT, -- Код последнего входа - entry_method VARCHAR(50) -- Метод входа (например, QR) -); - --- Вставка данных в таблицу employee -INSERT INTO employee (id, login, name, photo, position, last_visit, password, role, status, last_entry_code, entry_method) -VALUES - (1, 'pivanov', 'Иванов Петр Федорович', - 'https://funnyducks.ru/upload/iblock/0cd/0cdeb7ec3ed6fddda0f90fccee05557d.jpg', - 'Разработчик', '2024-02-12T08:30', - '$2a$10$LRykcZHYR0tb72biv9aqp./icK7ReK57gRFDd74kiF02ZoZqQtnEm', - 'ADMIN', 'works', 1234567890123456789, 'QR'), - - (2, 'ipetrov', 'Петров Иван Константинович', - 'https://funnyducks.ru/upload/iblock/0cd/0cdeb7ec3ed6fddda0f90fccee05557d.jpg', - 'Аналитик', '2024-02-13T08:35', - '$2a$10$rscyLIftEqucmDbSzBHZbO5DUOyICzkYXzQ4stJfbSN.Ao9R4kfQe', - 'USER', 'works', NULL, NULL), - - (3, 'asemenov', 'Семенов Анатолий Анатольевич', - 'https://funnyducks.ru/upload/iblock/0cd/0cdeb7ec3ed6fddda0f90fccee05557d.jpg', - 'Разработчик', '2024-02-13T08:31', - '$2a$10$o/g9lV7iDi.WhwztohTcfuIEhHHWUo5xlR0Vvdy2xaaI3RNwfbqzO', - 'USER', 'works', NULL, NULL), - - (4, 'afedorov', 'Федоров Александр Сергеевич', - 'https://funnyducks.ru/upload/iblock/0cd/0cdeb7ec3ed6fddda0f90fccee05557d.jpg', - 'Тестировщик', '2024-02-12T08:36', - '$2a$10$s33LR8PuMLQJQY85.zusceJVJLUn8mwEEwAsAUzQIaiwnjeKjt.km', - 'USER', 'works', NULL, NULL); - --- Создание таблицы code -CREATE TABLE IF NOT EXISTS code ( - value BIGINT PRIMARY KEY, - employee_id INT, - FOREIGN KEY (employee_id) REFERENCES employee(id) ON DELETE CASCADE -); - --- Вставка данных в таблицу code -INSERT INTO code (value, employee_id) VALUES - (1234567890123456789, 1), - (9223372036854775807, 2), - (1122334455667788990, 3), - (998877665544332211, 4), - (5566778899001122334, 1); \ No newline at end of file diff --git a/src/main/resources/db/changelog/db.changelog-master.xml b/src/main/resources/db/changelog/db.changelog-master.xml new file mode 100644 index 0000000..882fcdd --- /dev/null +++ b/src/main/resources/db/changelog/db.changelog-master.xml @@ -0,0 +1,9 @@ + + + + + \ No newline at end of file