Adding a foreign key column

  • anuragkumar
    Participant
      6 years, 1 month ago #15609

      Hi Team,

      I have a table in sqlite db.

      I want to add a column which would be foreign key to a parent table.

      I have a connector with:

      mode = execute,
      request = CREATE TABLE IF NOT EXISTS project_assignee (id INTEGER PRIMARY KEY, person, role, status, project_id FOREIGN KEY REFERENCES project1 (id) )

      But the execution is failing with below error:

      {
      “message”: “[SQLITE_ERROR] SQL error or missing database (near \”FOREIGN\”: syntax error)”,
      “success”: false
      }

      Please suggest.

      anuragkumar
      Participant
        6 years, 1 month ago #15613
        Up
        1
        Down
        ::

        I found the solution as I had to modify the request as below removing the FOREIGN KEY key-word.

        CREATE TABLE IF NOT EXISTS project_assignee (id INTEGER PRIMARY KEY, person, role, status, project_id INTEGER REFERENCES project1 (id) )

      Viewing 2 posts - 1 through 2 (of 2 total)

      You must be logged in to reply to this topic.