소스 인벤토리 구조 분석 (iss-bfacccaabbd5)

This commit is contained in:
forge-bot 2026-07-14 04:34:14 +00:00
parent 8026c9ea4f
commit c41d2d2523

View file

@ -0,0 +1,78 @@
# Database Schema
## Entity: User
### Table Definition
```sql
CREATE TABLE users (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(50) NOT NULL UNIQUE,
email VARCHAR(100) NOT NULL UNIQUE,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);
```
### Column Details
| Column | Type | Constraints | Description |
|--------|------|-------------|-------------|
| id | BIGINT | PRIMARY KEY, AUTO_INCREMENT | Unique identifier |
| username | VARCHAR(50) | NOT NULL, UNIQUE | User's unique username |
| email | VARCHAR(100) | NOT NULL, UNIQUE | User's email address |
| created_at | TIMESTAMP | DEFAULT CURRENT_TIMESTAMP | Record creation time |
| updated_at | TIMESTAMP | DEFAULT CURRENT_TIMESTAMP ON UPDATE | Last update time |
### Indexes
| Index Name | Column | Type | Description |
|------------|--------|------|-------------|
| idx_username | username | UNIQUE | Fast username lookup |
| idx_email | email | UNIQUE | Fast email lookup |
### Entity Relationships
```
User (standalone entity, no foreign keys)
```
### JPA Entity Mapping
```java
@Entity
@Table(name = "users")
public class User {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(nullable = false, unique = true, length = 50)
private String username;
@Column(nullable = false, unique = true, length = 100)
private String email;
@Column(name = "created_at", updatable = false)
private LocalDateTime createdAt;
@Column(name = "updated_at")
private LocalDateTime updatedAt;
}
```
### Database Support
| Environment | Database | Driver |
|-------------|----------|--------|
| Development | H2 (In-Memory) | org.h2.Driver |
| Test | H2 (In-Memory) | org.h2.Driver |
| Production | MySQL 8.x | com.mysql.cj.jdbc.Driver |
| Production | PostgreSQL 15+ | org.postgresql.Driver |
### Migration Strategy
- **Development**: Auto DDL (Hibernate)
- **Production**: Flyway Migration Scripts
- Location: `src/main/resources/db/migration/`
- Naming: `V{version}__{description}.sql`