Skip to content

Commit

Permalink
♻️ refactor: 데이터베이스 인덱스 추가 #238
Browse files Browse the repository at this point in the history
  • Loading branch information
sieunie committed Dec 4, 2024
1 parent aedff42 commit bd4b374
Show file tree
Hide file tree
Showing 3 changed files with 7 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
3 changes: 3 additions & 0 deletions BE/src/stock/order/stock-order.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
Column,
CreateDateColumn,
Entity,
Index,
PrimaryGeneratedColumn,
} from 'typeorm';
import { TradeType } from './enum/trade-type';
Expand All @@ -12,9 +13,11 @@ 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 bd4b374

Please sign in to comment.