@nina-protocol/nina-db 0.0.90 → 0.0.92
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/knexfile.js +38 -3
- package/src/migrations/20250423215722_hubs_collaborators_permissions.js +21 -0
- package/src/migrations/20250424215722_hubs_collaborators_added_by.js +19 -0
- package/yarn-error.log +6817 -0
- package/dist/index.js +0 -30
- package/dist/knexfile.js +0 -43
- package/dist/migrations/20220815134115_initial_migration.js +0 -211
- package/dist/migrations/20220930214430_add_subscriptions.js +0 -23
- package/dist/migrations/20221010170539_add_hub_data_uri.js +0 -15
- package/dist/migrations/20221010185734_add_transactions.js +0 -58
- package/dist/migrations/20221012230835_add_verifications.js +0 -31
- package/dist/migrations/20221201221013_add_hub_releases_visible.js +0 -15
- package/dist/migrations/20221206184748_add_gate.js +0 -29
- package/dist/migrations/20230104184351_add_verification_active.js +0 -15
- package/dist/migrations/20230306215838_add_hub_updated_at.js +0 -15
- package/dist/migrations/20231011163511_add_release_slug.js +0 -15
- package/dist/migrations/20231031200532_add_profile.js +0 -18
- package/dist/migrations/20231112031914_post_version.js +0 -15
- package/dist/migrations/20231116215117_add_tags.js +0 -40
- package/dist/migrations/20240131143626_release_price.js +0 -16
- package/dist/migrations/20240304143626_fix_tags_content.js +0 -31
- package/dist/migrations/20240321155034_hide_release.js +0 -15
- package/dist/migrations/20240821155034_release_hidden_to_archived.js +0 -18
- package/dist/migrations/20241121155034_subscription_public_key_nullable.js +0 -15
- package/dist/migrations/20250120215722_add_ref_columns.js +0 -18
- package/dist/models/Account.js +0 -122
- package/dist/models/Exchange.js +0 -62
- package/dist/models/Hub.js +0 -86
- package/dist/models/Post.js +0 -84
- package/dist/models/Release.js +0 -282
- package/dist/models/Subscription.js +0 -57
- package/dist/models/Tag.js +0 -39
- package/dist/models/TagsReleases.js +0 -17
- package/dist/models/Transaction.js +0 -148
- package/dist/models/Verification.js +0 -50
- package/dist/models/index.js +0 -21
- package/dist/seeds/1_accounts_profile.js +0 -22
- package/dist/utils/index.js +0 -45
package/dist/index.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import "dotenv/config.js";
|
|
2
|
-
import Knex from 'knex';
|
|
3
|
-
import { Model } from 'objection';
|
|
4
|
-
import Models from './models/index.js';
|
|
5
|
-
import knexConfig from './knexfile.js';
|
|
6
|
-
export const initDb = async (config) => {
|
|
7
|
-
const db = Knex(config.development);
|
|
8
|
-
await db.raw(`SELECT 'CREATE DATABASE ${process.env.POSTGRES_DATABASE}'
|
|
9
|
-
WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = '${process.env.POSTGRES_DATABASE}')`);
|
|
10
|
-
await db.migrate.latest();
|
|
11
|
-
Model.knex(db);
|
|
12
|
-
};
|
|
13
|
-
export const destroyDb = async () => {
|
|
14
|
-
const db = Knex(knexConfig.development);
|
|
15
|
-
await db.destroy();
|
|
16
|
-
};
|
|
17
|
-
export const connectDb = async () => {
|
|
18
|
-
const db = Knex(knexConfig.development);
|
|
19
|
-
Model.knex(db);
|
|
20
|
-
};
|
|
21
|
-
export const Account = Models.Account;
|
|
22
|
-
export const Exchange = Models.Exchange;
|
|
23
|
-
export const Hub = Models.Hub;
|
|
24
|
-
export const Post = Models.Post;
|
|
25
|
-
export const Release = Models.Release;
|
|
26
|
-
export const Subscription = Models.Subscription;
|
|
27
|
-
export const Tag = Models.Tag;
|
|
28
|
-
export const Transaction = Models.Transaction;
|
|
29
|
-
export const Verification = Models.Verification;
|
|
30
|
-
export const config = knexConfig;
|
package/dist/knexfile.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @type { Object.<string, import("knex").Knex.Config> }
|
|
3
|
-
*/
|
|
4
|
-
import "dotenv/config.js";
|
|
5
|
-
export default {
|
|
6
|
-
development: {
|
|
7
|
-
client: 'postgresql',
|
|
8
|
-
connection: {
|
|
9
|
-
host: process.env.POSTGRES_HOST,
|
|
10
|
-
database: process.env.POSTGRES_DATABASE,
|
|
11
|
-
user: process.env.POSTGRES_USER,
|
|
12
|
-
password: process.env.POSTGRES_PASSWORD,
|
|
13
|
-
},
|
|
14
|
-
migrations: {
|
|
15
|
-
directory: './node_modules/@nina-protocol/nina-db/dist/migrations',
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
staging: {
|
|
19
|
-
client: 'postgresql',
|
|
20
|
-
connection: {
|
|
21
|
-
host: process.env.POSTGRES_HOST,
|
|
22
|
-
database: process.env.POSTGRES_DATABASE,
|
|
23
|
-
user: process.env.POSTGRES_USER,
|
|
24
|
-
password: process.env.POSTGRES_PASSWORD,
|
|
25
|
-
},
|
|
26
|
-
migrations: {
|
|
27
|
-
directory: './node_modules/@nina-protocol/nina-db/dist/migrations',
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
production: {
|
|
31
|
-
client: 'postgresql',
|
|
32
|
-
connection: {
|
|
33
|
-
host: process.env.POSTGRES_HOST,
|
|
34
|
-
database: process.env.POSTGRES_DATABASE,
|
|
35
|
-
user: process.env.POSTGRES_USER,
|
|
36
|
-
password: process.env.POSTGRES_PASSWORD,
|
|
37
|
-
},
|
|
38
|
-
migrations: {
|
|
39
|
-
directory: './node_modules/@nina-protocol/nina-db/dist/migrations',
|
|
40
|
-
},
|
|
41
|
-
debug: true,
|
|
42
|
-
}
|
|
43
|
-
};
|
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @param { import("knex").Knex } knex
|
|
3
|
-
* @returns { Promise<void> }
|
|
4
|
-
*/
|
|
5
|
-
export const up = function (knex) {
|
|
6
|
-
return Promise.all([
|
|
7
|
-
knex.schema.createTable('accounts', table => {
|
|
8
|
-
table.increments('id').primary();
|
|
9
|
-
table.string('publicKey').unique().notNullable();
|
|
10
|
-
}),
|
|
11
|
-
knex.schema.createTable('hubs', table => {
|
|
12
|
-
table.increments('id').primary();
|
|
13
|
-
table.string('publicKey').unique().notNullable();
|
|
14
|
-
table.string('handle').notNullable();
|
|
15
|
-
table.json('data').notNullable();
|
|
16
|
-
table.string('datetime').notNullable();
|
|
17
|
-
table.integer('authorityId')
|
|
18
|
-
.notNullable()
|
|
19
|
-
.unsigned()
|
|
20
|
-
.references('id')
|
|
21
|
-
.inTable('accounts')
|
|
22
|
-
.onDelete('SET NULL')
|
|
23
|
-
.index();
|
|
24
|
-
}),
|
|
25
|
-
knex.schema.createTable('posts', table => {
|
|
26
|
-
table.increments('id').primary();
|
|
27
|
-
table.string('publicKey').unique().notNullable();
|
|
28
|
-
table.json('data').notNullable();
|
|
29
|
-
table.string('datetime').notNullable();
|
|
30
|
-
table.integer('publisherId')
|
|
31
|
-
.unsigned()
|
|
32
|
-
.references('id')
|
|
33
|
-
.inTable('accounts')
|
|
34
|
-
.onDelete('SET NULL')
|
|
35
|
-
.index();
|
|
36
|
-
table.integer('hubId')
|
|
37
|
-
.unsigned()
|
|
38
|
-
.references('id')
|
|
39
|
-
.inTable('hubs')
|
|
40
|
-
.onDelete('SET NULL')
|
|
41
|
-
.index();
|
|
42
|
-
}),
|
|
43
|
-
knex.schema.createTable('releases', table => {
|
|
44
|
-
table.increments('id').primary();
|
|
45
|
-
table.string('publicKey').unique().notNullable();
|
|
46
|
-
table.string('mint').notNullable();
|
|
47
|
-
table.json('metadata').notNullable();
|
|
48
|
-
table.string('datetime').notNullable();
|
|
49
|
-
table.integer('publisherId')
|
|
50
|
-
.notNullable()
|
|
51
|
-
.unsigned()
|
|
52
|
-
.references('id')
|
|
53
|
-
.inTable('accounts')
|
|
54
|
-
.onDelete('SET NULL')
|
|
55
|
-
.index();
|
|
56
|
-
table.integer('hubId')
|
|
57
|
-
.unsigned()
|
|
58
|
-
.references('id')
|
|
59
|
-
.inTable('hubs')
|
|
60
|
-
.onDelete('SET NULL')
|
|
61
|
-
.index();
|
|
62
|
-
}),
|
|
63
|
-
knex.schema.createTable('releases_collected', table => {
|
|
64
|
-
table.primary(['releaseId', 'accountId']);
|
|
65
|
-
table.integer('releaseId')
|
|
66
|
-
.unsigned()
|
|
67
|
-
.references('id')
|
|
68
|
-
.inTable('releases')
|
|
69
|
-
.onDelete('CASCADE')
|
|
70
|
-
.index();
|
|
71
|
-
table.integer('accountId')
|
|
72
|
-
.unsigned()
|
|
73
|
-
.references('id')
|
|
74
|
-
.inTable('accounts')
|
|
75
|
-
.onDelete('CASCADE')
|
|
76
|
-
.index();
|
|
77
|
-
}),
|
|
78
|
-
knex.schema.createTable('hubs_releases', table => {
|
|
79
|
-
table.primary(['hubId', 'releaseId']);
|
|
80
|
-
table.integer('hubId')
|
|
81
|
-
.unsigned()
|
|
82
|
-
.references('id')
|
|
83
|
-
.inTable('hubs')
|
|
84
|
-
.onDelete('CASCADE')
|
|
85
|
-
.index();
|
|
86
|
-
table.integer('releaseId')
|
|
87
|
-
.unsigned()
|
|
88
|
-
.references('id')
|
|
89
|
-
.inTable('releases')
|
|
90
|
-
.onDelete('CASCADE')
|
|
91
|
-
.index();
|
|
92
|
-
table.string('hubReleasePublicKey')
|
|
93
|
-
.unique()
|
|
94
|
-
.notNullable();
|
|
95
|
-
}),
|
|
96
|
-
knex.schema.createTable('posts_releases', table => {
|
|
97
|
-
table.primary(['postId', 'releaseId']);
|
|
98
|
-
table.integer('postId')
|
|
99
|
-
.unsigned()
|
|
100
|
-
.references('id')
|
|
101
|
-
.inTable('posts')
|
|
102
|
-
.onDelete('CASCADE')
|
|
103
|
-
.index();
|
|
104
|
-
table.integer('releaseId')
|
|
105
|
-
.unsigned()
|
|
106
|
-
.references('id')
|
|
107
|
-
.inTable('releases')
|
|
108
|
-
.onDelete('CASCADE')
|
|
109
|
-
.index();
|
|
110
|
-
}),
|
|
111
|
-
knex.schema.createTable('hubs_collaborators', table => {
|
|
112
|
-
table.primary(['hubId', 'accountId']);
|
|
113
|
-
table.integer('hubId')
|
|
114
|
-
.unsigned()
|
|
115
|
-
.references('id')
|
|
116
|
-
.inTable('hubs')
|
|
117
|
-
.onDelete('CASCADE')
|
|
118
|
-
.index();
|
|
119
|
-
table.integer('accountId')
|
|
120
|
-
.unsigned()
|
|
121
|
-
.references('id')
|
|
122
|
-
.inTable('accounts')
|
|
123
|
-
.onDelete('CASCADE')
|
|
124
|
-
.index();
|
|
125
|
-
table.string('hubCollaboratorPublicKey')
|
|
126
|
-
.unique()
|
|
127
|
-
.notNullable();
|
|
128
|
-
}),
|
|
129
|
-
knex.schema.createTable('hubs_posts', table => {
|
|
130
|
-
table.primary(['hubId', 'postId']);
|
|
131
|
-
table.integer('hubId')
|
|
132
|
-
.unsigned()
|
|
133
|
-
.references('id')
|
|
134
|
-
.inTable('hubs')
|
|
135
|
-
.onDelete('CASCADE')
|
|
136
|
-
.index();
|
|
137
|
-
table.integer('postId')
|
|
138
|
-
.unsigned()
|
|
139
|
-
.references('id')
|
|
140
|
-
.inTable('posts')
|
|
141
|
-
.onDelete('CASCADE')
|
|
142
|
-
.index();
|
|
143
|
-
table.string('hubPostPublicKey')
|
|
144
|
-
.unique()
|
|
145
|
-
.notNullable();
|
|
146
|
-
}),
|
|
147
|
-
knex.schema.createTable('exchanges', table => {
|
|
148
|
-
table.increments('id').primary();
|
|
149
|
-
table.string('publicKey').unique().notNullable();
|
|
150
|
-
table.boolean('isSale').notNullable();
|
|
151
|
-
table.decimal('expectedAmount').notNullable();
|
|
152
|
-
table.decimal('initializerAmount').notNullable();
|
|
153
|
-
table.boolean('cancelled').notNullable();
|
|
154
|
-
table.string('createdAt').notNullable();
|
|
155
|
-
table.string('updatedAt');
|
|
156
|
-
table.integer('initializerId')
|
|
157
|
-
.notNullable()
|
|
158
|
-
.unsigned()
|
|
159
|
-
.references('id')
|
|
160
|
-
.inTable('accounts')
|
|
161
|
-
.onDelete('SET NULL')
|
|
162
|
-
.index();
|
|
163
|
-
table.integer('completedById')
|
|
164
|
-
.unsigned()
|
|
165
|
-
.references('id')
|
|
166
|
-
.inTable('accounts')
|
|
167
|
-
.onDelete('SET NULL')
|
|
168
|
-
.index();
|
|
169
|
-
table.integer('releaseId')
|
|
170
|
-
.notNullable()
|
|
171
|
-
.unsigned()
|
|
172
|
-
.references('id')
|
|
173
|
-
.inTable('releases')
|
|
174
|
-
.onDelete('SET NULL')
|
|
175
|
-
.index();
|
|
176
|
-
}),
|
|
177
|
-
knex.schema.createTable('releases_revenue_share', table => {
|
|
178
|
-
table.primary(['releaseId', 'accountId']);
|
|
179
|
-
table.integer('releaseId')
|
|
180
|
-
.unsigned()
|
|
181
|
-
.references('id')
|
|
182
|
-
.inTable('releases')
|
|
183
|
-
.onDelete('CASCADE')
|
|
184
|
-
.index();
|
|
185
|
-
table.integer('accountId')
|
|
186
|
-
.unsigned()
|
|
187
|
-
.references('id')
|
|
188
|
-
.inTable('accounts')
|
|
189
|
-
.onDelete('CASCADE')
|
|
190
|
-
.index();
|
|
191
|
-
}),
|
|
192
|
-
]);
|
|
193
|
-
};
|
|
194
|
-
/**
|
|
195
|
-
* @param { import("knex").Knex } knex
|
|
196
|
-
* @returns { Promise<void> }
|
|
197
|
-
*/
|
|
198
|
-
export const down = function (knex) {
|
|
199
|
-
return knex.schema
|
|
200
|
-
.dropTableIfExists('hubs_collaborators')
|
|
201
|
-
.dropTableIfExists('hubs_posts')
|
|
202
|
-
.dropTableIfExists('hubs_releases')
|
|
203
|
-
.dropTableIfExists('releases_collected')
|
|
204
|
-
.dropTableIfExists('releases')
|
|
205
|
-
.dropTableIfExists('posts_releases')
|
|
206
|
-
.dropTableIfExists('posts')
|
|
207
|
-
.dropTableIfExists('hubs')
|
|
208
|
-
.dropTableIfExists('accounts')
|
|
209
|
-
.dropTableIfExists('exchanges')
|
|
210
|
-
.dropTableIfExists('releases_revenue_share');
|
|
211
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @param { import("knex").Knex } knex
|
|
3
|
-
* @returns { Promise<void> }
|
|
4
|
-
*/
|
|
5
|
-
export const up = function (knex) {
|
|
6
|
-
return Promise.all([
|
|
7
|
-
knex.schema.createTable('subscriptions', table => {
|
|
8
|
-
table.increments('id').primary();
|
|
9
|
-
table.string('publicKey').unique().notNullable();
|
|
10
|
-
table.string('datetime').notNullable();
|
|
11
|
-
table.string('from').notNullable();
|
|
12
|
-
table.string('to').notNullable();
|
|
13
|
-
table.string('subscriptionType').notNullable();
|
|
14
|
-
}),
|
|
15
|
-
]);
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* @param { import("knex").Knex } knex
|
|
19
|
-
* @returns { Promise<void> }
|
|
20
|
-
*/
|
|
21
|
-
export const down = function (knex) {
|
|
22
|
-
return knex.schema.dropTableIfExists('subscriptions');
|
|
23
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @param { import("knex").Knex } knex
|
|
3
|
-
* @returns { Promise<void> }
|
|
4
|
-
*/
|
|
5
|
-
export const up = function (knex) {
|
|
6
|
-
return knex.schema.table('hubs', table => {
|
|
7
|
-
table.string('dataUri');
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* @param { import("knex").Knex } knex
|
|
12
|
-
* @returns { Promise<void> }
|
|
13
|
-
*/
|
|
14
|
-
export const down = function (knex) {
|
|
15
|
-
};
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @param { import("knex").Knex } knex
|
|
3
|
-
* @returns { Promise<void> }
|
|
4
|
-
*/
|
|
5
|
-
export const up = function (knex) {
|
|
6
|
-
return Promise.all([
|
|
7
|
-
knex.schema.createTable('transactions', table => {
|
|
8
|
-
table.increments('id').primary();
|
|
9
|
-
table.string('txid').unique().notNullable();
|
|
10
|
-
table.integer('blocktime').notNullable();
|
|
11
|
-
table.string('type').notNullable();
|
|
12
|
-
table.integer('hubId')
|
|
13
|
-
.unsigned()
|
|
14
|
-
.references('id')
|
|
15
|
-
.inTable('hubs')
|
|
16
|
-
.onDelete('CASCADE')
|
|
17
|
-
.index();
|
|
18
|
-
table.integer('authorityId')
|
|
19
|
-
.unsigned()
|
|
20
|
-
.notNullable()
|
|
21
|
-
.references('id')
|
|
22
|
-
.inTable('accounts')
|
|
23
|
-
.onDelete('CASCADE')
|
|
24
|
-
.index();
|
|
25
|
-
table.integer('releaseId')
|
|
26
|
-
.unsigned()
|
|
27
|
-
.references('id')
|
|
28
|
-
.inTable('releases')
|
|
29
|
-
.onDelete('CASCADE')
|
|
30
|
-
.index();
|
|
31
|
-
table.integer('postId')
|
|
32
|
-
.unsigned()
|
|
33
|
-
.references('id')
|
|
34
|
-
.inTable('posts')
|
|
35
|
-
.onDelete('CASCADE')
|
|
36
|
-
.index();
|
|
37
|
-
table.integer('toAccountId')
|
|
38
|
-
.unsigned()
|
|
39
|
-
.references('id')
|
|
40
|
-
.inTable('accounts')
|
|
41
|
-
.onDelete('CASCADE')
|
|
42
|
-
.index();
|
|
43
|
-
table.integer('toHubId')
|
|
44
|
-
.unsigned()
|
|
45
|
-
.references('id')
|
|
46
|
-
.inTable('hubs')
|
|
47
|
-
.onDelete('CASCADE')
|
|
48
|
-
.index();
|
|
49
|
-
}),
|
|
50
|
-
]);
|
|
51
|
-
};
|
|
52
|
-
/**
|
|
53
|
-
* @param { import("knex").Knex } knex
|
|
54
|
-
* @returns { Promise<void> }
|
|
55
|
-
*/
|
|
56
|
-
export const down = function (knex) {
|
|
57
|
-
return knex.schema.dropTableIfExists('transactions');
|
|
58
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @param { import("knex").Knex } knex
|
|
3
|
-
* @returns { Promise<void> }
|
|
4
|
-
*/
|
|
5
|
-
export const up = function (knex) {
|
|
6
|
-
return Promise.all([
|
|
7
|
-
knex.schema.createTable('verifications', table => {
|
|
8
|
-
table.increments('id').primary();
|
|
9
|
-
table.string('publicKey').unique().notNullable();
|
|
10
|
-
table.string('type').notNullable();
|
|
11
|
-
table.string('value').notNullable();
|
|
12
|
-
table.string('displayName');
|
|
13
|
-
table.string('image');
|
|
14
|
-
table.string('description');
|
|
15
|
-
table.integer('accountId')
|
|
16
|
-
.unsigned()
|
|
17
|
-
.notNullable()
|
|
18
|
-
.references('id')
|
|
19
|
-
.inTable('accounts')
|
|
20
|
-
.onDelete('CASCADE')
|
|
21
|
-
.index();
|
|
22
|
-
}),
|
|
23
|
-
]);
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* @param { import("knex").Knex } knex
|
|
27
|
-
* @returns { Promise<void> }
|
|
28
|
-
*/
|
|
29
|
-
export const down = function (knex) {
|
|
30
|
-
return knex.schema.dropTableIfExists('verificiations');
|
|
31
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @param { import("knex").Knex } knex
|
|
3
|
-
* @returns { Promise<void> }
|
|
4
|
-
*/
|
|
5
|
-
export const up = function (knex) {
|
|
6
|
-
return knex.schema.table('hubs_releases', table => {
|
|
7
|
-
table.boolean('visible').notNullable().defaultTo(true);
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* @param { import("knex").Knex } knex
|
|
12
|
-
* @returns { Promise<void> }
|
|
13
|
-
*/
|
|
14
|
-
export const down = function (knex) {
|
|
15
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @param { import("knex").Knex } knex
|
|
3
|
-
* @returns { Promise<void> }
|
|
4
|
-
*/
|
|
5
|
-
export const up = function (knex) {
|
|
6
|
-
return Promise.all([
|
|
7
|
-
knex.schema.createTable('gates', table => {
|
|
8
|
-
table.increments('id').primary();
|
|
9
|
-
table.string('description');
|
|
10
|
-
table.string('fileName').notNullable();
|
|
11
|
-
table.integer('fileSize').notNullable();
|
|
12
|
-
table.string('uri').notNullable();
|
|
13
|
-
table.integer('releaseId')
|
|
14
|
-
.unsigned()
|
|
15
|
-
.notNullable()
|
|
16
|
-
.references('id')
|
|
17
|
-
.inTable('releases')
|
|
18
|
-
.onDelete('CASCADE')
|
|
19
|
-
.index();
|
|
20
|
-
}),
|
|
21
|
-
]);
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* @param { import("knex").Knex } knex
|
|
25
|
-
* @returns { Promise<void> }
|
|
26
|
-
*/
|
|
27
|
-
export const down = function (knex) {
|
|
28
|
-
return knex.schema.dropTableIfExists('gates');
|
|
29
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @param { import("knex").Knex } knex
|
|
3
|
-
* @returns { Promise<void> }
|
|
4
|
-
*/
|
|
5
|
-
export const up = function (knex) {
|
|
6
|
-
return knex.schema.table('verifications', table => {
|
|
7
|
-
table.boolean('active').notNullable().defaultTo(true);
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* @param { import("knex").Knex } knex
|
|
12
|
-
* @returns { Promise<void> }
|
|
13
|
-
*/
|
|
14
|
-
export const down = function (knex) {
|
|
15
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @param { import("knex").Knex } knex
|
|
3
|
-
* @returns { Promise<void> }
|
|
4
|
-
*/
|
|
5
|
-
export const up = function (knex) {
|
|
6
|
-
return knex.schema.table('hubs', table => {
|
|
7
|
-
table.string('updatedAt');
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* @param { import("knex").Knex } knex
|
|
12
|
-
* @returns { Promise<void> }
|
|
13
|
-
*/
|
|
14
|
-
export const down = function (knex) {
|
|
15
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @param { import("knex").Knex } knex
|
|
3
|
-
* @returns { Promise<void> }
|
|
4
|
-
*/
|
|
5
|
-
export const up = function (knex) {
|
|
6
|
-
return knex.schema.table('releases', table => {
|
|
7
|
-
table.string('slug');
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* @param { import("knex").Knex } knex
|
|
12
|
-
* @returns { Promise<void> }
|
|
13
|
-
*/
|
|
14
|
-
export const down = function (knex) {
|
|
15
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @param { import("knex").Knex } knex
|
|
3
|
-
* @returns { Promise<void> }
|
|
4
|
-
*/
|
|
5
|
-
export const up = function (knex) {
|
|
6
|
-
return knex.schema.table('accounts', table => {
|
|
7
|
-
table.string('image');
|
|
8
|
-
table.string('description');
|
|
9
|
-
table.string('displayName');
|
|
10
|
-
table.string('handle');
|
|
11
|
-
});
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* @param { import("knex").Knex } knex
|
|
15
|
-
* @returns { Promise<void> }
|
|
16
|
-
*/
|
|
17
|
-
export const down = function (knex) {
|
|
18
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @param { import("knex").Knex } knex
|
|
3
|
-
* @returns { Promise<void> }
|
|
4
|
-
*/
|
|
5
|
-
export const up = function (knex) {
|
|
6
|
-
return knex.schema.table('posts', table => {
|
|
7
|
-
table.string('version').notNullable().defaultTo('0.0.0');
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* @param { import("knex").Knex } knex
|
|
12
|
-
* @returns { Promise<void> }
|
|
13
|
-
*/
|
|
14
|
-
export const down = function (knex) {
|
|
15
|
-
};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @param { import("knex").Knex } knex
|
|
3
|
-
* @returns { Promise<void> }
|
|
4
|
-
*/
|
|
5
|
-
export const up = function (knex) {
|
|
6
|
-
return Promise.all([
|
|
7
|
-
knex.schema.createTable('tags', table => {
|
|
8
|
-
table.increments('id').primary();
|
|
9
|
-
table.string('value').notNullable();
|
|
10
|
-
}),
|
|
11
|
-
knex.schema.createTable('tags_content', table => {
|
|
12
|
-
table.primary(['tagId', 'releaseId', 'postId']);
|
|
13
|
-
table.integer('releaseId')
|
|
14
|
-
.unsigned()
|
|
15
|
-
.references('id')
|
|
16
|
-
.inTable('releases')
|
|
17
|
-
.onDelete('CASCADE')
|
|
18
|
-
.index();
|
|
19
|
-
table.integer('postId')
|
|
20
|
-
.unsigned()
|
|
21
|
-
.references('id')
|
|
22
|
-
.inTable('accounts')
|
|
23
|
-
.onDelete('CASCADE')
|
|
24
|
-
.index();
|
|
25
|
-
table.integer('tagId')
|
|
26
|
-
.unsigned()
|
|
27
|
-
.references('id')
|
|
28
|
-
.inTable('accounts')
|
|
29
|
-
.onDelete('CASCADE')
|
|
30
|
-
.index();
|
|
31
|
-
}),
|
|
32
|
-
]);
|
|
33
|
-
};
|
|
34
|
-
/**
|
|
35
|
-
* @param { import("knex").Knex } knex
|
|
36
|
-
* @returns { Promise<void> }
|
|
37
|
-
*/
|
|
38
|
-
export const down = function (knex) {
|
|
39
|
-
return knex.schema.dropTableIfExists('tags');
|
|
40
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @param { import("knex").Knex } knex
|
|
3
|
-
* @returns { Promise<void> }
|
|
4
|
-
*/
|
|
5
|
-
export const up = function (knex) {
|
|
6
|
-
return knex.schema.table('releases', table => {
|
|
7
|
-
table.string('price');
|
|
8
|
-
table.string('paymentMint');
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* @param { import("knex").Knex } knex
|
|
13
|
-
* @returns { Promise<void> }
|
|
14
|
-
*/
|
|
15
|
-
export const down = function (knex) {
|
|
16
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @param { import("knex").Knex } knex
|
|
3
|
-
* @returns { Promise<void> }
|
|
4
|
-
*/
|
|
5
|
-
export const up = function (knex) {
|
|
6
|
-
return Promise.all([
|
|
7
|
-
knex.schema.dropTable('tags_content'),
|
|
8
|
-
knex.schema.createTable('tags_releases', table => {
|
|
9
|
-
table.primary(['tagId', 'releaseId']);
|
|
10
|
-
table.integer('releaseId')
|
|
11
|
-
.unsigned()
|
|
12
|
-
.references('id')
|
|
13
|
-
.inTable('releases')
|
|
14
|
-
.onDelete('CASCADE')
|
|
15
|
-
.index();
|
|
16
|
-
table.integer('tagId')
|
|
17
|
-
.unsigned()
|
|
18
|
-
.references('id')
|
|
19
|
-
.inTable('tags')
|
|
20
|
-
.onDelete('CASCADE')
|
|
21
|
-
.index();
|
|
22
|
-
}),
|
|
23
|
-
]);
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* @param { import("knex").Knex } knex
|
|
27
|
-
* @returns { Promise<void> }
|
|
28
|
-
*/
|
|
29
|
-
export const down = function (knex) {
|
|
30
|
-
return knex.schema.dropTableIfExists('tags_releases');
|
|
31
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @param { import("knex").Knex } knex
|
|
3
|
-
* @returns { Promise<void> }
|
|
4
|
-
*/
|
|
5
|
-
export const up = function (knex) {
|
|
6
|
-
return knex.schema.table('releases', table => {
|
|
7
|
-
table.boolean('hidden').notNullable().defaultTo(false);
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* @param { import("knex").Knex } knex
|
|
12
|
-
* @returns { Promise<void> }
|
|
13
|
-
*/
|
|
14
|
-
export const down = function (knex) {
|
|
15
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @param { import("knex").Knex } knex
|
|
3
|
-
* @returns { Promise<void> }
|
|
4
|
-
*/
|
|
5
|
-
export const up = function (knex) {
|
|
6
|
-
return knex.schema.table('releases', table => {
|
|
7
|
-
table.renameColumn('hidden', 'archived');
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* @param { import("knex").Knex } knex
|
|
12
|
-
* @returns { Promise<void> }
|
|
13
|
-
*/
|
|
14
|
-
export const down = function (knex) {
|
|
15
|
-
return knex.schema.table('releases', table => {
|
|
16
|
-
table.renameColumn('archived', 'hidden');
|
|
17
|
-
});
|
|
18
|
-
};
|