Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revised Tables for Liquibase and Swagger Config #23

Merged
merged 1 commit into from
Mar 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/main/java/com/ays/backend/config/OpenApiConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
@Configuration
public class OpenApiConfig {

@Value("${application.title}")
private String title;

@Value("${application.licenseName}")
private String licenseName;

@Bean
public OpenAPI customOpenAPI(@Value("${application.description}") String description,
@Value("${application.version}") String version) {
Expand Down
8 changes: 5 additions & 3 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
spring:
liquibase:
enabled: false
change-log=classpath: /db/changelog/db.changelog-master.yaml
enabled: true
changeLog: "classpath:db/changelog/db.changelog-master.yaml"
datasource:
url: jdbc:mysql://localhost:3306/afetdb?createDatabaseIfNotExist=true
username: root
Expand All @@ -18,5 +18,7 @@ springdoc:
path: /swagger-ui.html

application:
description: Afet Yönetim Sistemi Tanımı (AYS)
description: Afet Yönetim Sistemi Tanimi (AYS)
version: 1.0
title: "AYS"
licenseName: AYS Licence
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.10.xsd">

<changeSet id="1-create-organization-table" author="noyan">
<createTable tableName="organization">
<column name="id" type="bigint" autoIncrement="true">
<constraints primaryKey="true" nullable="false" />
</column>
<column name="created_at" type="timestamp" defaultValueDate="CURRENT_TIMESTAMP"/>
<column name="created_user" type="int">
<constraints nullable="false"/>
</column>
<column name="updated_at" type="timestamp" defaultValueDate="CURRENT_TIMESTAMP"/>
<column name="updated_user" type="int">
<constraints nullable="false"/>
</column>
<column name="name" type="varchar(255)">
<constraints nullable="false"/>
</column>
</createTable>
</changeSet>


</databaseChangeLog>
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.10.xsd">

<changeSet id="2-create-user-table" author="noyan">
<createTable tableName="user">
<column name="id" type="bigint" autoIncrement="true">
<constraints primaryKey="true" nullable="false" />
</column>
<column name="created_at" type="timestamp" defaultValueDate="CURRENT_TIMESTAMP" />
<column name="created_user" type="int">
<constraints nullable="false"/>
</column>
<column name="updated_at" type="timestamp" defaultValueDate="CURRENT_TIMESTAMP" />
<column name="updated_user" type="int">
<constraints nullable="false"/>
</column>
<column name="country_code" type="int">
<constraints nullable="false"/>
</column>
<column name="email" type="varchar(255)" />
<column name="first_name" type="varchar(255)">
<constraints nullable="false"/>
</column>
<column name="last_login_date" type="timestamp" defaultValueDate="CURRENT_TIMESTAMP" />
<column name="last_name" type="varchar(255)">
<constraints nullable="false"/>
</column>
<column name="line_number" type="int">
<constraints nullable="false"/>
</column>
<column name="password" type="varchar(255)">
<constraints nullable="false"/>
</column>
<column name="status" type="smallint">
<constraints nullable="false"/>
</column>
<column name="user_role" type="smallint" />
<column name="username" type="varchar(255)">
<constraints nullable="false"/>
</column>
<column name="organization_id" type="bigint" />

</createTable>

<addUniqueConstraint
constraintName="UniqueMobileNumber"
tableName="user" columnNames="country_code,line_number">
</addUniqueConstraint>

<addUniqueConstraint
constraintName="UK_sb8bbouer5wak8vyiiy4pf2bx"
tableName="user" columnNames="username">
</addUniqueConstraint>

<addUniqueConstraint
constraintName="UK_ob8kqyqqgmefl0aco34akdtpe"
tableName="user" columnNames="email">
</addUniqueConstraint>

<addForeignKeyConstraint baseColumnNames="organization_id"
baseTableName="user"
constraintName="FKi3ynrf4qjomj2hdjx7ssa3mlh"
referencedColumnNames="id"
referencedTableName="organization"
/>

</changeSet>

</databaseChangeLog>
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.10.xsd">

<changeSet id="3-create-user-type-table" author="author_name" >
<createTable tableName="user_types">
<column name="id" type="bigint" autoIncrement="true">
<constraints primaryKey="true" nullable="false"/>
</column>
<column name="created_at" type="timestamp" defaultValueDate="CURRENT_TIMESTAMP"/>
<column name="created_user" type="int" defaultValueNumeric="0" >
<constraints nullable="false" />
</column>
<column name="updated_at" type="timestamp" defaultValueDate="CURRENT_TIMESTAMP"/>
<column name="updated_user" type="int" defaultValueNumeric="0" >
<constraints nullable="false" />
</column>
<column name="description" type="smallint">
<constraints nullable="false" />
</column>

</createTable>

<addUniqueConstraint
constraintName="UK_eqcd1ffvf68b9hlgjv52xmyxx"
tableName="user_types" columnNames="description">
</addUniqueConstraint>

</changeSet>

</databaseChangeLog>