jet icon indicating copy to clipboard operation
jet copied to clipboard

Generating schema Fails

Open safaci2000 opened this issue 1 year ago • 6 comments
trafficstars

Describe the bug The code generator should fail if datamodel contains reserved fields.

There is a collision with the way the code is constructed, because postgres.Table exposes TalbeName() and the table contains a field named TableName the code does not compile.

Environment (please complete the following information):

  • OS: mac os X
  • Database: postgres
  • Database driver: pgx
  • Jet version: master

Code snippet

create schema audit;
drop table if exists audit.audit_actions;
create table audit.audit_actions
(
    schema_name text not null,
    table_name text not null,
    trx_id text default txid_current(),
    user_name text,
    app_user text,
    action TEXT NOT NULL,
    old_data jsonb,
    new_data jsonb,
    query text,
    creation_date timestamp with time zone DEFAULT now() NOT NULL
) with (fillfactor=100);

Expected behavior Generated code to compile successfully or fail hard on the generation and provide context on the reason for the failure

safaci2000 avatar Oct 08 '24 15:10 safaci2000