@rwillians/qx 0.1.18 → 0.1.19
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.defineMigrations = void 0;
|
|
3
|
+
exports.defineMigrations = exports.create = void 0;
|
|
4
4
|
const index_1 = require("./index");
|
|
5
5
|
// // // // // // // // // // // // // // // // // // // // // // // //
|
|
6
6
|
// CREATE STATEMENTS //
|
|
@@ -10,7 +10,7 @@ const index_1 = require("./index");
|
|
|
10
10
|
* @since 0.1.0
|
|
11
11
|
* @version 1
|
|
12
12
|
*/
|
|
13
|
-
|
|
13
|
+
exports.create = {
|
|
14
14
|
/**
|
|
15
15
|
* @public Prepares a create table statement.
|
|
16
16
|
* @since 0.1.0
|
|
@@ -73,7 +73,7 @@ const migrations = (0, index_1.table)('schema_migrations', t => ({
|
|
|
73
73
|
* ```
|
|
74
74
|
*/
|
|
75
75
|
const defineMigrations = (migs) => async (db) => {
|
|
76
|
-
await create.table(migrations, { ifNotExists: true }).onto(db);
|
|
76
|
+
await exports.create.table(migrations, { ifNotExists: true }).onto(db);
|
|
77
77
|
const { mostRecentId } = await (0, index_1.from)(migrations.as('m'))
|
|
78
78
|
.orderBy(({ m }) => [index_1.expr.desc(m.timestamp)])
|
|
79
79
|
.select(({ m }) => ({ mostRecentId: m.id }))
|
|
@@ -1,4 +1,28 @@
|
|
|
1
|
-
import { type IDatabase } from './index';
|
|
1
|
+
import { type IDatabase, type Table } from './index';
|
|
2
|
+
/**
|
|
3
|
+
* @public Create statement builder.
|
|
4
|
+
* @since 0.1.0
|
|
5
|
+
* @version 1
|
|
6
|
+
*/
|
|
7
|
+
export declare const create: {
|
|
8
|
+
/**
|
|
9
|
+
* @public Prepares a create table statement.
|
|
10
|
+
* @since 0.1.0
|
|
11
|
+
* @version 1
|
|
12
|
+
*/
|
|
13
|
+
table: <T extends Table, S extends {
|
|
14
|
+
ifNotExists?: true;
|
|
15
|
+
unlogged?: true;
|
|
16
|
+
}>(table: T, options?: S) => {
|
|
17
|
+
/**
|
|
18
|
+
* @public Executes the create table statement onto the given
|
|
19
|
+
* database.
|
|
20
|
+
* @since 0.1.0
|
|
21
|
+
* @version 1
|
|
22
|
+
*/
|
|
23
|
+
onto: (db: IDatabase) => Promise<void>;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
2
26
|
/**
|
|
3
27
|
* @private Defines the type for a migration function.
|
|
4
28
|
* @since 0.1.6
|