Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent changing originalfile.mimetype from 'Directory' #1645

Merged
merged 1 commit into from Oct 28, 2013

Conversation

mtbc
Copy link
Member

@mtbc mtbc commented Oct 22, 2013

One should not be able to change a mimetype in the originalfile table from 'Directory' to some other value. Other changes should still be permitted.

See discussion on a92d503.

mtbc referenced this pull request Oct 22, 2013
The trigger is run before deletions on the originalfile table
and raises an exception if there are still files which would
count as being "contained" in the directory (based on path
inclusion). The recursive delete method will order deletes
such that any contents should be removed first.
@bpindelski
Copy link

omero=# SELECT COUNT(*) FROM originalfile WHERE mimetype = 'Directory';
 count 
-------
     4
(1 row)

omero=# UPDATE originalfile SET mimetype = 'foobar' WHERE mimetype = 'Directory';
ERROR:  Directory(20)=/root_0/ must remain a Directory

Looks ok to merge.

@joshmoore
Copy link
Member

@mtbc: thoughts on bumping the patch version, etc? What other changes are upcoming from your side?

@mtbc
Copy link
Member Author

mtbc commented Oct 25, 2013

Other changes depend on what we do about some of the beta2 tickets, really. (Import set, for instance.) I thought about bumping the patch version, but it won't break things or not to have the trigger there, so I figured it probably wasn't worth it, it just causes me to have a reason to break out a 5.0DEV6 → ? upgrade script separately from my 4.4 -> 5.0DEV6 one. I could still bump it if you like though.

@joshmoore
Copy link
Member

Fair enough and makes good sense. It's almost guaranteed that there will be some other DB change, so we'll integrate this change then. In the mean-time, however, no one will be testing this in anger, so the only possibly thing to look out for is a decrease in delete performance. /cc @pwalczysko

joshmoore added a commit that referenced this pull request Oct 28, 2013
Prevent changing originalfile.mimetype from 'Directory'
@joshmoore joshmoore merged commit 9f77532 into ome:develop Oct 28, 2013
@mtbc mtbc deleted the fs-directory-mimetype branch October 28, 2013 10:16
@mtbc
Copy link
Member Author

mtbc commented Oct 28, 2013

--no-rebase as it changes DB

mtbc added a commit to mtbc/openmicroscopy that referenced this pull request Oct 28, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants