How to deploy database to Azure?
- From your Azure portal, click ‘create a resource’.
- Search for ‘Azure Database for PostgreSQL’. Then hit ‘create’.
- Fill out project details, then submit.
- On the left bar, click ‘Databases’, then add one.
- Go to your local repository, and add postgres dependency to pom.
- From ‘application.yml’, add configuration to align to database credentials.
debug: true
spring:
sql:
init:
platform: postgresql
mode: never
output:
ansi:
enabled: always
datasource:
url: jdbc:postgresql://[your-app-name].postgres.database.azure.com:5432/[name-of-your-database]
username: [add-user]
password: [add-password]
jpa:
show-sql: true
defer-datasource-initialization: true
hibernate.ddl-auto: update
logging:
level:
org:
springframework:
boot:
autoconfigure: ERROR
Note: Copy the url from Azure, and add the name of your database from the last '/'.
- Launch DBeaber. Click ‘postgres’ > ‘Databases’ > [name-of-database] > ‘Schemas’ > ‘public’ > ‘Tables’
To add data to table for testing connection with backend:
- Click postgres > [created-database-name] > Schemas > public > Tables > [name-of-entity-in-backend].
- Write click on [entity-name] > Generate SQL > [pick-from-options].