blob: 84bda7e734c7383c4d1aa764fd15bd6a13c29b05 (
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
exports.up = async knex => {
await knex.schema.createTable('users', table => {
table.increments();
table.string('uuid');
table.string('username');
table.text('password');
table.boolean('enabled');
table.boolean('isAdmin');
table.string('apiKey');
table.timestamp('passwordEditedAt');
table.timestamp('apiKeyEditedAt');
table.timestamp('createdAt');
table.timestamp('editedAt');
});
await knex.schema.createTable('albums', table => {
table.increments();
table.string('uuid');
table.integer('userId');
table.string('name');
table.timestamp('zippedAt');
table.timestamp('createdAt');
table.timestamp('editedAt');
});
await knex.schema.createTable('files', table => {
table.increments();
table.string('uuid');
table.integer('userId');
table.string('name');
table.string('original');
table.string('type');
table.integer('size');
table.string('hash');
table.string('ip');
table.timestamp('createdAt');
table.timestamp('editedAt');
});
await knex.schema.createTable('links', table => {
table.increments();
table.string('uuid');
table.integer('userId');
table.integer('albumId');
table.string('identifier');
table.integer('views');
table.boolean('enabled');
table.boolean('enableDownload');
table.timestamp('expiresAt');
table.timestamp('createdAt');
table.timestamp('editedAt');
});
await knex.schema.createTable('albumsFiles', table => {
table.increments();
table.integer('albumId');
table.integer('fileId');
});
await knex.schema.createTable('albumsLinks', table => {
table.increments();
table.integer('albumId');
table.integer('linkId');
});
await knex.schema.createTable('tags', table => {
table.increments();
table.string('uuid');
table.integer('userId');
table.string('name');
table.timestamp('createdAt');
table.timestamp('editedAt');
});
await knex.schema.createTable('fileTags', table => {
table.increments();
table.integer('fileId');
table.integer('tagId');
});
await knex.schema.createTable('bans', table => {
table.increments();
table.string('ip');
table.timestamp('createdAt');
});
};
exports.down = async knex => {
await knex.schema.dropTableIfExists('users');
await knex.schema.dropTableIfExists('albums');
await knex.schema.dropTableIfExists('files');
await knex.schema.dropTableIfExists('links');
await knex.schema.dropTableIfExists('albumsFiles');
await knex.schema.dropTableIfExists('albumsLinks');
await knex.schema.dropTableIfExists('tags');
await knex.schema.dropTableIfExists('fileTags');
await knex.schema.dropTableIfExists('bans');
};
|