CREATE ROLE "user" NOSUPERUSER NOCREATEDB NOCREATEROLE NOINHERIT LOGIN ENCRYPTED PASSWORD 'password';
CREATE DATABASE "demo" WITH OWNER="user" encoding='UTF-8' lc_collate='en_US.utf8' lc_ctype='en_US.utf8' template template0;
REVOKE ALL ON DATABASE "demo" FROM public;
GRANT ALL ON SCHEMA public TO "user" WITH GRANT OPTION;
\connect "demo";
ALTER SCHEMA public OWNER TO "user";
Configure global executables
Webdev
dart pub global activate webdev
SSH PORT 22005 FOR REPO
File "config" in your .ssh folder should contain the following lines
Host repo.centryl.org
Port 22005
Download specific version of DART
https://dart.dev/get-dart/archive
Add PATH
In your home folder in file .bashrc add following line
export PATH="$PATH:$HOME/dart/dart-sdk/bin:$HOME/.pub-cache/bin:$HOME/flutter/bin"
Program: /path_to/nginx
Working directory: $ProjectFileDir$
Note $ProjectFileDir$ is an Webstorm variable and should be written as is
Create the configuration
Edit configurations > Add configuration > Dart Command Line App
Dart file: /project_path/bin/app
Working directory: /project_path
Before launch > '+' > Run External tool and choose the tool
Modifing the data
Edit specific file in model directory (modules/xxxx/db/entity/mod.dart)
Write the specific patch and change create.sql file in
(modules/xxxx/db/schema).
in schema you should have a folder patch
create a patch file n.2021-12-23.sql. Where n is the number of the patch file
for this module. Should be the next after the last that you have in the folder.
2021-12-23 is the date of the patch YYYY-MM-DD.
Go back and in create.sql edit the table you need to change
Go to module root folder and run "date pub run build_runner build"
If you have a cl_base in your pubspec.yaml it should regenerate your
serialization/deserialization functions according to your new entities and
dtos for this module.
Changing fields usually means changing conditions in the mapper file so
take a look and if you need to change or add the new column in the CollectionBuilder.
Do that.
If the new field leads to a new table you will need to modify lister funciton in your
controller for this object.
In GUI you usually have two files connected to this model.
One item editor
List of items
You should add the new fields in order to work with them.
Commands in CL_DEV
Generate an empty database
dart pub global run cl_dev:gen_db
Generate database PATCH from all modules patches
dart pub global run cl_dev:gen_db_update
Or combine it with database tool like this
dart pub global run cl_dev:gen_db_update | psql -ddemo
ReCreate serialization/deserialization scripts
You must be in the modules' root folder when you do that
dart run build_runner build
Tasks to do with the interface
Add a column in job or person
Add the column in entity
Add the column in database both, create.sql and patch
Add the column in the mapper for search
Rebuild serialization / deserialization scripts
Add the column in gui both in ItemBuilder and in List of items
Make a custom filter for a column in database.
For example "salary".
Follow previous dot (1)
Add text fields for minimum/maximum salary. For example
you can put them in entity for easy use or just use them as string.
Second option may lead to easy mistakes.
Add these fields into the filter in mapper - how they
are filtered and which field do they match.
Add these fields into the listing filter
If you have done everything right then it should be working.
Make different query so the Listing can load and filter names
with "like", "ilike" and sort them letter by letter.
In the mapper (CollectionBuilder()). You should use a custom
builder Object which covers both tables "person" and "job" joined
so you can filter all the fields.
Something like
select p.*, j.* from "person" as p, left join "job" as j
on j.person_id = p.person_id;
* Note: you need to use map = {} here to specify in which table
are filters located when you describe them in CollectionBuilder.
Make a different entity like JOB Title which can contain
title_id, title
Join this table's IDS to JOB by adding title_id to JOB table
Make InputLoader for the field job title
You need to add pair() method in entity
Suggest method in mapper
Suggest method in controller ( see person )
Add proper route
make a list for the new table
finally you can finish up with the InputLoader and use it
in job.