You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
807 B
23 lines
807 B
|
3 years ago
|
|
||
|
|
exports.up = async (knex) => {
|
||
|
|
await knex.schema.createTable('user', (table) => {
|
||
|
|
table.string('public_key').primary()
|
||
|
|
table.datetime('last_seen').notNullable()
|
||
|
|
table.binary('name').nullable()
|
||
|
|
table.binary('avatar').nullable()
|
||
|
|
})
|
||
|
|
await knex.schema.createTable('room', (table) => {
|
||
|
|
table.integer('id').primary()
|
||
|
|
table.binary('name').notNullable()
|
||
|
|
table.binary('room_key').notNullable()
|
||
|
|
table.binary('avatar').nullable()
|
||
|
|
})
|
||
|
|
await knex.schema.createTable('user_to_room', (table) => {
|
||
|
|
table.string('user_public_key').references('public_key').inTable('user').notNullable()
|
||
|
|
table.integer('room_id').references('id').inTable('room').notNullable()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
exports.down = (knex) => knex.schema.dropTable('user')
|