forked from bloominstituteoftechnology/node-db2-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
41 additions
and
6,988 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,19 @@ | ||
const db = require('../../data/db-config.js'); | ||
|
||
const getAll = () => { | ||
// DO YOUR MAGIC | ||
} | ||
return db('cars'); | ||
}; | ||
|
||
const getById = (id) => { | ||
return db('cars').where({ id }).first(); | ||
}; | ||
|
||
const getById = () => { | ||
// DO YOUR MAGIC | ||
} | ||
const create = (car) => { | ||
return db('cars').insert(car); | ||
}; | ||
|
||
const create = () => { | ||
// DO YOUR MAGIC | ||
} | ||
module.exports = { | ||
getAll, | ||
getById, | ||
create, | ||
}; |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,15 @@ | ||
exports.up = function (knex) { | ||
// DO YOUR MAGIC | ||
return knex.schema.createTable('cars', (tbl) => { | ||
tbl.increments(); | ||
tbl.text('vin', 128).unique().notNullable(); | ||
tbl.text('make', 128).notNullable(); | ||
tbl.text('model', 128).notNullable(); | ||
tbl.decimal('mileage').notNullable(); | ||
tbl.text('title', 128); | ||
tbl.text('transmission', 128); | ||
}); | ||
}; | ||
|
||
exports.down = function (knex) { | ||
// DO YOUR MAGIC | ||
return knex.schema.dropTableIfExists('cars'); | ||
}; |
Oops, something went wrong.