Commit Graph

46 Commits

Author SHA1 Message Date
Luna 287678331d add voice_regions, voice_servers, and guild.region foreign key 2019-03-03 18:11:11 -03:00
George Tsatsis b92ea295dc Remove a stray comma which caused errors upon import 2019-01-26 14:00:24 +00:00
Luna e885bf859c migration.scripts: add attachments.{channel, message}_id
- schema.sql: remove message_attachments table

    it is uneeded since we have the columns in attachments
2018-12-08 23:21:11 -03:00
Luna d5ad4bb96d migration.scripts: add 10_add_attachments_table
- schema.sql: add attachments table
2018-12-08 22:08:37 -03:00
gabixdev cf5ad107ad new invite handling and unconfirmed account support 2018-12-03 21:06:47 +01:00
Luna a0129da198 schema.sql: change roles.color default to 0
fixes the at-everyone role being black.

related to !6.

 - migration.scripts: add 8_roles_default_color
2018-12-02 22:48:01 -03:00
Luna Mendes 8d8be18633 storage: add rate_limit_per_user fetching
the rate_limit_per_user field has been on schema.CHAN_UPDATE for a while
but the database didn't have the column.

 - migration.scripts: add 7_text_channels_rate_limit_per_user.sql
 - schema.sql: add guild_text_channels.rate_limit_per_user
2018-11-22 22:06:19 -03:00
Luna Mendes f81e3aea53 user.billing_job: process users.premium_since field
- storage: inject user.premium_type based on subscription
2018-11-21 16:39:14 -03:00
Luna Mendes 05c8204271 migration.scripts: add 6_emoji_require_colon_true
- schema: change default on guild_emoji.require_colons to true
2018-11-20 17:10:34 -03:00
Luna Mendes 93e00315df guild, channels: add dummy implementation for search
- schemas: add SEARCH_CHANNEL
 - migration.scripts: add 5_add_messages_guild_id
 - schema.sql: add messages.guild_id
2018-11-20 04:15:03 -03:00
Luna Mendes 8b305407c2 manage.cmd: add invites blueprint
- schema.sql: remove temporary and expires_at columns
 - migration.scripts: remove emporary and expires_at columns
2018-11-19 01:34:04 -03:00
Luna Mendes 99fab19766 migration.scripts: add 4_add_instance_invites
- schema.sql: add instance_invites table
2018-11-19 00:00:07 -03:00
Luna Mendes cc535bb851 schema.sql: add UNIQUE to icons.hash 2018-11-17 18:27:37 -03:00
Luna Mendes c70dd62306 guild: add implementations for emoji add/update/remove
All icons will be invalidated.

 - images: change icon path model
 - images: handle hashes being NULL, for emojis only needing
    the key
 - schemas: add NEW_EMOJI, PATCH_EMOJI
 - migration.scripts: add 3_drop_constraints_icons_hash
 - schema.sql: drop unique and not null from hash, change primary key in
    icons
2018-11-17 17:52:34 -03:00
Luna Mendes b9ef4c6d8c litecord.blueprints: split users bp into user sub-bp
- blueprints.user: add biling bp
 - blueprints.user: add settings bp
 - schema.sql: add user_payment_sources, user_subscriptions,
    user_payments
2018-11-14 03:43:40 -03:00
Luna Mendes 5480a669a3 all: add guild icon support
- fix update_guild's methods
 - fix update_guild's sql statements
 - litecord: add images module
 - schemas: add splash to GUILD_UPDATE
 - schemas: add validate to INVITE
 - manage.cmd.migration: add script 2
2018-11-13 21:12:40 -03:00
Luna Mendes e7929b2099 schema.sql: fix table ordering 2018-11-13 04:34:26 -03:00
Luna Mendes a394c02477 schemas: add USER_SETTINGS.status 2018-11-07 19:15:07 -03:00
Luna Mendes 55f8919689 pubsub.lazy_guilds: add support for 'everyone'-type GMLs
if the everyone role can read the channel, then the member list
will be equivalent to any other list where the everyone role
can read the channel. with this in mind we can generate a "global"
member list directed only for that usecase.

 - permissions: add role_permissions
2018-11-07 04:11:17 -03:00
Luna Mendes db9fd783f5 manage.cmd.migration: add rudimentary implementation
Also add table changes for future message embeds.
2018-11-06 20:46:17 -03:00
Luna Mendes 7c274f0f70 channels: add PUT /api/v6/:chan_id/permissions/:overwrite_id
This finishes the basics on channel overwrites.

SQL for instances:
```sql
DROP TABLE channel_overwrites;
```
Then run `schema.sql`.

 - channels: finish implementations for update_{text,voice}_channel
 - storage: fix _overwrite_convert
 - schema.sql: use unique constraint instead of primary key in
    channel_overwrites
2018-11-05 04:12:16 -03:00
Luna Mendes 0f7ffaf717 storage: add Storage.get_reactions
This finishes basic reaction code (both inserting and putting a reaction).

SQL for instances:
```sql
DROP TABLE message_reactions;
```

Then rerun `schema.sql`

 - channel.reactions: fix partial_emoji
 - schema.sql: add message_reactions.react_ts and unique constraint
    instead of primary key
2018-11-02 22:07:32 -03:00
Luna Mendes 2b1f9489b7 channel: add reactions blueprint
SQL for instances:
```sql
DROP TABLE message_reactions;
```
Then rerun `schema.sql`.
2018-11-02 18:29:07 -03:00
Luna Mendes 80c29265f3 schema.sql: add users.last_session
- 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');
```
2018-10-27 23:40:35 -03:00
Luna Mendes ef5d4f30e1 blueprints: create dms blueprint
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
2018-10-19 16:21:33 -03:00
Luna Mendes a926ed47ae storage: add Storage.get_guild_settings
- gateway.websocket: use Storage.get_guild_settings
 - schema.sql: chande defaults on message_notifications to 0
2018-10-19 04:45:56 -03:00
Luna Mendes b1a362418c schema: add guild_settings and guild_settings_channel_overrides 2018-10-19 04:30:52 -03:00
Luna Mendes b43b220882 blueprints.users: add profiles and mutual friends 2018-10-10 20:07:38 -03:00
Luna Mendes 28f33b0a95 schema: change premium to premium_since
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;
```
2018-10-10 19:13:59 -03:00
Luna Mendes 737129bd20 blueprints.channels: fix channel deletion
- blueprints.guilds: fix channel creation
 - blueprints.relationships: add POST /api/v6/users/@me/relationships
 - storage: add Storage.search_user, for ^
 - storage: fix bug with last_message_id returning "None" (as a str)
2018-10-10 17:09:39 -03:00
Luna Mendes adc6a58179 blueprints.channels: add channel and guild ack routes
SQL for instances: Rerun `schema.sql` for the new table.

 - gateway.websocket: add get_read_state to read_state's ready
 - gateway.websocket: add get_dms on private_channels' ready
 - storage: fix get_dms()
 - storage: add Storage.get_channel_ids()
 - storage: add Storage.get_read_state()
 - schema.sql: add user_read_state table
2018-10-09 22:52:12 -03:00
Luna Mendes 0ebbc4cd37 schema.sql: add UNIQUE to dm_channels
This should fix the `schema.sql` errors on 61e36f244b.

```sql
DROP TABLE dm_channels;
```

Then rerun `schema.sql`.
2018-10-03 22:11:07 -03:00
Luna Mendes 61e36f244b blueprints.users, channels: basic dm operations
SQL for instances:

```sql
ALTER TABLE messages
ADD CONSTRAINT messages_channels_fkey
FOREIGN KEY (channel_id)
REFERENCES channels (id)
ON DELETE CASCADE;

ALTER TABLE channel_pins ADD CONSTRAINT pins_channels_fkey
FOREIGN KEY (channel_id)
REFERENCES channels (id)
ON DELETE CASCADE;

ALTER TABLE channel_pins ADD CONSTRAINT pins_messages_fkey
FOREIGN KEY (message_id)
REFERENCES messages (id)
ON DELETE CASCADE;
```

After that, rerun `schema.sql`.

blueprints.channels:
 - check dms on channel_check
 - add DELETE /api/v6/channels/<int:channel_id>

blueprints.users:
 - add event dispatching for leaving guilds
 - add GET /api/v6/users/@me/channels, for DM fetching
 - add POST /api/v6/users/@me/channels, for DM creation
 - add POST /api/v6/users/<int:user_id>/channels for DM / Group DM
    creation

 - schemas: add CREATE, CREATE_GROUP_DM
 - storage: add last_message_id fetching for channels
 - storage: add support for DMs in get_channel
 - storage: add Storage.get_dm, Storage.get_dms, Storage.get_all_dms
 - schema.sql: add dm_channel_state table
 - schema.sql: add constriants for messages.channel_id and channel_pins
2018-10-03 21:49:35 -03:00
Luna Mendes fcddd46d47 schema.sql: add draft for dm_channels
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
2018-10-02 17:56:20 -03:00
Luna Mendes d7cc5568bc schema.sql: fix possible bug with some message tables
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.
2018-10-02 16:51:01 -03:00
Luna Mendes c7923da124 relationship support!
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
2018-10-02 03:43:57 -03:00
Luna Mendes 4841565f14 schema.sql: add user_settings table
rerunning the schema.sql file should get you up and running.

 - add POST /api/v6/users/@me/consent for consent changes (that get
    ignored)
2018-09-29 22:17:10 -03:00
Luna Mendes d9506f450d schema.sql: change from varchar to text on some fields
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;
2018-09-28 00:54:24 -03:00
Luna Mendes 3858e20080 Add user notes
- blueprints.users: fix get_other
 - blueprints.users: add dummy get_user_settings,
     patch_current_settings, get_consent, get_harvest and get_library
 - enums: add ExplicitFilter
 - storage: add Storage.fetch_notes
 - schema.sql: add incomplete user_settings table
2018-09-22 20:18:48 -03:00
Luna Mendes 545d261bdd schema.sql: fix syntax 2018-07-06 02:29:17 -03:00
Luna Mendes 0ca45c781e blueprints.channels: add implementations for some routes
more specifically edit/delete message, and all 3 pin-related routes.

 - snowflake: add snowflake_datetime
2018-07-04 17:40:27 -03:00
Luna Mendes 2276308c5d blueprints.guild: use guild_id = role_id on at-everyone's role
- 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
2018-06-23 21:18:19 -03:00
Luna Mendes de98d0f609 blueprints.guild: use EventDispatcher
- dispatcher: add sub_guild, unsub_guild, remove_guild, dispatch_guild
 - gateway.state_manager: fix fetch_states
 - gateway.websocket: add current_shard, shard_count to atributes
 - schema: add ON DELETE CASCADE to channel tables
2018-06-21 17:59:08 -03:00
Luna Mendes 3eb6d5e60f litecord: add Storage
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
2018-06-20 16:53:22 -03:00
Luna Mendes f7f387dcf0 litecord.blueprints: add auth blueprint
- Pipfile: add bcrypt and itsdangerous
 - litecord: add errors module
 - litecord: add snowflake module
 - run: add error handlers

 - schema: add UNIQUE constraint to users.email
   - remove users.password_salt
2018-06-17 04:09:29 -03:00
Luna Mendes c11851c4b0 add schema.sql
- add basic config example stuff
2018-06-16 19:25:07 -03:00