Jomitt
Jomitt

Reputation: 39

Directus refuses to open my custom tables, it says You don't have permission to access this

I installed Directus on PostgreSQL. Then I created and dumped with SQL queries some twenty custom tables into the same database, where directus was already installed. Various tutorials tell that you just go in Directus to Settings / Data Model, and there your own custom tables are, firstly in grey colour. So far, so good: this much is true. I found my tables here. in somewhat grey colour.

Then the tutorials tell to click on any such table, and select which fields should be visible. Here the story gets different: if I click on a table, it shows nothing between the title "Fields & Layout - saves automatically" and the button Create Field. What should be shown in that gap, and is shown for tables created via the Directus UI, is a list of fields in this table.

If I go away from this view, the table name becomes darker in Directus, indicating that the table is now a bit more "registered" than before. The table will now also be listed on Collections page. But trying to open that Collection says: "You don't have permission to access this".


Back under Settings / Data Model, when I have clicked one of my custom tables open, what I CAN DO is set & save the archive value, unarchive value, and revision tracking setting. I can also add a collection naming translation, change the settings Hidden and Singleton, write a Note (Description), and choose an icon and colour.

Nothing else is possible -- anything that would require knowledge of what fields exist in the table. The fields are not shown above Create Field button, Display Template gives nothing to choose from, Archive Field and Sort Field are disabled with text "Select a collection", and Item Duplication Fields is empty.


Some advice around says that I should specify a Primary Key for my custom tables. I can do it directly in the database, past Directus. I have tried various tricks, such as choosing any field as Primary Key, or creating a field named "id" as Primary Key. Even using datatype UUID in it, and filling it with fake but unique UUID values. None of these tricks, including logging out and back in, change the fact that Directus refuses to open my custom tables in Collections, and all fields-related info and features are empty and disabled under Data Model.

Any ideas, what the problem is, and what to try next?

Further info: My database has one user only, which is used by Directus also, and which has full admin privileges. So the answer cannot be that the Directus user has limited privileges. Such users don't exist that have any other privileges than full db admin.

Upvotes: 1

Views: 2703

Answers (1)

Oleksandr Dovgopol
Oleksandr Dovgopol

Reputation: 11

enter image description here

I experienced the same issue and the solution got pretty straightforward.

The only thing you have to do in this case is to manually add at least one field from a new table to the directus_fields table.

After that, you can configure all other fields in one-click using Directus admin dashboard.

Upvotes: 1

Related Questions