❯ grpcurl -plaintext -d '{}' localhost:50051 komp_ac.table_definition.TableDefinition/GetProfileTree
{
  "profiles": [
    {
      "name": "default",
      "tables": [
        {
          "name": "2025_adresar3"
        },
        {
          "name": "2025_adresar2"
        },
        {
          "name": "2025_adresar"
        },
        {
          "name": "2025_adresar5"
        },
        {
          "name": "2025_adresar4"
        }
      ]
    }
  ]
}
❯ grpcurl -plaintext -d '{
  "table_name": "adresar6",
  "columns": [
    {"name": "firma", "field_type": "text"},
    {"name": "kz", "field_type": "text"},
    {"name": "drc", "field_type": "text"},
    {"name": "ulica", "field_type": "text"},
    {"name": "psc", "field_type": "psc"},
    {"name": "mesto", "field_type": "text"},
    {"name": "stat", "field_type": "text"},
    {"name": "banka", "field_type": "text"},
    {"name": "ucet", "field_type": "text"},
    {"name": "skladm", "field_type": "text"},
    {"name": "ico", "field_type": "text"},
    {"name": "kontakt", "field_type": "text"},
    {"name": "telefon", "field_type": "phone"},
    {"name": "skladu", "field_type": "text"},
    {"name": "fax", "field_type": "text"}
  ],
  "indexes": ["firma", "mesto"],
  "profile_name": "default"
}' localhost:50051 komp_ac.table_definition.TableDefinition/PostTableDefinition
{
  "success": true,
  "sql": "CREATE TABLE \"2025_adresar6\" (\n    id BIGSERIAL PRIMARY KEY,\n    deleted BOOLEAN NOT NULL DEFAULT FALSE,\n    \"firma\" TEXT,\n    \"kz\" TEXT,\n    \"drc\" TEXT,\n    \"ulica\" TEXT,\n    \"psc\" TEXT,\n    \"mesto\" TEXT,\n    \"stat\" TEXT,\n    \"banka\" TEXT,\n    \"ucet\" TEXT,\n    \"skladm\" TEXT,\n    \"ico\" TEXT,\n    \"kontakt\" TEXT,\n    \"telefon\" VARCHAR(15),\n    \"skladu\" TEXT,\n    \"fax\" TEXT,\n    created_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP\n)\nCREATE INDEX idx_2025_adresar6_firma ON \"2025_adresar6\" (\"firma\")\nCREATE INDEX idx_2025_adresar6_mesto ON \"2025_adresar6\" (\"mesto\")"
}
❯ grpcurl -plaintext -d '{}' localhost:50051 komp_ac.table_definition.TableDefinition/GetProfileTree
{
  "profiles": [
    {
      "name": "default",
      "tables": [
        {
          "name": "2025_adresar2"
        },
        {
          "name": "2025_adresar3"
        },
        {
          "name": "2025_adresar"
        },
        {
          "name": "2025_adresar6"
        },
        {
          "name": "2025_adresar4"
        },
        {
          "name": "2025_adresar5"
        }
      ]
    }
  ]
}

❯ psql -U multi_psql_dev -d multi_rust_dev

psql (17.2)
Type "help" for help.

multi_rust_dev=> \dt
                  List of relations
 Schema |       Name        | Type  |     Owner
--------+-------------------+-------+----------------
 public | 2025_adresar      | table | multi_psql_dev
 public | 2025_adresar2     | table | multi_psql_dev
 public | 2025_adresar5     | table | multi_psql_dev
 public | 2025_adresar6     | table | multi_psql_dev
 public | _sqlx_migrations  | table | multi_psql_dev
 public | adresar           | table | multi_psql_dev
 public | profiles          | table | multi_psql_dev
 public | table_definitions | table | multi_psql_dev
 public | table_scripts     | table | multi_psql_dev
 public | uctovnictvo       | table | multi_psql_dev
(10 rows)

multi_rust_dev=> \d "2025_adresar6";
                                        Table "public.2025_adresar6"
   Column   |           Type           | Collation | Nullable |                   Default
------------+--------------------------+-----------+----------+---------------------------------------------
 id         | bigint                   |           | not null | nextval('"2025_adresar6_id_seq"'::regclass)
 deleted    | boolean                  |           | not null | false
 firma      | text                     |           |          |
 kz         | text                     |           |          |
 drc        | text                     |           |          |
 ulica      | text                     |           |          |
 psc        | text                     |           |          |
 mesto      | text                     |           |          |
 stat       | text                     |           |          |
 banka      | text                     |           |          |
 ucet       | text                     |           |          |
 skladm     | text                     |           |          |
 ico        | text                     |           |          |
 kontakt    | text                     |           |          |
 telefon    | character varying(15)    |           |          |
 skladu     | text                     |           |          |
 fax        | text                     |           |          |
 created_at | timestamp with time zone |           |          | CURRENT_TIMESTAMP
Indexes:
    "2025_adresar6_pkey" PRIMARY KEY, btree (id)
    "idx_2025_adresar6_firma" btree (firma)
    "idx_2025_adresar6_mesto" btree (mesto)

multi_rust_dev=>








grpcurl -plaintext -d '{
  "table_name": "project_management4",
  "columns": [
    {"name": "project_name", "field_type": "text"},
    {"name": "description", "field_type": "text"},
    {"name": "budget", "field_type": "text"},
    {"name": "is_active", "field_type": "boolean"},
    {"name": "deadline", "field_type": "timestamp"}
  ],
  "indexes": ["project_name", "is_active", "deadline"],
  "profile_name": "default",
  "links": [
    {"linked_table_name": "2025_customer", "required": true},
    {"linked_table_name": "2025_product", "required": false},
    {"linked_table_name": "2025_author", "required": true},
    {"linked_table_name": "2025_order", "required": false},
    {"linked_table_name": "2025_shipping_provider", "required": false},
    {"linked_table_name": "2025_ecom_product", "required": false}
  ]
}' localhost:50051 komp_ac.table_definition.TableDefinition/PostTableDefinition
