This repository has been archived on 2022-05-25. You can view files and clone it, but cannot push or open issues or pull requests.
elon-eats-my-tweets/sql/migrations/20220525041635_refactor_dat...

9 lines
539 B
MySQL
Raw Normal View History

ALTER TABLE elon_tweets DROP CONSTRAINT elon_tweets_pkey;
ALTER TABLE elon_tweets ADD COLUMN id uuid PRIMARY KEY DEFAULT gen_random_uuid();
CREATE UNIQUE INDEX index_elon_tweets_on_twitter_id ON elon_tweets (twitter_id);
ALTER TABLE users DROP CONSTRAINT users_pkey;
ALTER TABLE users ADD COLUMN id uuid PRIMARY KEY DEFAULT gen_random_uuid();
ALTER TABLE users ALTER COLUMN twitter_id TYPE CHARACTER VARYING(256);
ALTER TABLE users ALTER COLUMN twitter_id SET NOT NULL;
CREATE UNIQUE INDEX index_users_on_twitter_id ON users (twitter_id);