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
5 changes: 3 additions & 2 deletions db/schema/schema.sql
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
CREATE TABLE IF NOT EXISTS instruments (
id INTEGER PRIMARY KEY AUTOINCREMENT,
symbol TEXT NOT NULL UNIQUE,
symbol TEXT NOT NULL,
asset_type TEXT NOT NULL,
exchange TEXT,
quote_currency TEXT NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
deleted_at TIMESTAMP
deleted_at TIMESTAMP,
UNIQUE(symbol, exchange)
);

CREATE TABLE IF NOT EXISTS portfolios (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
-- +goose StatementBegin
CREATE TABLE IF NOT EXISTS instruments (
id INTEGER PRIMARY KEY AUTOINCREMENT,
symbol TEXT NOT NULL UNIQUE,
symbol TEXT NOT NULL,
asset_type TEXT NOT NULL,
exchange TEXT,
quote_currency TEXT NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
deleted_at TIMESTAMP
deleted_at TIMESTAMP,
UNIQUE(symbol, exchange)
);

CREATE TABLE IF NOT EXISTS portfolios (
Expand Down
2 changes: 1 addition & 1 deletion internal/repository/instrument_repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func (r *InstrumentRepository) Create(ctx context.Context, in Instrument) (Instr
"instrument %q on exchange %q: %w",
in.Symbol,
in.Exchange,
domain.ErrPositionAlreadyExists,
domain.ErrInstrumentAlreadyExists,
)
}

Expand Down