Modrinth/migrations/20201001015631_not-null-github-avatar.sql
Aeledfyr c4fb7b7928
General cleanup: fix some bugs, some refactoring (#65)
* Merged mod file upload in version creation, mod creation and
  version file add to one function;  This makes sure that they are
  consistent
* Made some fields on `User` optional: `github_id`, `avatar_url`, `bio`.
    * We may not want to publicly show the `github_id` to everyone
      with access to the API
    * If we allow non-github users, some of those fields would be
      invalid; some oauth providers may not have avatars or bios
* Made CORS origins should configurable
* Made `--reconfigure-indices` and `--reset-indices` exit after
  completion instead of starting the server
2020-09-30 22:07:52 -07:00

36 lines
1.0 KiB
SQL

-- Originally:
-- ALTER TABLE users
-- ADD COLUMN github_id bigint NOT NULL default 0,
-- ADD COLUMN username varchar(255) NOT NULL default 'username',
-- ADD COLUMN name varchar(255) NOT NULL default 'John Doe',
-- ADD COLUMN email varchar(255) NULL default 'johndoe@modrinth.com',
-- ADD COLUMN avatar_url varchar(500) NOT NULL default '...',
-- ADD COLUMN bio varchar(160) NOT NULL default 'I make mods!',
-- ADD COLUMN created timestamptz default CURRENT_TIMESTAMP NOT NULL
-- We don't want garbage data when users are created incorrectly;
-- we just want it to fail.
ALTER TABLE users
ALTER COLUMN github_id DROP NOT NULL;
ALTER TABLE users
ALTER COLUMN github_id DROP DEFAULT;
ALTER TABLE users
ALTER COLUMN avatar_url DROP NOT NULL;
ALTER TABLE users
ALTER COLUMN avatar_url DROP DEFAULT;
ALTER TABLE users
ALTER COLUMN username DROP DEFAULT;
ALTER TABLE users
ALTER COLUMN name DROP DEFAULT;
ALTER TABLE users
ALTER COLUMN email DROP DEFAULT;
ALTER TABLE users
ALTER COLUMN bio DROP DEFAULT;
ALTER TABLE users
ALTER COLUMN bio DROP NOT NULL;