- gateway.websocket: update users.last_session
SQL for instances:
```sql
ALTER TABLE users ADD COLUMN last_session timestamp without time zone default (now() at time zone 'utc');
```
It should be safe for instances to run the `schema.sql` file and update.
- blueprints.users: s/GUILD_SETTINGS_UPDATE/USER_GUILD_SETTINGS_UPDATE
- storage: fix get_guild_settings returning a dict instead of a list
- schema.sql: fix types and syntax
sql for instances:
```sql
-- remove old nitro column
ALTER TABLE users DROP COLUMN premium;
-- add new nitro column
ALTER TABLE users ADD COLUMN premium_since timestamp without time zone DEFAULT NULL;
```
also add name to group_dm_channels, and a group_dm_members table.
SQL for moving to latest schema:
```sql
DROP TABLE dm_channels;
DROP TABLE group_dm_channels;
DROP TABLE channel_overwrites;
DROP TABLE guild_features;
```
Then rerun `schema.sql`.
- schema.sql: revamp channel_overwrites table
- schema.sql: add features table
- schema.sql: make guild_features use the features table
Drop the unused tables:
```sql
DROP TABLE message_attachments;
DROP TABLE message_reactions;
DROP TABLE channel_pins;
```
Rerun `schema.sql` to recreate them with the proper constraints.
friendships and blocks are possible, however presence code isn't ready
to handle presences of people who are friends.
SQL for instances, this is going to fix bad timestamps on the messages:
```sql
ALTER TABLE ONLY members ALTER COLUMN joined_at SET DEFAULT (now() at time zone 'utc');
ALTER TABLE ONLY messages ALTER COLUMN created_at SET DEFAULT (now() at time zone 'utc');
ALTER TABLE ONLY invites ALTER COLUMN created_at SET DEFAULT (now() at time zone 'utc');
```
After that, rerun the schema.sql file to have the new relationships
table.
- blueprints: add relationships blueprint
- enums: add RelationshipType
- storage: add get_relationships
- storage: fix bug on lazy guild changes and messages
- schemas: return validator.document instead of reqjson
- gateway.websocket: use Storage.get_relationships
unicode!
sql for instances to upgrade:
alter table users alter column username type text;
alter table guilds alter column name type text;
alter table members alter column nickname type text;
alter table roles alter column name type text;
alter table bans alter column reason type text;
- gateway.websocket: add user_ready function
- storage: add guild_id by default on member roles
- storage: add get_role_data
- schema.sql: change default color from 0 to 1
Storage serves as a way to reduce code repeatbility. So that we
don't need to keep repeating the same SQL statements over and over,
and to detach some SQL calls into their own code (like guild fetching)
- gateway.websocket: add WebsocketObjects to hold db, state_manager,
storage and loop
- gateway.websocket: add _make_guild_list
- schema: add members.deafened, members.muted