@nina-protocol/nina-db 0.0.14 → 0.0.16
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/index.js +3 -2
- package/dist/knexfile.js +9 -0
- package/dist/models/Release.js +1 -1
- package/package.json +1 -1
- package/src/index.js +3 -2
- package/src/knexfile.js +9 -1
- package/src/models/Release.js +1 -1
package/dist/index.js
CHANGED
|
@@ -3,8 +3,8 @@ import Knex from 'knex';
|
|
|
3
3
|
import { Model } from 'objection';
|
|
4
4
|
import Models from './models/index.js';
|
|
5
5
|
import knexConfig from './knexfile.js';
|
|
6
|
-
export const initDb = async () => {
|
|
7
|
-
const db = Knex(
|
|
6
|
+
export const initDb = async (config) => {
|
|
7
|
+
const db = Knex(config);
|
|
8
8
|
await db.raw(`SELECT 'CREATE DATABASE ${process.env.POSTGRES_DATABASE}'
|
|
9
9
|
WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = '${process.env.POSTGRES_DATABASE}')`);
|
|
10
10
|
await db.migrate.latest();
|
|
@@ -26,3 +26,4 @@ export const Release = Models.Release;
|
|
|
26
26
|
export const Subscription = Models.Subscription;
|
|
27
27
|
export const Transaction = Models.Transaction;
|
|
28
28
|
export const Verification = Models.Verification;
|
|
29
|
+
export const config = knexConfig;
|
package/dist/knexfile.js
CHANGED
|
@@ -11,6 +11,9 @@ export default {
|
|
|
11
11
|
user: process.env.POSTGRES_USER,
|
|
12
12
|
password: process.env.POSTGRES_PASSWORD,
|
|
13
13
|
},
|
|
14
|
+
migrations: {
|
|
15
|
+
directory: './node_modules/@nina-protocol/nina-db/dist/migrations',
|
|
16
|
+
},
|
|
14
17
|
},
|
|
15
18
|
staging: {
|
|
16
19
|
client: 'postgresql',
|
|
@@ -20,6 +23,9 @@ export default {
|
|
|
20
23
|
user: process.env.POSTGRES_USER,
|
|
21
24
|
password: process.env.POSTGRES_PASSWORD,
|
|
22
25
|
},
|
|
26
|
+
migrations: {
|
|
27
|
+
directory: './node_modules/@nina-protocol/nina-db/dist/migrations',
|
|
28
|
+
},
|
|
23
29
|
},
|
|
24
30
|
production: {
|
|
25
31
|
client: 'postgresql',
|
|
@@ -29,5 +35,8 @@ export default {
|
|
|
29
35
|
user: process.env.POSTGRES_USER,
|
|
30
36
|
password: process.env.POSTGRES_PASSWORD,
|
|
31
37
|
},
|
|
38
|
+
migrations: {
|
|
39
|
+
directory: './node_modules/@nina-protocol/nina-db/dist/migrations',
|
|
40
|
+
},
|
|
32
41
|
}
|
|
33
42
|
};
|
package/dist/models/Release.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import anchor from '@project-serum/anchor';
|
|
2
2
|
import { Metaplex } from '@metaplex-foundation/js';
|
|
3
3
|
import { Model } from 'objection';
|
|
4
|
-
import { stripHtmlIfNeeded } from '../utils/index.js';
|
|
4
|
+
import { stripHtmlIfNeeded, tweetNewRelease } from '../utils/index.js';
|
|
5
5
|
import Account from './Account.js';
|
|
6
6
|
import Exchange from './Exchange.js';
|
|
7
7
|
import Hub from './Hub.js';
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -4,8 +4,8 @@ import { Model } from 'objection'
|
|
|
4
4
|
import Models from './models/index.js'
|
|
5
5
|
import knexConfig from './knexfile.js'
|
|
6
6
|
|
|
7
|
-
export const initDb = async () => {
|
|
8
|
-
const db = Knex(
|
|
7
|
+
export const initDb = async (config) => {
|
|
8
|
+
const db = Knex(config)
|
|
9
9
|
await db.raw(`SELECT 'CREATE DATABASE ${process.env.POSTGRES_DATABASE}'
|
|
10
10
|
WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = '${process.env.POSTGRES_DATABASE}')`
|
|
11
11
|
)
|
|
@@ -33,3 +33,4 @@ export const Release = Models.Release
|
|
|
33
33
|
export const Subscription = Models.Subscription
|
|
34
34
|
export const Transaction = Models.Transaction
|
|
35
35
|
export const Verification = Models.Verification
|
|
36
|
+
export const config = knexConfig
|
package/src/knexfile.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* @type { Object.<string, import("knex").Knex.Config> }
|
|
3
3
|
*/
|
|
4
4
|
import "dotenv/config.js";
|
|
5
|
-
|
|
6
5
|
export default {
|
|
7
6
|
|
|
8
7
|
development: {
|
|
@@ -13,6 +12,9 @@ export default {
|
|
|
13
12
|
user: process.env.POSTGRES_USER,
|
|
14
13
|
password: process.env.POSTGRES_PASSWORD,
|
|
15
14
|
},
|
|
15
|
+
migrations: {
|
|
16
|
+
directory: './node_modules/@nina-protocol/nina-db/dist/migrations',
|
|
17
|
+
},
|
|
16
18
|
},
|
|
17
19
|
staging: {
|
|
18
20
|
client: 'postgresql',
|
|
@@ -22,6 +24,9 @@ export default {
|
|
|
22
24
|
user: process.env.POSTGRES_USER,
|
|
23
25
|
password: process.env.POSTGRES_PASSWORD,
|
|
24
26
|
},
|
|
27
|
+
migrations: {
|
|
28
|
+
directory: './node_modules/@nina-protocol/nina-db/dist/migrations',
|
|
29
|
+
},
|
|
25
30
|
},
|
|
26
31
|
production: {
|
|
27
32
|
client: 'postgresql',
|
|
@@ -31,5 +36,8 @@ export default {
|
|
|
31
36
|
user: process.env.POSTGRES_USER,
|
|
32
37
|
password: process.env.POSTGRES_PASSWORD,
|
|
33
38
|
},
|
|
39
|
+
migrations: {
|
|
40
|
+
directory: './node_modules/@nina-protocol/nina-db/dist/migrations',
|
|
41
|
+
},
|
|
34
42
|
}
|
|
35
43
|
};
|
package/src/models/Release.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import anchor from '@project-serum/anchor';
|
|
2
2
|
import { Metaplex } from '@metaplex-foundation/js';
|
|
3
3
|
import { Model } from 'objection';
|
|
4
|
-
import { stripHtmlIfNeeded }from '../utils/index.js';
|
|
4
|
+
import { stripHtmlIfNeeded, tweetNewRelease }from '../utils/index.js';
|
|
5
5
|
import Account from './Account.js';
|
|
6
6
|
import Exchange from './Exchange.js';
|
|
7
7
|
import Hub from './Hub.js';
|