remove pk for mysql db

Signed-off-by: lpete@vmware.com <lpete@vmware.com>
This commit is contained in:
lpete@vmware.com
2023-08-17 17:38:24 -04:00
parent ca061f5a9d
commit bfa604de33
@@ -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())