Skip to content

Instantly share code, notes, and snippets.

@julioflima
Last active September 6, 2020 12:04
Show Gist options
  • Save julioflima/e686a8c00cec0d9be9655fdd5154f5b4 to your computer and use it in GitHub Desktop.
Save julioflima/e686a8c00cec0d9be9655fdd5154f5b4 to your computer and use it in GitHub Desktop.
Migrations using Query Builder Knex.
exports.up = (knex) => {
return knex.schema.createTable('sensor', (table) => {
table.string('id').primary();
table.bigInteger('timestamp').notNullable().primary();
table.string('date').notNullable();
table.string('name').notNullable();
table.float('value').notNullable();
});
};
exports.down = (knex) => {
return knex.schema.dropTable('sensor');
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment