speckleworks / SpeckleCore

Check a brand new Speckle at: https://github.com/specklesystems
https://speckle.systems
MIT License
38 stars 16 forks source link

SpeckleCache.db allows duplicate account entries #130

Open tsvilans opened 5 years ago

tsvilans commented 5 years ago

Step 0:

Actual Behaviour

It is possible.

Affected Projects

Any project that creates / uses SpeckleCache.db. PySpeckle creates a SpeckleCache.db file if none is found and enforces uniqueness.

Proposed Solution (if any)

When creating Account table in SpeckleCache.db, set RestApi and Email to be unique by doing UNIQUE(RestApi,Email).

I.e. '''CREATE TABLE Account ([AccountId] integer NOT NULL PRIMARY KEY AUTOINCREMENT,[ServerName] varchar, [RestApi] varchar, [Email] varchar, [Token] varchar, [IsDefault] integer, UNIQUE(RestApi,Email))'''

didimitrie commented 5 years ago

relates to #123 too :)