fief-dev / fief

Users and authentication management SaaS
https://www.fief.dev
Other
486 stars 42 forks source link

Revamp BYOD schema handling #263

Closed frankie567 closed 9 months ago

frankie567 commented 10 months ago

Until now, "local" and "BYOD" workspaces were created using a schema.

While working well for PostgreSQL, for MySQL, it ends up actually creating another database. This prevents BYOD to work with cloud databases which obviously blocks the creation of databases (see #212).

With this PR, BYOD database won't create a new schema but directly use the provided database. To avoid collisions, we introduce a table prefix feature which allows user to define their table prefix, and potentially have several Fief workspaces inside the same database.

codecov[bot] commented 10 months ago

Codecov Report

Merging #263 (859751b) into main (e8891ca) will increase coverage by 0.02%. The diff coverage is 97.91%.

@@            Coverage Diff             @@
##             main     #263      +/-   ##
==========================================
+ Coverage   92.73%   92.76%   +0.02%     
==========================================
  Files         247      247              
  Lines        8710     8731      +21     
==========================================
+ Hits         8077     8099      +22     
+ Misses        633      632       -1     
Files Changed Coverage Δ
fief/cli.py 30.04% <ø> (ø)
fief/services/posthog.py 88.00% <ø> (ø)
fief/services/workspaces.py 0.00% <ø> (ø)
fief/settings.py 93.70% <ø> (-0.05%) :arrow_down:
fief/models/workspace.py 93.18% <94.44%> (+2.27%) :arrow_up:
fief/apps/dashboard/forms/workspace.py 100.00% <100.00%> (ø)
fief/db/engine.py 100.00% <100.00%> (ø)
fief/db/workspace.py 96.07% <100.00%> (ø)
fief/models/authorization_code.py 100.00% <100.00%> (ø)
fief/models/base.py 100.00% <100.00%> (ø)
... and 6 more

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more