Skip to content

Commit

Permalink
Merge pull request #263 from boostcampwm-2024/refactor/db-#238
Browse files Browse the repository at this point in the history
[BE] 27.11 데이터베이스 인덱싱 #238
  • Loading branch information
uuuo3o authored Dec 5, 2024
2 parents aedff42 + e518dfa commit 93abc2c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion BE/src/asset/asset.entity.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
import { Column, Entity, PrimaryGeneratedColumn, Unique } from 'typeorm';

const INIT_ASSET = 10000000;

@Entity('assets')
@Unique(['user_id'])
export class Asset {
@PrimaryGeneratedColumn()
id: number;
Expand Down
3 changes: 2 additions & 1 deletion BE/src/stock/bookmark/stock-bookmark.entity.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
import { Column, Entity, PrimaryGeneratedColumn, Unique } from 'typeorm';

@Entity('bookmarks')
@Unique(['user_id', 'stock_code'])
export class Bookmark {
@PrimaryGeneratedColumn()
id: number;
Expand Down
4 changes: 4 additions & 0 deletions BE/src/stock/order/stock-order.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,23 @@ import {
Column,
CreateDateColumn,
Entity,
Index,
PrimaryGeneratedColumn,
} from 'typeorm';
import { TradeType } from './enum/trade-type';
import { StatusType } from './enum/status-type';

@Entity('orders')
@Index(['user_id', 'stock_code'])
export class Order {
@PrimaryGeneratedColumn()
id: number;

@Index()
@Column({ nullable: false })
user_id: number;

@Index()
@Column({ nullable: false })
stock_code: string;

Expand Down

0 comments on commit 93abc2c

Please sign in to comment.