Ghost/core/server/data/schema
Katharina Irrgang 2e1d7fcc42 🚨 database: change hard limits and field types (#7932)
refs #7432

🚨  database: change hard limits and field types

- we went over all schema fields and decided to decrease/increase the hard limits
- the core goal is to have more flexibility in the future
- we reconsidered string vs. text

There are 5 groups:

- small strings: 50 characters
    - static strings
    - status, visibility, language, role name, permission name, client name etc.
- medium strings: 191 characters
    - all unique fields or fields which can be unique in the future
    - slug, tokens, user name, password, tag name, email
- large strings: 1000-2000 characters
    - these fields need to be very flexible
    - these fields get a soft limit attached (in a different PR)
    - post title, meta title, meta description, urls
- medium text: 64kb characters
    - bio, settings, location, tour
- long text: 1000000000 chars
    - html, amp, mobiledoc, markdown

🙄  sort_order for tests

- sort order was not set for the tests, so it was always 0
- mysql could return a different result

in my case:
- field length 156 returned the following related tags ["bacon", "kitchen"]
- field length 157 returned the following related tags ["kitchen", "kitchen"]

Change client.secret to 191

Tweak field lengths

- Add 24 char limit for ids
- Limited fields are the exact length they need
- Unified 1000 and 2000 char string classes to all be 2000
- Changed descriptions to be either 2000, except user & tag which is text 65535 as these may be used to store HTML later?!
- Updated tests

🛠  Update importer tests

- The old 001-003 tests are kind of less relevant now.
- Rather than worrying about past versions of the data structure, we should check that the importer only imports what we consider to be valid data
- I've changed the tests to treat the title-length check as a length-validation check, rather than a test for each of the old versions

🔥 Remove foreign key from subscribers.post_id

- There's no real need to have an index on this column, it just makes deleting posts hard.
- Same as created_by type columns, we can reference ids without needing keys/indexes
2017-02-17 23:20:59 +01:00
..
clients 🔥 remove postgres support 2016-09-20 15:59:34 +01:00
fixtures 🐛 re-run init migrations protection (#7899) 2017-01-25 22:08:09 +01:00
backup.js knex-migrator v2 (#7605) 2016-11-07 11:39:49 +00:00
checks.js Reorganise & rename server/data/ folder internals 2016-02-04 20:39:15 +00:00
commands.js replace auto increment id's by object id (#7495) 2016-11-17 09:09:11 +00:00
default-settings.json 🔥 remove database version (#7894) 2017-01-26 12:12:00 +00:00
index.js 🔥 remove database version (#7894) 2017-01-26 12:12:00 +00:00
schema.js 🚨 database: change hard limits and field types (#7932) 2017-02-17 23:20:59 +01:00