Skip to content
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,10 @@ CodeForge’s goal is to provide a *simpler, clarity-first alternative* to platf
- Lightweight CSS (“CodeForge UI”) without a large framework

- ### Database
- MySQL (local/dev tests and prod)
- PostgreSQL (Neon for production, local for dev/tests)
- Test DB reset via `DbReset` + `cleandb.sql`
- Seed data managed in `src/test/resources/cleandb.sql` (predictable schema)
- **AWS RDS** — Cloud-hosted DB for deployment
- **Neon (Postgres)** — Cloud-hosted serverless DB for deployment
Comment on lines +131 to +134
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

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

The README still contains multiple references to MySQL that need to be updated to PostgreSQL, including:

  • "Tests use a local MySQL test database" (line 272)
  • "Create a local MySQL test database" section heading (line 274)
  • "Ensure MySQL is running locally" (line 279)
  • Example connection properties showing MySQL driver and dialect (lines 293-297)

These sections should be updated to reflect the PostgreSQL migration.

Copilot uses AI. Check for mistakes.

- ### Authentication & Security
- Amazon Cognito Hosted UI (servlet-based flow)
Expand Down
121 changes: 56 additions & 65 deletions docs/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
This project runs as a WAR on Tomcat 9 (Jakarta Servlet API). The persistence layer uses Hibernate directly (no Spring). For MVP, schema is managed by Hibernate auto‑DDL; Flyway is a post‑MVP task.

## Environments
- Dev/Test: H2 in‑memory DB via `src/main/resources/hibernate.cfg.xml`
- Prod (Week 8): AWS RDS (PostgreSQL or MySQL)
- Dev/Test: PostgreSQL (local or Docker)
- Prod: Neon (serverless PostgreSQL)

## Required runtime configuration
- Cognito secret: provided by environment or JVM property
Expand All @@ -18,23 +18,18 @@ This project runs as a WAR on Tomcat 9 (Jakarta Servlet API). The persistence la
### Dev/Test (default)
- `src/main/resources/hibernate.cfg.xml` points to H2 and sets `hbm2ddl.auto=update`.
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

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

This documentation still mentions "H2 in-memory DB" for Dev/Test, but the changes migrate to PostgreSQL for all environments. Update this to reflect the new PostgreSQL-based setup for local development and testing.

Suggested change
- `src/main/resources/hibernate.cfg.xml` points to H2 and sets `hbm2ddl.auto=update`.
- `src/main/resources/hibernate.cfg.xml` is configured for a local PostgreSQL instance (or Docker) and sets `hbm2ddl.auto=update`.

Copilot uses AI. Check for mistakes.

### Production (RDS)
Use either approach:
1) Tomcat JNDI DataSource (recommended)
- Define a JNDI resource in Tomcat `conf/context.xml` or the webapp context `META-INF/context.xml`:
```xml
<Resource name="jdbc/codeforge" auth="Container"
type="javax.sql.DataSource" maxTotal="20" maxIdle="5"
username="db_user" password="db_pass"
driverClassName="org.postgresql.Driver"
url="jdbc:postgresql://host:5432/dbname"/>
```
- Update your Hibernate configuration to use JNDI lookup (optional enhancement), or provide a prod `hibernate.cfg.xml` packaged for deployment.

2) Prod `hibernate.cfg.xml`
- Build a production variant of `hibernate.cfg.xml` with your RDS JDBC URL, user, and password.
- First deploy: set `<property name="hibernate.hbm2ddl.auto">update</property>`
- After verification: change to `validate` and redeploy
### Production (Neon PostgreSQL)
Use environment variables or system properties:
- `DB_HOST`: Neon PostgreSQL endpoint (e.g., `ep-xyz.us-east-1.aws.neon.tech`)
- `DB_PORT`: `5432` (default PostgreSQL port)
- `DB_NAME`: Database name
- `DB_USER`: Database username
- `DB_PASS`: Database password

Connection string format:
```
jdbc:postgresql://<host>:5432/<db>?ssl=true&sslmode=require
```

## Balanced Approach (MVP)
- Phase 1 (first deploy): allow Hibernate to create/update tables with `hbm2ddl.auto=update`
Expand All @@ -58,13 +53,12 @@ cmd /c 'cd /d "C:\Users\nickh\Documents\My Projects\Java\code-forge" && mvn -q -
- Or add to Tomcat service/`setenv` as `-DCOGNITO_CLIENT_SECRET=your_secret`
- Start Tomcat and open `http://localhost:8080/codeforge/`

## RDS specifics
- Create DB (PostgreSQL/MySQL), note endpoint, user, password
- Security groups: allow inbound from your app host
- JDBC URL examples:
- Postgres: `jdbc:postgresql://<host>:5432/<db>`
- MySQL: `jdbc:mysql://<host>:3306/<db>?useSSL=true&requireSSL=true`
- On first deploy, keep DDL `update`; after verifying tables (`challenges`, `submissions`, `drill_items`), flip to `validate`
## RDS/Neon specifics
- Neon provides serverless PostgreSQL with automatic scaling
- Security: Neon requires SSL (`ssl=true&sslmode=require`)
- JDBC URL example:
- Postgres/Neon: `jdbc:postgresql://<host>:5432/<db>?ssl=true&sslmode=require`
- On first deploy, Hibernate can auto-create schema with `hbm2ddl.auto=update`; after verifying tables (`challenges`, `submissions`, `drill_items`), consider switching to `validate`

## QuoteService notes
- `QuoteService` loads `application.properties` from the classpath and uses `HttpClient` for outbound calls
Expand All @@ -90,48 +84,41 @@ For production (AWS RDS), override datasource and JPA properties with environmen

Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

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

This section references "Spring" properties and "application.yml", but this project uses Hibernate directly without Spring (as documented at the top of the file). Remove or update this section to reflect Hibernate-specific configuration instead of Spring configuration.

Copilot uses AI. Check for mistakes.
---

## 1) Provision AWS RDS

- Choose engine/version (e.g., PostgreSQL 15.x or MySQL 8.x).
- Create database (DB name, username, password).
- Configure security group rules to allow inbound from your app host (e.g., Elastic Beanstalk instance SG).
- Note the JDBC endpoint: `host:port/dbname`.
## 1) Provision Neon Database

## 2) Configure application (first deploy)
- Create a new project in Neon (https://neon.tech)
- Note the connection details: host, database name, username, password
- Neon automatically provides SSL-enabled PostgreSQL endpoints

Set the following environment variables in your hosting environment (Elastic Beanstalk, ECS, EC2, etc.), or for an one‑off local test run:
## 2) Configure application (Render deployment)

- `SPRING_DATASOURCE_URL`
- PostgreSQL: `jdbc:postgresql://<host>:<port>/<db>?sslmode=require`
- MySQL: `jdbc:mysql://<host>:<port>/<db>?allowPublicKeyRetrieval=true&useSSL=true&requireSSL=true&useUnicode=true&characterEncoding=utf8`
- `SPRING_DATASOURCE_USERNAME`
- `SPRING_DATASOURCE_PASSWORD`
- `SPRING_JPA_HIBERNATE_DDL_AUTO=update` (first deploy only — lets Hibernate create missing tables/columns)
Set the following environment variables in Render:

Example one‑shot local run on Windows cmd:
- `DB_HOST`: Neon endpoint (e.g., `ep-xyz.us-east-1.aws.neon.tech`)
- `DB_PORT`: `5432`
- `DB_NAME`: Database name
- `DB_USER`: Database username
- `DB_PASS`: Database password

```bat
cmd /c 'set "SPRING_DATASOURCE_URL=jdbc:postgresql://mydb.abcdefg.us-east-1.rds.amazonaws.com:5432/codeforge?sslmode=require" && set "SPRING_DATASOURCE_USERNAME=appuser" && set "SPRING_DATASOURCE_PASSWORD=secret" && set "SPRING_JPA_HIBERNATE_DDL_AUTO=update" && mvn -q spring-boot:run'
The application will build the JDBC URL automatically with SSL enabled:
```
jdbc:postgresql://${DB_HOST}:${DB_PORT}/${DB_NAME}?ssl=true&sslmode=require
```

Notes
- The app already externalizes server port via `server.port=${PORT:5000}`.
- Keep test/dev profiles pointed at H2; only prod uses RDS overrides.

## 3) Deploy and verify

- Deploy the app to your AWS environment with the env vars above.
- Verify health:
- `GET /actuator/health` → `UP`
- Deploy the app to Render with the environment variables above.
- Hibernate will auto-create the schema on first startup (using entity annotations).
- Verify schema:
- Check RDS tables exist: `challenges`, `submissions`, `drill_items`, including `drill_items.version` (added in Issue 38 via `@Version`).
- Connect to Neon and check that tables exist: `challenges`, `submissions`, `drill_items`, including `drill_items.version` (added via `@Version`).
- Smoke test the app (e.g., run a Drill flow to insert data).

## 4) Flip ddl-auto to validate
## 4) Schema management notes

Once the schema looks correct in RDS:
- Change environment variable: `SPRING_JPA_HIBERNATE_DDL_AUTO=validate`
- Redeploy the app. Hibernate will now validate the schema at startup and fail fast if it drifts, but it will no longer apply changes automatically.
- Hibernate uses entity annotations to create/validate schema
- First deploy: Hibernate will auto-create tables based on `@Entity` classes
- After verification: you can set `hibernate.hbm2ddl.auto=validate` to prevent auto-changes
- Future: consider Flyway for versioned migrations (post-MVP)

## 5) Post‑MVP: Adopt Flyway migrations

Expand All @@ -147,16 +134,20 @@ After MVP deployment stabilizes:
## 6) Troubleshooting

- `relation/table not found` at startup:
- You likely deployed with `ddl-auto=validate` before the schema existed; switch back to `update` for the first run.
- Permission errors creating tables:
- Ensure the RDS user has `CREATE`/`ALTER` permissions.
- Ensure Hibernate can create tables (check DB user permissions).
- Driver/URL errors:
- Confirm the correct JDBC driver is on the classpath (Spring Boot starters include both Postgres/MySQL when added) and that the JDBC URL is correct for your engine.
- Confirm PostgreSQL JDBC driver is in dependencies and JDBC URL is correct.
- Connection timeouts:
- Check RDS SG rules, VPC networking, and that your app host can reach the RDS endpoint.

## 7) Quick rollback plan

- Keep `ddl-auto` in an env var so you can temporarily switch back to `update` if a small non‑destructive patch is needed.
- Prefer to schedule structural changes; adopt Flyway promptly post‑MVP for safer, versioned changes.
- Verify DB_HOST, DB_PORT, and that Neon endpoint is accessible from Render.
- Check that SSL is enabled (`ssl=true&sslmode=require`).

## 7) Migration from AWS RDS MySQL

If migrating from existing MySQL database:
1. Export data from MySQL using `mysqldump` or similar
2. Convert MySQL syntax to PostgreSQL (AUTO_INCREMENT → SERIAL, ENUM → VARCHAR/CHECK, etc.)
3. Import into Neon using `psql` or database client
4. Update Render environment variables to point to Neon
5. Deploy and verify
6. After successful verification, delete AWS RDS instance

10 changes: 5 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<javax.validation.version>2.0.1.Final</javax.validation.version>
<hibernate.validator.version>6.2.5.Final</hibernate.validator.version>
<javax.el.version>3.0.1-b11</javax.el.version>
<mysql.connector.version>8.4.0</mysql.connector.version>
<postgresql.connector.version>42.7.7</postgresql.connector.version>
<!-- Plugin versions -->
<maven.compiler.plugin.version>3.13.0</maven.compiler.plugin.version>
<maven.surefire.plugin.version>3.2.5</maven.surefire.plugin.version>
Expand Down Expand Up @@ -164,11 +164,11 @@
<version>${javax.el.version}</version>
</dependency>

<!-- MySQL JDBC driver for DAO tests and MySQL runtime -->
<!-- PostgreSQL JDBC driver for DAO tests and Postgres runtime -->
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<version>${mysql.connector.version}</version>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>${postgresql.connector.version}</version>
</dependency>

</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ private static SessionFactory buildSessionFactory() {
url = explicitUrl;
} else {
String host = resolve("DB_HOST", "localhost");
String port = resolve("DB_PORT", "3306");
String port = resolve("DB_PORT", "5432");
String db = resolve("DB_NAME", "cf_test_db");

url = "jdbc:mysql://" + host + ":" + port + "/" + db
+ "?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC";
url = "jdbc:postgresql://" + host + ":" + port + "/" + db
+ "?ssl=true&sslmode=require";
Comment on lines +66 to +67
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

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

The default JDBC URL uses ssl=true&sslmode=require, which will fail when connecting to a local PostgreSQL instance for development. Local PostgreSQL typically doesn't have SSL configured. Consider detecting localhost connections and disabling SSL for them (e.g., ssl=false when host is "localhost"), while keeping SSL enabled for production. The test-db.properties.example correctly uses ssl=false for local development.

Suggested change
url = "jdbc:postgresql://" + host + ":" + port + "/" + db
+ "?ssl=true&sslmode=require";
boolean isLocalhost = "localhost".equalsIgnoreCase(host) || "127.0.0.1".equals(host);
String sslParams = isLocalhost ? "?ssl=false" : "?ssl=true&sslmode=require";
url = "jdbc:postgresql://" + host + ":" + port + "/" + db + sslParams;

Copilot uses AI. Check for mistakes.
}

// Username: hibernate prop -> DB_USER -> default "root"
Expand All @@ -91,14 +91,14 @@ private static SessionFactory buildSessionFactory() {
// Dialect: can still be overridden if needed
String dialect = resolve(
"hibernate.dialect",
"org.hibernate.dialect.MySQL8Dialect"
"org.hibernate.dialect.PostgreSQLDialect"
);

// Ensure MySQL JDBC driver is present
// Ensure PostgreSQL JDBC driver is present
try {
Class.forName("com.mysql.cj.jdbc.Driver");
Class.forName("org.postgresql.Driver");
} catch (ClassNotFoundException e) {
throw new IllegalStateException("MySQL JDBC driver not found on classpath", e);
throw new IllegalStateException("PostgreSQL JDBC driver not found on classpath", e);
}

// Log *non-secret* connection info
Expand Down
18 changes: 9 additions & 9 deletions src/main/resources/data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ VALUES
('Median of Two Sorted Arrays', 'HARD', 'Find median of two sorted arrays.', 'Given two sorted arrays nums1 and nums2, return the median of the two sorted arrays.');

-- Seed submissions for a few challenges (dev only)
INSERT INTO SUBMISSIONS (CHALLENGE_ID, OUTCOME, CODE)
INSERT INTO SUBMISSIONS (CHALLENGE_ID, USER_ID, OUTCOME, CODE)
VALUES
(1, 'CORRECT', 'int[] twoSum(int[] nums, int target) { /* ... */ }'),
(1, 'INCORRECT', '/* first attempt */'),
(2, 'ACCEPTABLE', 'boolean isValid(String s) { /* ... */ }'),
(3, 'SKIPPED', NULL);
(1, 'demo', 'CORRECT', 'int[] twoSum(int[] nums, int target) { /* ... */ }'),
(1, 'demo', 'INCORRECT', '/* first attempt */'),
(2, 'demo', 'ACCEPTABLE', 'boolean isValid(String s) { /* ... */ }'),
(3, 'demo', 'SKIPPED', NULL);

-- Seed drill items for a few challenges (dev only)
INSERT INTO DRILL_ITEMS (CHALLENGE_ID, TIMES_SEEN, STREAK, NEXT_DUE_AT)
INSERT INTO DRILL_ITEMS (CHALLENGE_ID, USER_ID, TIMES_SEEN, STREAK, NEXT_DUE_AT)
VALUES
(1, 2, 1, NULL),
(2, 1, 0, NULL),
(3, 3, 2, NULL);
(1, 'demo', 2, 1, NULL),
(2, 'demo', 1, 0, NULL),
(3, 'demo', 3, 2, NULL);
20 changes: 8 additions & 12 deletions src/main/resources/hibernate.cfg.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,21 @@
"https://hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<!-- JDBC connection (values resolved from System properties for CI; MySQL only) -->
<property name="hibernate.connection.driver_class">com.mysql.cj.jdbc.Driver</property>
<!-- Use system property hibernate.connection.url or default to local MySQL cf_test_db -->
<!-- JDBC connection (values resolved from System properties for CI; PostgreSQL) -->
<property name="hibernate.connection.driver_class">org.postgresql.Driver</property>
<!-- Use system property hibernate.connection.url or default to local PostgreSQL cf_test_db -->
<property name="hibernate.connection.url">
jdbc:mysql://${DB_HOST}:3306/${DB_NAME}
?useSSL=false
&amp;allowPublicKeyRetrieval=true
&amp;serverTimezone=UTC
&amp;useUnicode=true
&amp;characterEncoding=utf8mb4
&amp;connectionCollation=utf8mb4_unicode_ci
jdbc:postgresql://${DB_HOST}:5432/${DB_NAME}
?ssl=true
&amp;sslmode=require
Comment on lines +11 to +13
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

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

The default JDBC URL includes ssl=true&sslmode=require, but this will fail for local development connections to PostgreSQL. The test-db.properties.example correctly uses ssl=false for local development. Consider making SSL conditional based on the environment (e.g., ssl=false for localhost, ssl=true&sslmode=require for production).

Suggested change
jdbc:postgresql://${DB_HOST}:5432/${DB_NAME}
?ssl=true
&amp;sslmode=require
jdbc:postgresql://${DB_HOST}:5432/${DB_NAME}${DB_SSL_OPTIONS}

Copilot uses AI. Check for mistakes.
</property>
<property name="hibernate.connection.username">${DB_USER}</property>
<property name="hibernate.connection.password">${DB_PASS}</property>

<!-- Schema handling -->

<!-- Dialect (explicit MySQL) -->
<property name="hibernate.dialect">org.hibernate.dialect.MySQL8Dialect</property>
<!-- Dialect (explicit PostgreSQL) -->
<property name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property>

<!-- Show SQL while developing -->
<property name="hibernate.show_sql">true</property>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void connect() throws Exception {
try {
Class.forName(properties.getProperty("hibernate.connection.driver_class"));
} catch (ClassNotFoundException e) {
throw new Exception("MySQL Driver not found", e);
throw new Exception("Database Driver not found", e);
}

String url = properties.getProperty("hibernate.connection.url");
Expand Down
34 changes: 15 additions & 19 deletions src/test/resources/cleandb.sql
Original file line number Diff line number Diff line change
@@ -1,42 +1,38 @@
-- Purpose: Reset schema and seed sample data for local/dev testing
-- MySQL version
-- PostgreSQL version

-- Disable FK checks for dropping
SET FOREIGN_KEY_CHECKS = 0;

DROP TABLE IF EXISTS submissions;
DROP TABLE IF EXISTS drill_items;
DROP TABLE IF EXISTS challenges;

SET FOREIGN_KEY_CHECKS = 1;
-- Drop tables (CASCADE handles foreign keys automatically)
DROP TABLE IF EXISTS submissions CASCADE;
DROP TABLE IF EXISTS drill_items CASCADE;
DROP TABLE IF EXISTS challenges CASCADE;

-- ------------------------------------------
-- Recreate tables
-- ------------------------------------------

CREATE TABLE challenges (
id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
title VARCHAR(255) NOT NULL,
blurb TEXT,
prompt_md TEXT,
expected_answer TEXT,
difficulty ENUM('EASY', 'MEDIUM', 'HARD') NOT NULL,
difficulty VARCHAR(20) NOT NULL CHECK (difficulty IN ('EASY', 'MEDIUM', 'HARD')),
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
UNIQUE KEY uk_challenges_title (title)
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT uk_challenges_title UNIQUE (title)
);

CREATE TABLE drill_items (
id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
challenge_id BIGINT NOT NULL,
user_id VARCHAR(64) NOT NULL, -- MVP: string-based user identifier (e.g., 'demo' or Cognito sub)
times_seen INT NOT NULL DEFAULT 0,
streak INT NOT NULL DEFAULT 0,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
next_due_at TIMESTAMP NULL DEFAULT NULL,
version BIGINT NOT NULL DEFAULT 0,
UNIQUE KEY uk_drill_items_user_challenge (user_id, challenge_id),
CONSTRAINT uk_drill_items_user_challenge UNIQUE (user_id, challenge_id),
CONSTRAINT fk_drill_items_challenge
FOREIGN KEY (challenge_id)
REFERENCES challenges(id)
Expand All @@ -45,13 +41,13 @@ CREATE TABLE drill_items (
);

CREATE TABLE submissions (
id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

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

Using GENERATED ALWAYS AS IDENTITY prevents explicit ID insertion, which is correct for these tables. However, if you ever need to insert rows with specific IDs (e.g., for testing or data migration), consider using GENERATED BY DEFAULT AS IDENTITY instead. The current approach is more secure but less flexible.

Suggested change
id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,

Copilot uses AI. Check for mistakes.
challenge_id BIGINT NOT NULL,
user_id VARCHAR(64) NOT NULL, -- MVP: string-based user identifier (e.g., 'demo' or Cognito sub)
outcome ENUM('CORRECT', 'INCORRECT', 'ACCEPTABLE', 'SKIPPED') NOT NULL,
outcome VARCHAR(20) NOT NULL CHECK (outcome IN ('CORRECT', 'INCORRECT', 'ACCEPTABLE', 'SKIPPED')),
code TEXT,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT fk_submissions_challenge
FOREIGN KEY (challenge_id)
REFERENCES challenges(id)
Expand Down
9 changes: 9 additions & 0 deletions src/test/resources/test-db.properties.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# PostgreSQL connection settings for local testing
# Copy this file to test-db.properties and update with your local PostgreSQL credentials
# test-db.properties is git-ignored to prevent committing secrets

hibernate.connection.driver_class=org.postgresql.Driver
hibernate.connection.url=jdbc:postgresql://localhost:5432/cf_test_db?ssl=false
hibernate.connection.username=postgres
hibernate.connection.password=your_password_here
hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
Loading