@payloadcms/db-postgres 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
package/dist/reference.js DELETED
@@ -1,77 +0,0 @@
1
- // type GenerateMigration = (before: DrizzleSnapshotJSON, after: DrizzleSnapshotJSON) => string[]
2
- // type GenerateDrizzleJSON = (schema: DrizzleSchemaExports) => DrizzleSnapshotJSON
3
- // type PushDiff = (schema: DrizzleSchemaExports) => Promise<{ warnings: string[], apply: () => Promise<void> }>
4
- // drizzle-kit@utils
5
- "use strict";
6
- Object.defineProperty(exports, "__esModule", {
7
- value: true
8
- });
9
- const _nodepostgres = require("drizzle-orm/node-postgres");
10
- const _pg = require("pg");
11
- function _getRequireWildcardCache(nodeInterop) {
12
- if (typeof WeakMap !== "function") return null;
13
- var cacheBabelInterop = new WeakMap();
14
- var cacheNodeInterop = new WeakMap();
15
- return (_getRequireWildcardCache = function(nodeInterop) {
16
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
17
- })(nodeInterop);
18
- }
19
- function _interop_require_wildcard(obj, nodeInterop) {
20
- if (!nodeInterop && obj && obj.__esModule) {
21
- return obj;
22
- }
23
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
24
- return {
25
- default: obj
26
- };
27
- }
28
- var cache = _getRequireWildcardCache(nodeInterop);
29
- if (cache && cache.has(obj)) {
30
- return cache.get(obj);
31
- }
32
- var newObj = {};
33
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
34
- for(var key in obj){
35
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
36
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
37
- if (desc && (desc.get || desc.set)) {
38
- Object.defineProperty(newObj, key, desc);
39
- } else {
40
- newObj[key] = obj[key];
41
- }
42
- }
43
- }
44
- newObj.default = obj;
45
- if (cache) {
46
- cache.set(obj, newObj);
47
- }
48
- return newObj;
49
- }
50
- async function generateUsage() {
51
- const { generateDrizzleJson, generateMigration } = require('drizzle-kit/utils');
52
- // @ts-expect-error Just TypeScript being broken // TODO: Open TypeScript issue
53
- const schema = await Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("./data/users")));
54
- // @ts-expect-error Just TypeScript being broken // TODO: Open TypeScript issue
55
- const schemaAfter = await Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("./data/users-after")));
56
- const drizzleJsonBefore = generateDrizzleJson(schema);
57
- const drizzleJsonAfter = generateDrizzleJson(schemaAfter);
58
- const sqlStatements = await generateMigration(drizzleJsonBefore, drizzleJsonAfter);
59
- console.log(sqlStatements);
60
- }
61
- async function pushUsage() {
62
- const { pushSchema } = require('drizzle-kit/utils');
63
- // @ts-expect-error Just TypeScript being broken // TODO: Open TypeScript issue
64
- const schemaAfter = await Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("./data/users-after")));
65
- const db = (0, _nodepostgres.drizzle)(new _pg.Pool({
66
- connectionString: ''
67
- }));
68
- const response = await pushSchema(schemaAfter, db);
69
- console.log('\n');
70
- console.log('hasDataLoss: ', response.hasDataLoss);
71
- console.log('warnings: ', response.warnings);
72
- console.log('statements: ', response.statementsToExecute);
73
- await response.apply();
74
- process.exit(0);
75
- }
76
-
77
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9yZWZlcmVuY2UudHMiXSwic291cmNlc0NvbnRlbnQiOlsiLy8gdHlwZSBHZW5lcmF0ZU1pZ3JhdGlvbiA9IChiZWZvcmU6IERyaXp6bGVTbmFwc2hvdEpTT04sIGFmdGVyOiBEcml6emxlU25hcHNob3RKU09OKSA9PiBzdHJpbmdbXVxuXG4vLyB0eXBlIEdlbmVyYXRlRHJpenpsZUpTT04gPSAoc2NoZW1hOiBEcml6emxlU2NoZW1hRXhwb3J0cykgPT4gRHJpenpsZVNuYXBzaG90SlNPTlxuXG4vLyB0eXBlIFB1c2hEaWZmID0gKHNjaGVtYTogRHJpenpsZ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