Add remotedev_users
schema and relations
This commit is contained in:
parent
6f202e7715
commit
45482098d7
@ -18,9 +18,9 @@ exports.up = function(knex, Promise) {
|
|||||||
table.timestamp('added');
|
table.timestamp('added');
|
||||||
table.uuid('appId')
|
table.uuid('appId')
|
||||||
.references('id')
|
.references('id')
|
||||||
.inTable('remotedev_apps');
|
.inTable('remotedev_apps')
|
||||||
|
.defaultTo('78626c31-e16b-4528-b8e5-f81301b627f4');
|
||||||
}),
|
}),
|
||||||
|
|
||||||
knex.schema.createTable('remotedev_payloads', function(table){
|
knex.schema.createTable('remotedev_payloads', function(table){
|
||||||
table.uuid('id').primary();
|
table.uuid('id').primary();
|
||||||
table.text('state');
|
table.text('state');
|
||||||
@ -30,13 +30,34 @@ exports.up = function(knex, Promise) {
|
|||||||
.references('id')
|
.references('id')
|
||||||
.inTable('remotedev_reports');
|
.inTable('remotedev_reports');
|
||||||
}),
|
}),
|
||||||
|
|
||||||
knex.schema.createTable('remotedev_apps', function(table){
|
knex.schema.createTable('remotedev_apps', function(table){
|
||||||
table.uuid('id').primary();
|
table.uuid('id').primary();
|
||||||
table.string('title');
|
table.string('title');
|
||||||
table.string('description');
|
table.string('description');
|
||||||
table.string('url');
|
table.string('url');
|
||||||
table.timestamps();
|
table.timestamps();
|
||||||
|
}),
|
||||||
|
knex.schema.createTable('remotedev_users', function(table){
|
||||||
|
table.uuid('id').primary();
|
||||||
|
table.string('name');
|
||||||
|
table.string('login');
|
||||||
|
table.string('email');
|
||||||
|
table.string('avatarUrl');
|
||||||
|
table.string('profileUrl');
|
||||||
|
table.string('oauthId');
|
||||||
|
table.string('oauthType');
|
||||||
|
table.string('token');
|
||||||
|
table.timestamps();
|
||||||
|
}),
|
||||||
|
knex.schema.createTable('remotedev_users_apps', function(table){
|
||||||
|
table.boolean('readOnly').defaultTo(false);
|
||||||
|
table.uuid('userId');
|
||||||
|
table.uuid('appId');
|
||||||
|
table.foreign('userId')
|
||||||
|
.references('id').inTable('remotedev_users').onDelete('CASCADE').onUpdate('CASCADE');
|
||||||
|
table.foreign('appId')
|
||||||
|
.references('id').inTable('remotedev_apps').onDelete('CASCADE').onUpdate('CASCADE');
|
||||||
|
table.primary(['userId', 'appId']);
|
||||||
})
|
})
|
||||||
])
|
])
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user