VSCode

Modify Tables- dbFlux (4/9)

published on

This is the fourth article in my series about the VSCode extension dbFLux. In the last article I showed you how to create automated TableAPIs with dbFlux. This time it's about how dbFlux can help you if you use dbFlow as deployment tool. See: https://github.com/MaikMichel/dbFlow

What is dbFLow? dbFlow is a deployment tool, with which you can deploy your APEX / Oracle applications. dbFLow is completely based on the Git workflow. dbFlow uses, like dbFLux, smartFS as the basic structure of the respective projects. The branching model is used to determine the differences to the respective stages and the resulting deployment artifact is provided.

dbFlow uses the so-called 2-phase deployment. The whole product can be treated as new / initial version or as update / patch. So the CreateTabelScript is always kept up to date, as if it is deployed against an empty / new database and additionally the changes are recorded in AlterTable scripts. So the deployment can either as an initial deployment import the table again or as a patch deployment change it, via an Alter-Table script for example.

dbFlux helps you to create these Alter-Table scripts. So let's say we have a table script checked in. For example the table todo_data/tables/todos.

create table todos (
  tdo_id               number                    not null,
  tdo_name             varchar2(250 char)        not null,
  tdo_created_at       date                      not null,
  tdo_created_by       varchar2(250 char)        not null,
  tdo_modified_at      date                      not null,
  tdo_modified_by      varchar2(250 char)        not null
);

This has to be committed via Git.

git commit -m "create table todos"

At a later time this table is to be extended by a new column. To do this, change the file, for example, as follows:

create table todos (
  tdo_id               number                    not null,
  tdo_name             varchar2(250 char)        not null,
  --
  tdo_desc             varchar2(4000 char),
  --
  tdo_created_at       date                      not null,
  tdo_created_by       varchar2(250 char)        not null,
  tdo_modified_at      date                      not null,
  tdo_modified_by      varchar2(250 char)        not null
);

Here I have inserted the column tdo_desc.
Now I can execute the command dbFLux: Create TableDDL File with the help of dbFlux (Ctrl+Alt+D).

After I have chosen the table / table script, dbFlux creates a file for me which contains the `git diff` to this file. 

So it is easy for me as a developer to add the whole thing with an alter table add ....

Afterwards I can apply the file as usual with Ctrl+Alt+B

List of the single articles of this series:
1. Initialize Workspace
2. Create Database Objects
3. Configure Custom Trigger Runs
4. Modify Table