Create Database Objects - dbFlux (2/9)

published on

Hi guys, this is the second part of my article series about dbFlux key features. In the first part I told you how to install dbFlux and initialize your workspace.

In this article I will show you how to create database objects with dbFLux in the simplest way. And as it is common in most projects, I start with a table. So in this example I want to create a table named todo. Theoretically it is enough to create a file with the appropriate name in the appropriate folder. This can be done manually or with the help of a shortcut.

 dbFlux offers for this purpose the command dbFlux: Create Object or with the shortcut Ctrl+Alt+C. dbFlux shows you now the directory tree, from which you can choose a directory. Of course I take the directory db/todo_data/tables. Finally I have to specify the filename.

dbFlux has now created a file inside the selected directory. In addition, a snippet is executed here, which makes it much easier for us to create the table. You can also take your own snippets. dbFlux picks here the snippet, which is called like the directory and has the extension sql. In this case it would be named tables.sql.

dbFLux also contains some more snippets. By entering dbf these are displayed directly by VSCode. These snippets show the target filename as a comment above the snippet. 

This serves for the fact that one can divide the Script later based on this comment, into several files. To do this, simply call the command dbFlux: Split File or use the shortcut Ctrl+Alt+S. With the command dbFlux: Join Files or with the shortcut Ctrl+Alt+J these files are merged again into the current file.

Of course you can also create your own templates. But this is not a dbFLux feature, but a standard when working with VSCode ;-) See: User defined snippets.

If you have everything together, you can of course execute the script. For this you can use the command dbFlux: Compile current file or use the shortcut Ctrl+Alt+B.

In the next post I will talk about the integration of automatism, for example for the creation of TableAPIs.

List of the single articles of this series:
1. Initialize Workspace
2. Create Database Objects