mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Make user_id and term unique
This commit is contained in:
parent
a5c0ef19ec
commit
ff12675713
2 changed files with 1 additions and 7 deletions
|
|
@ -5,7 +5,6 @@ import {
|
|||
JoinColumn,
|
||||
ManyToOne,
|
||||
PrimaryGeneratedColumn,
|
||||
UpdateDateColumn,
|
||||
} from 'typeorm'
|
||||
import { User } from './user'
|
||||
|
||||
|
|
@ -23,7 +22,4 @@ export class SearchHistory {
|
|||
|
||||
@CreateDateColumn({ default: () => 'CURRENT_TIMESTAMP' })
|
||||
createdAt!: Date
|
||||
|
||||
@UpdateDateColumn({ default: () => 'CURRENT_TIMESTAMP' })
|
||||
updatedAt!: Date
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,9 +9,7 @@ CREATE TABLE omnivore.search_history (
|
|||
user_id uuid NOT NULL REFERENCES omnivore.user ON DELETE CASCADE,
|
||||
term VARCHAR(255) NOT NULL,
|
||||
created_at timestamptz NOT NULL DEFAULT current_timestamp,
|
||||
updated_at timestamptz NOT NULL DEFAULT current_timestamp
|
||||
unique (user_id, term)
|
||||
);
|
||||
|
||||
CREATE TRIGGER search_history_modtime BEFORE UPDATE ON omnivore.search_history FOR EACH ROW EXECUTE PROCEDURE update_updated_at_column();
|
||||
|
||||
COMMIT;
|
||||
|
|
|
|||
Loading…
Reference in a new issue