blob: e714520b30a0f6d009aa803075f77fb76e04e017 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
exports.up = function(knex) {
return Promise.all([
// alter table invoices add foreign key (user_id) references users (id);
// alter table invoices add foreign key (account_id) references accounts (id);
knex.schema.alterTable("invoices", function(t) {
t.foreign('user_id').references('users.id')
t.foreign('account_id').references('accounts.id')
t.index('updatedAt')
}),
// alter table payments add foreign key (user_id) references users (id);
// alter table payments add foreign key (account_id) references accounts (id);
knex.schema.alterTable("payments", function(t) {
t.foreign('user_id').references('users.id')
t.foreign('account_id').references('accounts.id')
t.index('updatedAt')
}),
// alter table orders add foreign key (user_id) references users (id);
// alter table orders add foreign key (a1_id) references accounts (id);
// alter table orders add foreign key (a2_id) references accounts (id);
knex.schema.alterTable("orders", function(t) {
t.foreign('user_id').references('users.id')
t.foreign('a1_id').references('accounts.id')
t.foreign('a2_id').references('accounts.id')
t.index('updatedAt')
}),
// alter table deposits add foreign key (user_id) references users (id)
knex.schema.alterTable("deposits", function(t) {
t.foreign('user_id').references('users.id')
t.index('updatedAt')
}),
// alter table withdrawals add foreign key (user_id) references users (id)
knex.schema.alterTable("withdrawals", function(t) {
t.foreign('user_id').references('users.id')
t.index('updatedAt')
}),
])
}
exports.down = function(knex) {
}
|