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...

11 lines
478 B
SQL

-- requires an empty db
DROP INDEX index_users_on_twitter_id;
ALTER TABLE users ALTER COLUMN twitter_id DROP DEFAULT;
ALTER TABLE users ALTER COLUMN twitter_id TYPE bigint USING (twitter_id::bigint);
ALTER TABLE users DROP COLUMN id;
ALTER TABLE users ADD PRIMARY KEY (twitter_id);
DROP INDEX index_elon_tweets_on_twitter_id;
ALTER TABLE elon_tweets DROP CONSTRAINT elon_tweets_pkey;
ALTER TABLE elon_tweets DROP COLUMN id;
ALTER TABLE elon_tweets ADD PRIMARY KEY (twitter_id);