add knex migration to create pg tables
parent
666cbccea0
commit
9ddc8ff271
|
@ -0,0 +1,4 @@
|
|||
module.exports = {
|
||||
client: 'pg',
|
||||
connection: 'postgresql://devdbo:password@roe-db-dev.cw5d6ibguemf.us-east-2.rds.amazonaws.com:5432/roedev'
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
exports.up = function (knex, Promise) {
|
||||
return Promise.all([
|
||||
knex.schema.createTable('user', t => {
|
||||
t.increments('id').primary()
|
||||
t.string('email').notNullable()
|
||||
t.timestamps()
|
||||
}),
|
||||
knex.schema.createTable('passport', t => {
|
||||
t.increments('id').primary()
|
||||
t.string('protocol').notNullable()
|
||||
t.string('password')
|
||||
t.string('accesstoken')
|
||||
t.string('provider')
|
||||
t.string('identifier')
|
||||
t.json('tokens')
|
||||
t.integer('user').notNullable().references('user.id')
|
||||
t.timestamps()
|
||||
}),
|
||||
knex.schema.createTable('targeturl', t => {
|
||||
t.increments('id').primary()
|
||||
t.integer('user').notNullable().references('user.id')
|
||||
t.string('url')
|
||||
t.timestamps()
|
||||
}),
|
||||
knex.schema.createTable('book', t => {
|
||||
t.increments('id').primary()
|
||||
t.string('source')
|
||||
t.string('storage')
|
||||
t.string('title').notNullable()
|
||||
t.string('author')
|
||||
t.string('version')
|
||||
t.string('isbn')
|
||||
t.timestamps()
|
||||
})
|
||||
])
|
||||
}
|
||||
|
||||
exports.down = function (knex, Promise) {
|
||||
return Promise.all([
|
||||
knex.schema.dropTable('book'),
|
||||
knex.schema.dropTable('targeturl'),
|
||||
knex.schema.dropTable('passport'),
|
||||
knex.schema.dropTable('user')
|
||||
])
|
||||
}
|
|
@ -14,6 +14,7 @@
|
|||
"eslint-plugin-react": "^7.11.1",
|
||||
"express-rate-limit": "^3.2.1",
|
||||
"grunt": "^1.0.3",
|
||||
"knex": "^0.15.2",
|
||||
"passport": "^0.4.0",
|
||||
"passport-github2": "^0.1.11",
|
||||
"passport-google-oauth20": "^1.0.0",
|
||||
|
|
Loading…
Reference in New Issue