Changeset 421 in code for trunk/downstream.go


Ignore:
Timestamp:
Oct 24, 2020, 1:14:23 PM (5 years ago)
Author:
contact
Message:

Switch DB API to user IDs

This commit changes the Network schema to use user IDs instead of
usernames. While at it, a new UNIQUE(user, name) constraint ensures
there is no conflict with custom network names.

Closes: https://todo.sr.ht/~emersion/soju/86
References: https://todo.sr.ht/~emersion/soju/29

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/downstream.go

    r419 r421  
    10171017                        }
    10181018                        n.Nick = nick
    1019                         err = dc.srv.db.StoreNetwork(dc.user.Username, &n.Network)
     1019                        err = dc.srv.db.StoreNetwork(dc.user.ID, &n.Network)
    10201020                })
    10211021                if err != nil {
     
    16981698        n.SASL.Plain.Username = username
    16991699        n.SASL.Plain.Password = password
    1700         if err := dc.srv.db.StoreNetwork(dc.user.Username, &n.Network); err != nil {
     1700        if err := dc.srv.db.StoreNetwork(dc.user.ID, &n.Network); err != nil {
    17011701                dc.logger.Printf("failed to save NickServ credentials: %v", err)
    17021702        }
Note: See TracChangeset for help on using the changeset viewer.