exports.up = async (knex) => {
	await knex.schema.createTable('users_templates', (table) => {
		table.increments('id');

		table.integer('user_id')
			.notNullable()
			.references('id')
			.inTable('users');

		table.string('name')
			.notNullable();

		table.text('template')
			.notNullable();

		table.unique(['user_id', 'name']);

		table.datetime('created_at')
			.defaultTo(knex.fn.now());
	});
};

exports.down = async (knex) => {
	await knex.schema.dropTable('users_templates');
};