JS – $.ajax – console.error

$.ajax({
        url: '/api/products/get-all.json',
        type: 'GET',
        dataType: 'json',
        success(resp) {
            if(resp.resp.error) {
                $("#feedback").text(resp.resp.error).addClass('text-danger');
                return;
            }
            $("#feedback").text(resp.resp.success).addClass('text-success');
        },
        error(e){
           var message = "";
           if(e.responseJSON !== 'undefined') message = e.responseJSON.message;
           if(e.responseText !== 'undefined') message = e.responseText.message;
           console.log(message ); 
        }
    });

Docker Desktop – options

Przy dodawaniu nowego kontenera:

        Komputer lokalny       Docker
---------------------------------------------------
Port   :  5678 | 5679       :  5678

Volume : C:\...\n8n-data1   :  /home/node/.n8n

Zmienne:

GENERIC_TIMEZONE : Europe/Warsaw

TS               : Europe/Warsaw

Postgres – tabele

Tworzenie tabeli

CREATE TABLE users (
    id              serial  primary key,
    name            varchar(80),
    age             int,           -- how many years
    temp_hi         int,           -- high temperature
    prcp            real,          -- precipitation
    date            date
);
-- <komentarz>

DESC users – struktura tabeli users

\d+ users

Typy

int, smallint, real, double precision, char(N), varchar(N), date, time, timestamp, interval

Wstawianie danych – kopiowanie z pliku do tabeli

COPY users FROM '/home/joe/users.txt';

Postgres – komendy

Poziom klienta – terminala psql

\l[+]      - lista baz danych


\dt[+]      - lista tabel
\dp         - tabele, widoki, uprawnienia

\du     - użytkownicy / role

DESC users – struktura tabeli users

\d+ users
\dT[+]      - schema
\dO[+]      - collations
help \?
\q      - WYJŚCIE
exit
select version();

PostgreSQL 13.20 (Debian 13.20-0+deb11u1) on x86_64-pc-linux-gnu, compiled by gcc

Export z tabeli do pliku CSV

SELECT "Nazwa Firmy", "Płeć", "Imię", "Nazwisko", "Stanowisko", "Tel", "Email", "Komórka"

UNION

SELECT
  c.name,
  CASE cc.is_man WHEN 2 THEN "K" WHEN 1 THEN 'M' ELSE '-' END,
  cc.firstname, cc.lastname,
  IFNULL(cc.stanowisko, "-"), IFNULL(cc.tel, "-"), IFNULL(cc.email,"-"), IFNULL(cc.kom,"-")
FROM company_contacts cc
 INNER JOIN companies c ON c.id = cc.company_id
ORDER BY cc.company_id, cc.lastname, cc.firstname
LIMIT 20

INTO  OUTFILE '/tmp/company_contacts.csv'
      CHARACTER SET CP1250
      FIELDS ENCLOSED BY ""
      TERMINATED BY ';'
      ESCAPED BY '\\'
      LINES TERMINATED BY '\n'
;