0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-04-01 02:41:39 -05:00
ghost/core/server/data
Naz 6b61bcf123 Added unique constraint notation to schema definition
refs https://github.com/TryGhost/Ghost/issues/12567

- Introduced here @@UNIQUE_CONSTRAINTS@@ notation allows to create unique contraints over multiple database fields. This will be needed to change posts' table unique constraint from `slug` to `slug+type`.
- The notation is equivalent to SQL's: UNIQUE(column_name1,column_name2)
- Example use in schema:
posts: {
    slug: {type: 'string', maxlength: 191, nullable: false},
    type: {type: 'string', maxlength: 50, nullable: false, defaultTo: 'post', validations: {isIn: [['post', 'page']]}},
    '@@UNIQUES@@': [
        ['slug', 'type']
    ]
}
2021-02-04 13:37:20 +13:00
..
db Updated links to ghost.org sites 2021-01-20 09:59:45 +13:00
exporter Removed stripe keys and analytics data from export () 2021-01-28 14:55:54 +05:30
importer Updated links to ghost.org sites 2021-01-20 09:59:45 +13:00
migrations 🏗 Dropped apps related tables 2021-02-03 12:20:08 +13:00
schema Added unique constraint notation to schema definition 2021-02-04 13:37:20 +13:00
validation Improved settings validation () 2020-07-15 17:11:27 +02:00