Skip to content

feat: add automatic database schema initialization and readme#27

Merged
DenizAltunkapan merged 7 commits into
Vault-Web:mainfrom
matthewhou19:docs/readme
Jan 11, 2026
Merged

feat: add automatic database schema initialization and readme#27
DenizAltunkapan merged 7 commits into
Vault-Web:mainfrom
matthewhou19:docs/readme

Conversation

@matthewhou19

Copy link
Copy Markdown
Contributor

Summary

  • Add schema.sql for automatic table creation on startup, database tables (users, refresh_tokens) now auto-create on application startup. No manual database setup required for local development.
  • Configure Spring SQL initialization (mode: always)
  • Add docker-compose.yml for PostgreSQL setup
  • Update README with comprehensive setup guide and database documentation
  • Document automatic table creation feature and configuration

Linked issue

Closes #25

How to test

Notes / Risk

I use Docker to run the database, ensuring we can develop and test the repository independently.

- Add schema.sql for automatic table creation on startup
- Configure Spring SQL initialization (mode: always)
- Add docker-compose.yml for PostgreSQL setup
- Update README with comprehensive setup guide and database documentation
- Document automatic table creation feature and configuration

Database tables (users, refresh_tokens) now auto-create on application startup.
No manual database setup required for local development.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings January 6, 2026 22:09
@matthewhou19
matthewhou19 requested a review from DevEpso as a code owner January 6, 2026 22:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds automatic database schema initialization to simplify local development setup, eliminating the need for manual database configuration. It includes Docker Compose for PostgreSQL and comprehensive README documentation.

Key Changes:

  • Automatic database table creation via Spring SQL initialization with schema.sql
  • Docker Compose configuration for local PostgreSQL instance
  • Comprehensive README with setup instructions, API documentation, and configuration examples

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
docker-compose.yml Adds PostgreSQL 16 Alpine container configuration with volume persistence for local development
apigateway/src/main/resources/schema.sql Defines database schema with users and refresh_tokens tables, including indexes for performance
apigateway/src/main/resources/application.yaml Configures Spring SQL initialization to run schema.sql automatically on startup
README.md Adds comprehensive documentation covering setup, API endpoints, configuration, database schema, and project structure

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md
Comment thread docker-compose.yml Outdated
Comment thread apigateway/src/main/resources/application.yaml Outdated
Comment thread apigateway/src/main/resources/schema.sql Outdated
matthewhou19 and others added 3 commits January 6, 2026 14:51
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docker-compose.yml
Comment thread README.md Outdated
Comment thread README.md Outdated
…ntion

- Update database name from 'mydatabase' to 'auth_gateway_db' across all configuration files
- Rename refresh token endpoint from '/auth/switch-jwt/{token}' to '/auth/refresh/{token}' for RESTful naming
- Update application.yaml with consistent database URL and public URL patterns
- Enhance README documentation with production-ready SQL initialization guidance
- Add recommendation for Flyway/Liquibase for production database migrations

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread apigateway/src/main/resources/application.yaml
Comment thread README.md
Comment thread README.md
Comment thread docker-compose.yml Outdated
matthewhou19 and others added 2 commits January 7, 2026 15:43
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…yAuthController.java

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@matthewhou19

Copy link
Copy Markdown
Contributor Author

Hey @DenizAltunkapan @DevEpso! 👋

Hope you're doing well! I've updated this PR to address the review feedback and would love to get your thoughts when you have a chance.

Question I'd love your input on:

For the spring.sql.init.mode config, I currently have it set to never (following production best practices), but I'm wondering if we should use always for easier local development? Here are the trade-offs I'm thinking about:

Option 1: mode: always (easier for devs)

  • ✅ Tables auto-create on startup
  • ✅ New devs can just run docker compose up && mvn spring-boot:run
  • ✅ No manual DB setup needed
  • ⚠️ Not ideal for production (should use Flyway/Liquibase)

Option 2: mode: never (current setting)

  • ✅ Production-safe
  • ⚠️ Requires manual table creation for local dev
  • ⚠️ Extra setup step for new contributors

My suggestion: What do you think about using always for now to keep dev setup simple, and later we can split configs with Spring profiles (dev vs prod)? Or do you prefer a different approach?

Would really appreciate your thoughts on this! Thanks for taking the time to review 😊

@DenizAltunkapan DenizAltunkapan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks! @matthewhou19

@DenizAltunkapan
DenizAltunkapan merged commit d88a8d0 into Vault-Web:main Jan 11, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add comprehensive README with setup instructions

3 participants