sqlsqlitemariadbkeydatabase-migration

Does SQLite support the keyword combination "Unique Key"?


I am trying to move a database from MariaDB to SQLite. My MariaDB database dump contains:

CREATE TABLE IF NOT EXISTS Persons (
    PersonID int,
    name varchar(255),
    LastName varchar(255),
    FirstName varchar(255),
    Address varchar(255),
    City varchar(255),
    UNIQUE KEY `ID1234567` (`name`)
)

When executing this in SQLite I get:

OperationalError: near "KEY": syntax error

SQLite table-constraint documentation shows this chart:

Chart from Documentation

How can I include these UNIQUE KEYstatements or are they not supported in SQLite? If not, what is the reason?


Solution

  • enter image description here

    SQLite supports UNIQUE but not UNIQUE KEY. Nevertheless the result is the same. I need to remove the KEY keyword from my dump to get the desired result.