在knex中迁移表:存储媒体,图像或blob
我正在尝试将关系迁移到我的postgres数据库。 问题是我不知道图像使用什么值types。
exports.up = function (knex, Promise) => { return knex.schema.createTable('observations', (table) => { table.increments(); table.integer('user_id').notNullable(); table.blob('image').notNullable(); //??? table.string('category').notNullable(); table.string('description').notNullable(); table.boolean('approved').notNullable().defaultTo(false); table.float('latitude').notNullable(); table.float('longitude').notNullable(); table.timestamp('created_at').defaultTo(knex.fn.now()); }); };
我以为会有一个“blob”文件types,但在文档中似乎没有迁移任何媒体的迹象。
请帮帮我。
看起来像table.binary
应该适合账单。
PostgreSQL数据types应该是bytea
。