Postgres: Reference Field

Wappler Version : 3.81.
Operating System : Mac OS
Server Model: Node.js
Database Type: Postgres
Hosting Type: Docker

Expected behavior

What do you think should happen?

When create a reference field, Wappler should create a Knex migration with the fields references

Actual behavior

What actually happens?

References are not created on database

How to reproduce

  1. Create 2 tables, with a 1-N relation and apply changes
  2. Edit the child table, adding reference to FK
  3. Check the database using any third party software (I’m using Postbird), the references are not being applied
  4. Check Knex migration

Table structure after adding references via Wappler

Wappler Knex generated script:

exports.up = function(knex) {
  return knex.schema
.table('public.job_jobtype', function (table) {
  table.integer('job_id', 255).alter().unsigned();
  table.integer('jobtype_id', 255).alter().unsigned();
})
};

exports.down = function(knex) {
  return knex.schema
.table('public.job_jobtype', function (table) {
  table.integer('job_id', 255).alter();
  table.integer('jobtype_id', 255).alter();
})
};

@Teodor am I making something wrong?

@George still not working with 3.8.2!
Rename table doesn’t work as well…

In general you should avoid renaming things - as it will break relations, keys and code you already have.

Same is also for reference fields - try to add them initially and not afterwards changing type of existing fields. Many databases will break if you do so.

I’ll give a try!

This has been fixed in Wappler 4.7.1

1 Like

This topic was automatically closed after 46 hours. New replies are no longer allowed.