@nina-protocol/nina-db 0.0.68 → 0.0.70
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/dist/models/Tag.js
CHANGED
|
@@ -12,7 +12,7 @@ export default class Tag extends Model {
|
|
|
12
12
|
};
|
|
13
13
|
static sanitizeValue = (value) => value.toLowerCase().replace('#', '').replace(',', '');
|
|
14
14
|
static findOrCreate = async (value) => {
|
|
15
|
-
const sanitizedValue =
|
|
15
|
+
const sanitizedValue = sanitizeValue(value);
|
|
16
16
|
let tag = await Tag.query().where('value', sanitizedValue).first();
|
|
17
17
|
if (!tag) {
|
|
18
18
|
tag = await Tag.query().insert({ value: sanitizedValue });
|
package/package.json
CHANGED
package/src/models/Tag.js
CHANGED
|
@@ -13,9 +13,9 @@ export default class Tag extends Model {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
static sanitizeValue = (value) => value.toLowerCase().replace('#', '').replace(',', '');
|
|
16
|
-
|
|
16
|
+
|
|
17
17
|
static findOrCreate = async (value) => {
|
|
18
|
-
const sanitizedValue =
|
|
18
|
+
const sanitizedValue = sanitizeValue(value);
|
|
19
19
|
let tag = await Tag.query().where('value', sanitizedValue).first();
|
|
20
20
|
if (!tag) {
|
|
21
21
|
tag = await Tag.query().insert({ value: sanitizedValue });
|
|
@@ -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
|
-
};
|