mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-01 13:54:35 +03:00
Removed unique constraint from Product names (#12928)
refs https://github.com/TryGhost/Team/issues/586 A discussion in the Members team resulted in us determining that we do not need to enforce unique names for Products. Stripe does not enforce uniqueness for their Products, and we feel it's not necessary for us to.
This commit is contained in:
parent
781cc6f304
commit
e9687d359d
@ -0,0 +1,13 @@
|
||||
const {createNonTransactionalMigration} = require('../../utils');
|
||||
const {dropUnique} = require('../../../schema/commands');
|
||||
|
||||
module.exports = createNonTransactionalMigration(
|
||||
async function up(knex) {
|
||||
return await dropUnique('products', 'name', knex);
|
||||
},
|
||||
async function down() {
|
||||
// We cannot roll back this migration because adding a unique constraint
|
||||
// could error if we have duplicate names already in the table.
|
||||
return;
|
||||
}
|
||||
);
|
@ -363,7 +363,7 @@ module.exports = {
|
||||
},
|
||||
products: {
|
||||
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
|
||||
name: {type: 'string', maxlength: 191, nullable: false, unique: true},
|
||||
name: {type: 'string', maxlength: 191, nullable: false},
|
||||
slug: {type: 'string', maxlength: 191, nullable: false, unique: true},
|
||||
description: {type: 'string', maxlength: 191, nullable: true},
|
||||
created_at: {type: 'dateTime', nullable: false},
|
||||
|
@ -32,7 +32,7 @@ const defaultSettings = require('../../../../core/server/data/schema/default-set
|
||||
*/
|
||||
describe('DB version integrity', function () {
|
||||
// Only these variables should need updating
|
||||
const currentSchemaHash = 'bcb57235883ddb9765f9abf8ab878cd7';
|
||||
const currentSchemaHash = '7886f066821a240b85c6b61ba2dcff65';
|
||||
const currentFixturesHash = '8671672598d2a62e53418c4b91aa79a3';
|
||||
const currentSettingsHash = 'c202cf5780aa77d8730a82680e2b142e';
|
||||
const currentRoutesHash = '3d180d52c663d173a6be791ef411ed01';
|
||||
|
Loading…
Reference in New Issue
Block a user