Lock your files - dbFlux (9/9)

published on

Welcome to the ninth article about the core topics of dbFlux. The last article was about the processing of AOP files. In this article I will present you an add-on to dbFlux, which allows you to protect your team from accidental overwriting the sources in your database.

Many of you know this topic. As APEX developers we develop in a team on the same database and often on the same applications and methods in the backend. And there it can happen that you make changes to a package and suddenly overwrite the changes of a team member on the same package. Simply for the reason that the colleague has not yet checked his changes into the version control. That happens sometimes, simply because the feature, the bug or whatever was not yet ready. Or it was developed on another feature branch. That happens. Within APEX we have the possibility to lock pages and thus prevent unwanted overwriting directly.

With dbLock dbFlux offers a feature or an add-on to protect source code or database objects in a similar way. So you can lock or unlock the file to be edited. In addition, you can see the locked files grouped by developer who has applied the lock, via a ViewPanel.

dbLock is expected as REST service and can be installed as reference implementation by an ORDS module directly on the own environment. dbLock is open source and can be downloaded and installed here: https://github.com/MaikMichel/dbLock

The installation is project independent and I recommend to install it centrally, so you can use it in multiple projects. During the installaion a table and the corresponding ORDS module is installed. Additionally the output contains a token. You have to set this token in the settings. The token is used for authentication.
If you have installed dbLock, you have to add it to your settings in the workspace. Of course you also have to set the URL where the service can be requested.

  "dbFlux.dbLock.RestAPIEnabled": true,
  "dbFlux.dbLock.RestAPIUrl": "http://localhost:8080/ords/dblock",

Now you can lock a file with the command dbFLux: Lock current File.

With the command dbFlux: Unlock current File you are able to unlock the file.

Unlocking is not only limited to your own files. Currently, you can also unlock files that have been locked by another user. How fast it happens that someone is not there, due to illness, vacation or whatever.
So if you want to compile a file with dbFlux: Compile currentFile (Ctrl+Alt+B) which has been locked by another user, you have to unlock it first. dbFlux does not allow compiling if dbLock has been activated and dbLock just confirms a lock for the current file which has not been released by the current OS user.

dbFlux additionally offers, if dbLock is activated, a ViewPanel in which the locked files are displayed in a TreeView grouped by user. So you can see exactly which file has been locked by which user. 

I think this is a cool feature, especially for those of you who are developing together in a team on the same applications.

List of the single articles of this series

1. Initialize Workspace
2. Create Database Objects
3. Configure Custom Trigger Runs
4. Modify Tables
5. Compile Source Code
6. Upload JavaScript and CSS
7. Execute utPLSQL unit tests
8. Upload AOP files
9. Lock your files