payload icon indicating copy to clipboard operation
payload copied to clipboard

relationship field causes no such table error

Open aniljbhatia opened this issue 6 months ago • 0 comments

Link to reproduction

No response

Payload Version

3.0.0-beta.90

Node Version

21.2.0

Next.js Version

15.0.0-rc.0

Describe the Bug

Using the SQLite adaptor I added a relationship field to another collection. The field shows correctly in the UI but when I try to save data in the field I get "Something went wrong". The console says "LibsqlError: SQLITE_ERROR: no such table: main.__old_push_tags"

Reproduction Steps

Tags Collection

import type { CollectionConfig } from 'payload';

export const Tags: CollectionConfig = {
  slug: 'tags',
  access: {
    read: () => true,
  },
  admin: {
    useAsTitle: 'tag',
  },
  fields: [
    {
      name: 'tag',
      type: 'text',
      required: true,
    },
    {
      name: 'section',
      type: 'select',
      required: true,
      options: [
        { value: 'skills', label: 'Skills' },
        { value: 'interests', label: 'Interests' },
        { value: 'learning', label: 'Learning' },
      ],
    },
    {
      name: 'displayOrder',
      type: 'number',
      required: true,
      defaultValue: 1
    },
  ]
}

Jobs Collection Field

{
        name: 'tags',
        type: 'relationship',
        relationTo: 'tags',
        hasMany: true,
        required: true,
        admin: {
            sortOptions: 'tag',
        },
}

Adapters and Plugins

db-sqlite

aniljbhatia avatar Aug 22 '24 22:08 aniljbhatia