remove pk for mysql db
Signed-off-by: lpete@vmware.com <lpete@vmware.com>
This commit is contained in:
@@ -20,15 +20,21 @@
|
||||
* @param {import('knex').Knex} knex
|
||||
*/
|
||||
exports.up = async function up(knex) {
|
||||
const isMySQL = knex.client.config.client.includes('mysql');
|
||||
return knex.schema.createTable('static_assets_cache', table => {
|
||||
table.comment(
|
||||
'A cache of static assets that where previously deployed and may still be lazy-loaded by clients',
|
||||
);
|
||||
table
|
||||
.text('path', 'text')
|
||||
.unique()
|
||||
.notNullable()
|
||||
.comment('The path of the file');
|
||||
if (!isMySQL) {
|
||||
table
|
||||
.text('path')
|
||||
.primary()
|
||||
.notNullable()
|
||||
.comment('The path of the file');
|
||||
} else {
|
||||
// cannot have a unique key in mysql with a text column greater than 733 bytes
|
||||
table.text('path').notNullable().comment('The path of the file');
|
||||
}
|
||||
table
|
||||
.dateTime('last_modified_at')
|
||||
.defaultTo(knex.fn.now())
|
||||
|
||||
Reference in New Issue
Block a user