Comments (5)
Shouldn't be too hard to implement, but there needs to be some migration SQL unless we're Ok with breaking the schema. Any thoughts on that?
from vaultwarden.
Yeah, you are right about that. We also need to change the Ciphers table because currently user_uuid can't be null, and that doesn't make sense when the cipher is owned by an organization.
I personally don't mind breaking the schema if necessary, but in this case I think a migration would be reasonably easy. I'm thinking something like this:
ALTER TABLE ciphers RENAME TO oldCiphers;
CREATE TABLE ciphers (
uuid TEXT NOT NULL PRIMARY KEY,
created_at DATETIME NOT NULL,
updated_at DATETIME NOT NULL,
user_uuid TEXT REFERENCES users (uuid), # Make this optional
organization_uuid TEXT REFERENCES organizations (uuid), # Add reference to orgs table
# Remove folder_uuid
type INTEGER NOT NULL,
name TEXT NOT NULL,
notes TEXT,
fields TEXT,
data TEXT NOT NULL,
favorite BOOLEAN NOT NULL
);
CREATE TABLE users_ciphers (
user_uuid TEXT NOT NULL REFERENCES users (uuid),
cipher_uuid TEXT NOT NULL REFERENCES ciphers (uuid),
folder_uuid TEXT NOT NULL REFERENCES folders (uuid),
PRIMARY KEY (user_uuid, cipher_uuid)
);
INSERT INTO ciphers (uuid, created_at, updated_at, user_uuid, organization_uuid, type, name, notes, fields, data, favorite)
SELECT uuid, created_at, updated_at, user_uuid, organization_uuid, type, name, notes, fields, data, favorite FROM oldCiphers;
INSERT INTO users_ciphers (user_uuid, cipher_uuid, folder_uuid)
SELECT user_uuid, uuid, folder_uuid FROM oldCiphers WHERE folder_uuid IS NOT NULL;
DROP TABLE oldCiphers;
Something like that would be on the up.sql file, and the reverse process would be on the down.sql.
from vaultwarden.
I don't think we can really provide down.sql as you can map folders one way, but not the other way around (for example when two users have the cipher in their folders)
Is diesel fine with one way updates?
from vaultwarden.
Yeah, I didn't think of that.
I imagine diesel shoudn't have a problem as long as we don't choose to revert a migration, and I don't think we have a use for that.
In any case, if there is a problem, we could put folder_uuid to null in the down.sql and that would simply delete the folder assotiations, but we would still have the ciphers, which I guess is better than nothing.
from vaultwarden.
This should be fixed now with your PR, so I'm closing it.
from vaultwarden.
Related Issues (20)
- Organization invites fail based on keywords such as 'lock' in the email. HOT 1
- Self-host server URL does not stick HOT 1
- No collections displayed when adding an item HOT 6
- I_REALLY_WANT_VOLATILE_STORAGE=true
- [wiki] non-exists nginx version on wiki HOT 4
- Port zuzugreifen
- Unable to create entry, You must select at least one collection HOT 1
- Edge 124 and above can't open vaultwarden website
- Vaultwarden 1.30.5 with Bitwarden Client 2024.3.0 - Client does not allow saving new entries due to collections not being available. HOT 1
- Icons missing after going from 1.26 -> 1.30.5 and cant create new logins/entries
- Failed to upload attachment
- SIGTERM and container exitting at least once a day HOT 5
- Build failure: redundant imports HOT 2
- MS Exchange On-Prem Self-Signed SMTP cert prevents 2FA Mails
- Vaultwarden times out for Android Clients
- Websocket connections not working with recommended apache2 proxy configuration
- Some variables from .env file being ignored i.e. ROCKET_PORT HOT 1
- Organizations
- Cannot login with extension anymore HOT 1
- Unable to fetch ServerConfig: Failed to decode access token: JWT must have 3 parts
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vaultwarden.