munawir
October 18, 2022, 12:32pm
#1
Hi all
since I’ve just upgraded to 2022.9 and it’s working as expected
one of the long-waited features was physical schema (tables instead of EAV modeling)
the thing is just checked the DB tables and saw no tables for my Modules!
are there any configurations I should do? and how?
this is from the documentation
Redefined record storage
Corteza 2022.9
redefines how data is stored internally to improve performance, scalability, and flexibility . Corteza now supports the administrators to define external databases and configure dedicated, stand-alone data storage locations for modules.
I wonder what exactly is this referring to?!
1 Like
shmuel
October 18, 2022, 3:36pm
#2
@munawir ,
I also struggled with this.
Create a new module, and before saving go into the “data store” tab. There you can set all of the column types to “Column” instead of “JSON” and the “collection or database table name” to a value that you choose. I’ve been using the template value {{module}}
for all of my tables.
But be warned, as of the time of this post, support for physcial tables is not fully baked. You can see a list of bugs that I’ve filed on the github issues page
To be more explicit, these are the relevant issues as of today.
opened 10:04AM - 10 Oct 22 UTC
bug
**Describe the bug**
Adding a new module field after module is created doesn't … do anything and doesn't report any issues.
**To Reproduce**
1. Set module data store to a non-default value. Save.
2. Add a new field and set type to column
3. See that the field is added to the module page as well as record page layout.
4. Editing and saving content in the field is a no-op with no error reported
**Expected behavior**
Field is created in DB and data is saved. Or at the very least a detailed error is shown with instructions on how to work around current limitations.
**Screenshots**
See video for full flow. The DB previewer I'm using is Jetbrains.
https://user-images.githubusercontent.com/19151369/194841870-e2a5e56f-25b4-4a05-8544-cc6513a14e1c.mp4
opened 08:03AM - 13 Oct 22 UTC
**Describe the bug**
I'm getting the error:
```
pq: zero-length delimited i… dentifier at or near """"
```
The full log error from the DB is
```
corteza_db_1 | 2022-10-13 07:59:35.860 UTC [52654] ERROR: zero-length delimited identifier at or near """" at character 28
corteza_db_1 | 2022-10-13 07:59:35.860 UTC [52654] STATEMENT: CREATE TABLE IF NOT EXISTS "" (
corteza_db_1 | "Phone" TEXT NOT NULL
corteza_db_1 | , "LastOutreachAttemptStatus" TEXT NOT NULL
corteza_db_1 | , "BusinessName" TEXT NOT NULL
corteza_db_1 | , "id" BIGINT NOT NULL
corteza_db_1 | , "rel_module" BIGINT NOT NULL
corteza_db_1 | , "deleted_by" BIGINT NULL
corteza_db_1 | , "rel_namespace" BIGINT NOT NULL
corteza_db_1 | , "revision" BIGINT NOT NULL
corteza_db_1 | , "meta" JSONB NOT NULL
corteza_db_1 | , "owned_by" BIGINT NOT NULL
corteza_db_1 | , "created_at" TIMESTAMP(0) NOT NULL
corteza_db_1 | , "created_by" BIGINT NOT NULL
corteza_db_1 | , "updated_at" TIMESTAMP(0) NULL
corteza_db_1 | , "updated_by" BIGINT NULL
corteza_db_1 | , "deleted_at" TIMESTAMP(0) NULL
corteza_db_1 | )
```
**To Reproduce**
Leave handle as an empty value
**Expected behavior**
Client side exception. Currently I have to go into the DB and do module cleanup in order to fix.
opened 08:14AM - 13 Oct 22 UTC
**Is your feature request related to a problem? Please describe.**
I want to us… e native postgres columns. When choosing `Select / dropdown` as the field type, I get the following error:
`could not convert attribute "Status" to column: unsupported column type: corteza::dal:attribute-type:enum`
**Describe the solution you'd like**
Support postgres enums
**Describe alternatives you've considered**
1. Use JSON for dropdowns.
2. Use a record selector (currently doesn't work - see [here](https://forum.cortezaproject.org/t/record-selection-not-working/1084?u=shmuel) )
3. Manually muck around with the DB
opened 05:35PM - 13 Oct 22 UTC
**Describe the bug**
When setting a field to "not required", it still received … a `not null` constraint in postgres
**To Reproduce**
Steps to reproduce the behavior:
1. Create a field that's not required
2. Try to create a record without populating the 'not required' field
3. Get DB error
**Expected behavior**
`not required` translated to no `not null` constraint being applied to the column
**Screenshots**
Definition of the module (I also tried checking and unchecking before the initial saving of the module, to no effect)
![image](https://user-images.githubusercontent.com/19151369/195666274-62303fac-7ef8-40c1-b1f5-de2bd5303d5f.png)
**Additional context**
Generated definition (retreived from goland IDE)
```
-- auto-generated definition
create table "Parent"
(
"Name" text not null,
id bigint not null,
rel_module bigint not null,
deleted_by bigint,
rel_namespace bigint not null,
revision bigint not null,
meta jsonb not null,
owned_by bigint not null,
created_at timestamp(0) not null,
created_by bigint not null,
updated_at timestamp(0),
updated_by bigint,
deleted_at timestamp(0)
);```
opened 05:48PM - 13 Oct 22 UTC
**Describe the bug**
When adding a number intput field the following error is r… eceived
`pq: NUMERIC precision 0 must be between 1 and 1000`
**To Reproduce**
Add a number input field and try to save (make sure type is physical table)
**Expected behavior**
Has a clear default, or gives a client/server error. Not DB error.
**Screenshots**
![image](https://user-images.githubusercontent.com/19151369/195669033-624464eb-e8f0-4f65-95f1-699abe022803.png)
![image](https://user-images.githubusercontent.com/19151369/195668884-8e21c680-a4eb-4606-8e0e-e9c5627a540d.png)
**Additional context**
If you go into field settings and change the precision to any value (even if you set it back to the original value), it works again.
opened 02:03PM - 14 Oct 22 UTC
**Describe the bug**
When trying to save a record after having selected a relat… ed record, the server returns an error that the record is not found.
**To Reproduce**
1. Set up two modules (both physical), A and B
2. Make a record selector field on B point to A
3. Create an A record
4. Try creating a B record point to A
**Expected behavior**
Record saves normally.
**Additional context**
This [forum post](https://forum.cortezaproject.org/t/record-selection-not-working/1084?u=shmuel) has more information
1 Like
munawir
October 18, 2022, 4:43pm
#3
thank you @shmuel for sharing
I’ve tried it but no luck for me, each time I save a from data store tap I got issues
and nothing changed in DB however the records disappeared from the record-list page !!!
(I guess a broken migration … this should have a fallback scenario)
appreciate an explanation for these messages?
and how the migration happened… I mean of an existing module with more than 100K records how that’s going to happen?
shmuel
October 18, 2022, 5:27pm
#4
Two issues here are that
you can’t convert a table from non physical to physical (I’m not sure if that’s a bug, maybe file an issue on github).
Dropdowns aren’t currently supported. (see here for the feature request)
You’re observing the ‘not fully baked’ description I noted above .
1 Like
tjerman
October 20, 2022, 6:08am
#5
shmuel:
you can’t convert a table from non physical to physical (I’m not sure if that’s a bug, maybe file an issue on github).
This is somewhat supported but probably not what you’d like – you can connect existing modules to dedicated tables, but the records won’t be automatically migrated.
We will be adding some sort of a migration option but it’s not there yet.
As for the rest of the issues reported by @shmuel we’re working on those; thank you for reporting!
2 Likes
shmuel
October 20, 2022, 9:15am
#6
Thanks @tjerman
@munawir some critical issues have been addressed. The next release will be a smoother ride.
munawir
October 20, 2022, 9:29am
#7
thanks @tjerman and good luck
@shmuel my production instance still using 2022.3.5
I won’t upgrade it till it’s stable (as you said fully backed)
will wait for the next release and try it with a testing environment
1 Like