Error creating table:line 1:63 no viable alternative at input 'text'

Here is my code for the Create table query

Session.Query("CREATE TABLE IF NOT EXISTS todo (id uuid PRIMARY KEY, username text UNIQUE, title text, description text, status text, created_at timestamp, updated_at timestamp);").Exec()

And i am encountering the type mismatch error-
“Connected to DB successfully
2024/02/07 11:52:34 Error creating table:line 1:63 no viable alternative at input ‘text’”
the output states that my database connection is successful but the create table query has a type mismatch. Please help

CQL does not have an UNIQUE column attribute. Remove this and you should be fine.

If you want a column to be unique, make it part of the primary key, keys are unique by definition:

  • If you need the column to be globally unique, make it part of the partition key, note that this means you will have to provide this column in all queries.
  • If you need the column to be unique in a single partition, you can make it part of the clustering key.

It worked, thanks a lot!