From 907500d0e57efa914991d4ff65ac7259fa54bbc1 Mon Sep 17 00:00:00 2001 From: TimoxGagarin Date: Wed, 24 Apr 2024 21:29:59 +0300 Subject: [PATCH] fix init --- .github/workflows/build.yml | 47 ++++++++++------------ init.sql | 78 ++++++++++++++++++++----------------- logs.log | 2 + 3 files changed, 64 insertions(+), 63 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4f86ae9..17dbf4f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,37 +1,30 @@ -name: SonarCloud +name: Render Spring POC hook example + on: push: branches: - main - pull_request: - types: [opened, synchronize, reopened] + workflow_dispatch: + jobs: - build: - name: Build and analyze + build-and-deploy: runs-on: ubuntu-latest + steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + - uses: actions/checkout@v2 + - name: Set up JDK 17 - uses: actions/setup-java@v3 - with: - java-version: 17 - distribution: "zulu" # Alternative distribution options are available. - - name: Cache SonarCloud packages - uses: actions/cache@v3 + uses: actions/setup-java@v2 with: - path: ~/.sonar/cache - key: ${{ runner.os }}-sonar - restore-keys: ${{ runner.os }}-sonar - - name: Cache Maven packages - uses: actions/cache@v3 + java-version: "17" + distribution: "adopt" + + - name: Build with Gradle + uses: gradle/gradle-build-action@v2 with: - path: ~/.m2 - key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} - restore-keys: ${{ runner.os }}-m2 - - name: Build and analyze // - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=fozboom_book-library-java + tasks: build + java-home: ${{ env.JAVA_HOME_17_X64 }} + publish-atoms: false + + - name: Trigger Render deploy hook + run: curl ${{secrets.RENDER_DEPLOY_HOOK}} diff --git a/init.sql b/init.sql index 8900594..9460456 100644 --- a/init.sql +++ b/init.sql @@ -1,41 +1,47 @@ -create table city ( - id bigint not null, - country varchar(255), - country_code varchar(255), - name varchar(255), - region varchar(255), - region_name varchar(255), - zip varchar(255), - primary key (id) +CREATE SEQUENCE city_sequence START 1 INCREMENT 1; +CREATE SEQUENCE ipinfo_sequence START 1 INCREMENT 1; +CREATE SEQUENCE position_sequence START 1 INCREMENT 1; +CREATE SEQUENCE provider_sequence START 1 INCREMENT 1; + +CREATE TABLE city ( + id BIGINT PRIMARY KEY DEFAULT nextval('city_sequence'), + country VARCHAR(255) NOT NULL, + country_code VARCHAR(2) NOT NULL, + region VARCHAR(255) NOT NULL, + region_name VARCHAR(255) NOT NULL, + name VARCHAR(255) NOT NULL, + zip VARCHAR(255) NOT NULL ); - -create table city_provider_relation ( - city_id bigint not null, - provider_id bigint not null, - primary key (city_id, provider_id) + +CREATE TABLE position ( + id BIGINT PRIMARY KEY DEFAULT nextval('position_sequence'), + latitude NUMERIC(10, 8) NOT NULL, + longitude NUMERIC(11, 8) NOT NULL ); - -create table ip_info ( - city_id bigint, - id bigint not null, - position_id bigint, - provider_id bigint, - ip varchar(255), - time_zone varchar(255), - primary key (id) + +CREATE TABLE provider ( + id BIGINT PRIMARY KEY DEFAULT nextval('provider_sequence'), + internet_service_provider VARCHAR(255) NOT NULL, + organisation VARCHAR(255) NOT NULL, + autonomous_system_name VARCHAR(255) NOT NULL ); - -create table position ( - latitude float(53), - longitude float(53), - id bigint not null, - primary key (id) + +CREATE TABLE city_provider_relation ( + provider_id BIGINT NOT NULL, + city_id BIGINT NOT NULL, + PRIMARY KEY (provider_id, city_id), + FOREIGN KEY (provider_id) REFERENCES provider(id), + FOREIGN KEY (city_id) REFERENCES city(id) ); - -create table provider ( - id bigint not null, - autonomous_system_name varchar(255), - internet_service_provider varchar(255), - organisation varchar(255), - primary key (id) + +CREATE TABLE ip_info ( + id BIGINT PRIMARY KEY DEFAULT nextval('ipinfo_sequence'), + city_id BIGINT NOT NULL, + position_id BIGINT NOT NULL, + time_zone VARCHAR(255) NOT NULL, + provider_id BIGINT NOT NULL, + ip VARCHAR(255) NOT NULL, + FOREIGN KEY (city_id) REFERENCES city(id), + FOREIGN KEY (position_id) REFERENCES position(id), + FOREIGN KEY (provider_id) REFERENCES provider(id) ); \ No newline at end of file diff --git a/logs.log b/logs.log index bb92d6c..cfc09e5 100644 --- a/logs.log +++ b/logs.log @@ -2,3 +2,5 @@ INFO: Log message апр. 24, 2024 7:33:58 PM com.ip_position.ipposition.logger.LoggerAspect INFO: Log message +апр. 24, 2024 9:26:22 PM com.ip_position.ipposition.logger.LoggerAspect +INFO: Log message