mirror of https://github.com/buster-so/buster.git
9 lines
375 B
MySQL
9 lines
375 B
MySQL
|
-- Your SQL goes here
|
||
|
-- First delete any duplicate rows
|
||
|
DELETE FROM datasets a USING datasets b
|
||
|
WHERE a.id > b.id
|
||
|
AND a.database_name = b.database_name
|
||
|
AND a.data_source_id = b.data_source_id;
|
||
|
|
||
|
ALTER TABLE datasets
|
||
|
ADD CONSTRAINT datasets_database_name_data_source_id_key UNIQUE (id, database_name, data_source_id);
|