mirror of
https://github.com/captbaritone/webamp.git
synced 2026-01-23 10:15:31 +00:00
Ensure tweet ids are unique
This commit is contained in:
parent
039d3ea8c6
commit
16ec917b41
1 changed files with 13 additions and 0 deletions
|
|
@ -0,0 +1,13 @@
|
|||
import * as Knex from "knex";
|
||||
|
||||
// We can't add a unique constraint after the fact, but we can add a unique index which should do the same thing.
|
||||
// https://stackoverflow.com/a/35301957/1263117
|
||||
export async function up(knex: Knex): Promise<any> {
|
||||
await knex.raw(
|
||||
"CREATE UNIQUE INDEX idx_tweets_unique_tweet_id ON tweets(tweet_id);"
|
||||
);
|
||||
}
|
||||
|
||||
export async function down(knex: Knex): Promise<any> {
|
||||
await knex.raw("DROP INDEX idx_tweets_unique_tweet_id");
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue