Skip to content

Notes-Table: permission is an enum and it misses values #752

@ccoenen

Description

@ccoenen

I can't switch to protected or limited permissions. The setting will get accepted and is in place as long as someone has a pad open, but it is never committed to database, so the next time I open the same pad, the value is empty!

Here's why: My Notes table looks like this

MariaDB [hackmd]> show fields from Notes;
+------------------+----------------------------------------------+------+-----+---------+-------+
| Field            | Type                                         | Null | Key | Default | Extra |
+------------------+----------------------------------------------+------+-----+---------+-------+
| id               | char(36)                                     | NO   | PRI |         |       |
| shortid          | varchar(255)                                 | NO   | UNI | NULL    |       |
| alias            | varchar(255)                                 | YES  | UNI | NULL    |       |
| permission       | enum('freely','editable','locked','private') | YES  |     | NULL    |       |
| viewcount        | int(11)                                      | NO   |     | 0       |       |
| title            | text                                         | YES  |     | NULL    |       |
| content          | longtext                                     | YES  |     | NULL    |       |
| authorship       | text                                         | YES  |     | NULL    |       |
| lastchangeAt     | datetime                                     | YES  |     | NULL    |       |
| savedAt          | datetime                                     | YES  |     | NULL    |       |
| createdAt        | datetime                                     | NO   |     | NULL    |       |
| updatedAt        | datetime                                     | NO   |     | NULL    |       |
| deletedAt        | datetime                                     | YES  |     | NULL    |       |
| ownerId          | char(36)                                     | YES  |     | NULL    |       |
| lastchangeuserId | char(36)                                     | YES  |     | NULL    |       |
+------------------+----------------------------------------------+------+-----+---------+-------+

the type of permission seems wrong: the enum is missing "limited" and "protected". Can anyone else confirm this, or did I somehow break my installation?

Should this field be an enum in the first place? (the model suggests, that it is an enum).

Would there have to be a migration for that? From the currently existing migrations I would have guessed this should be a string instead (only migration to touch it appears to be update-to-0-3-1, which I probably never ran as it has been added after I installed my setup long before those "old" migrations were added. (and they obviously gave me problems while upgrading to 1.0.1-ce, as the tables and fields were already present). The feature seems to have been introduced here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdatabase/sequelizeSomehow this is related to the database or ORM

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions