MIGRATION

moving to couchDB + pouchDB
This commit is contained in:
jndaniels 2024-12-06 16:38:58 -06:00
parent ae5ba6751c
commit 235d36f878
17 changed files with 1329 additions and 159 deletions

View File

@ -0,0 +1,17 @@
exports.up = function(knex) {
return knex.schema
.table('ertPointData', async function (table) {
table.boolean('remove').comment('true means ready to delete').alter();
table.string('recordID').comment('generateRandomIdentifier');
})
};
exports.down = function(knex) {
return knex.schema
.table('ertPointData', async function (table) {
table.text('remove').comment('').alter();
table.dropColumn('recordID');
})
};

View File

@ -97,8 +97,7 @@
"id": 44250508,
"ssh-key-file": "/.wappler/.ssh/ertfastfiller_ed25519.pub",
"fingerprint": "64:50:e4:41:ed:26:78:df:fb:27:4a:cf:a7:58:02:2a",
"type": "ed25519",
"name": "ertfastfiller_ed25519"
"type": "ed25519"
},
"ertfastfiller_rsa": {
"id": 44250710,
@ -126,32 +125,77 @@
"ssh-key-file": "/.wappler/.ssh/ertfastfiller_ed25519.pub",
"fingerprint": "64:50:e4:41:ed:26:78:df:fb:27:4a:cf:a7:58:02:2a",
"type": "ed25519",
"name": "ertfastfiller_ed25519"
"name": "ertfastfiller_ed25519",
"fa": {
"prefix": "fas",
"iconName": "user-lock",
"classes": [
"fa-lg",
"color-orange"
],
"transform": {}
}
},
{
"id": 43691420,
"public_key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK/IniPilvW2mZhH12xp+bw3GUKNtpQtZ8EMLQGkWT3z id_ed25519.pub",
"name": "jndaned25519",
"fingerprint": "6e:95:fc:ae:d5:d1:9c:a0:06:d8:99:98:f4:16:84:f4"
"fingerprint": "6e:95:fc:ae:d5:d1:9c:a0:06:d8:99:98:f4:16:84:f4",
"fa": {
"prefix": "fas",
"iconName": "key",
"classes": [
"fa-lg",
"color-blue"
],
"transform": {}
}
},
{
"id": 44250710,
"fingerprint": "9f:0e:25:d8:10:fc:e5:d4:94:38:92:74:8a:81:cd:16",
"ssh-key-file": "/.wappler/.ssh/ertfastfiller_rsa.pub",
"type": "rsa",
"name": "ertfastfiller_rsa"
"name": "ertfastfiller_rsa",
"fa": {
"prefix": "fas",
"iconName": "user-lock",
"classes": [
"fa-lg",
"color-orange"
],
"transform": {}
}
},
{
"id": 38166791,
"public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDixLL6TG8sd67jEkoHjtgXO1K9ScOHtGyX6n1mTl2CLoMeBE1ZwR6TOU7cjwcJ+crKUZMJfyB99h01qhD3DrBE388cE0NEu/ytUnbnys5ecD/NUiOAHL/ZMxJ7Yn6ceoband1C/Gz1GYA/guU2qMu1KA81jqDFA7ytR/riFoJq3fICuTy1++g6/T0EZqxaxzlM2OJNBn89UAhbAKWCRz7hYFhE53dXxI76rwiOm6Fyn9ksxA9G2zW31Ziy6JDUJVy9mahEzTjU4cJNALf61fblWLlxzTTh6c0Yjq2Ontwdp8xqr1NOERMKNraolXHcy7ml2T0spx9DAt13LtAfDubF\n",
"name": "DODriverSignin-wappler-prod",
"fingerprint": "f8:b4:24:a1:77:4f:02:4b:97:8a:c4:b1:12:88:4b:59"
"fingerprint": "f8:b4:24:a1:77:4f:02:4b:97:8a:c4:b1:12:88:4b:59",
"fa": {
"prefix": "fas",
"iconName": "key",
"classes": [
"fa-lg",
"color-blue"
],
"transform": {}
}
},
{
"id": 44250460,
"public_key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGsEr/uTng6hsmeec9KZNZ/G5QMqynZ3bOpGm6r/FyXz jndan@DESKTOP-N026HO3",
"name": "DO_Developer_12_2024",
"fingerprint": "f2:60:83:0a:b3:4e:c7:7b:51:d1:a8:28:88:10:1b:07"
"fingerprint": "f2:60:83:0a:b3:4e:c7:7b:51:d1:a8:28:88:10:1b:07",
"fa": {
"prefix": "fas",
"iconName": "key",
"classes": [
"fa-lg",
"color-blue"
],
"transform": {}
}
}
]
}

View File

@ -0,0 +1,19 @@
{
"name": "dbCouch",
"module": "dbconnector",
"action": "connect",
"options": {
"client": "couchdb",
"connection": {
"host": "host.docker.internal",
"port": 9913,
"user": "trainer",
"password": "sGynUdlM9cuLtUdc",
"database": "db_training"
},
"databaseResource": "Local / dbCouch",
"cloudDatabaseName": "db_training",
"tz": "utc"
},
"fileName": "dbCouch.json"
}

View File

@ -55,71 +55,6 @@
}
}
},
"ertPointData": {
"db": {},
"columns": {
"ID": {
"db": {
"type": "integer",
"primary": true,
"unique": false,
"nullable": false
}
},
"Owner": {
"db": {
"type": "text",
"primary": false,
"unique": false,
"nullable": true
}
},
"numSection": {
"db": {
"type": "text",
"primary": false,
"unique": false,
"nullable": true
}
},
"numSectionValue": {
"db": {
"type": "text",
"primary": false,
"unique": false,
"nullable": true
}
},
"remove": {
"db": {
"type": "text",
"primary": false,
"unique": false,
"nullable": true
},
"db_edits": {
"type": "boolean",
"comment": "true means ready to delete"
},
"status": {
"modified": true
}
},
"recordID": {
"db_edits": {
"type": "string",
"name": "recordID",
"comment": "generateRandomIdentifier"
},
"status": {
"new": true
}
}
},
"status": {
"children_modified": true
}
},
"security": {
"columns": {
"id": {
@ -248,6 +183,60 @@
}
}
}
},
"ertPointData": {
"db": {},
"columns": {
"ID": {
"db": {
"type": "integer",
"primary": true,
"unique": false,
"nullable": false
}
},
"Owner": {
"db": {
"type": "text",
"primary": false,
"unique": false,
"nullable": true
}
},
"numSection": {
"db": {
"type": "text",
"primary": false,
"unique": false,
"nullable": true
}
},
"numSectionValue": {
"db": {
"type": "text",
"primary": false,
"unique": false,
"nullable": true
}
},
"remove": {
"db": {
"type": "boolean",
"primary": false,
"unique": false,
"nullable": true
}
},
"recordID": {
"db": {
"type": "string",
"maxLength": 255,
"primary": false,
"unique": false,
"nullable": true
}
}
}
}
},
"views": {}

View File

@ -0,0 +1,57 @@
{
"type": "couchdb",
"connection": {
"host": "host.docker.internal",
"port": 9913,
"user": "trainer",
"password": "sGynUdlM9cuLtUdc",
"database": "db_training"
},
"direct": true,
"databaseResource": "Local / dbCouch",
"cloudDatabaseName": "db_training",
"schema": {
"partitioned": false,
"tables": {
"da": {
"meta": [
{
"name": "_id",
"type": "objectId"
},
{
"name": "db_fullName",
"type": "text"
},
{
"name": "db_licenseNumber",
"type": "text"
},
{
"name": "db_employeeID",
"type": "text"
}
]
},
"ert": {
"meta": [
{
"name": "_id",
"type": "objectId"
},
{
"name": "docPDF",
"type": "file"
}
],
"status": {
"modified": true
},
"db_edits": {
"name": "daData"
}
}
},
"views": {}
}
}

View File

@ -0,0 +1,2 @@
dmx.databases = dmx.databases || {};
dmx.databases['dbCouch'] = {type: "pouchdb", remote: "http://host.docker.internal:9913/db_training"}

View File

@ -85,37 +85,43 @@
"table": "da",
"column": "db_fullName",
"type": "text",
"value": "{{$_POST.db_fullName}}"
"value": "{{$_POST.db_fullName}}",
"recid": 1
},
{
"table": "da",
"column": "db_licenseNumber",
"type": "text",
"value": "{{$_POST.db_licenseNumber}}"
"value": "{{$_POST.db_licenseNumber}}",
"recid": 2
},
{
"table": "da",
"column": "db_stateIssue",
"type": "text",
"value": "{{$_POST.db_stateIssue}}"
"value": "{{$_POST.db_stateIssue}}",
"recid": 3
},
{
"table": "da",
"column": "db_employeeID",
"type": "number",
"value": "{{$_POST.db_employeeID}}"
"value": "{{$_POST.db_employeeID}}",
"recid": 4
},
{
"table": "da",
"column": "owner",
"type": "text",
"value": "{{$_POST.owner}}"
"value": "{{$_POST.owner}}",
"recid": 5
},
{
"table": "da",
"column": "db_SignatureData",
"type": "text",
"value": "{{$_POST.db_signatureData}}"
"value": "{{$_POST.db_signatureData}}",
"recid": 6
}
],
"table": "da",

View File

@ -26,85 +26,16 @@
{
"type": "text",
"name": "remove"
},
{
"type": "text",
"name": "recordID"
},
{
"type": "number",
"name": "ID"
}
]
},
"exec": {
"steps": {
"name": "insert",
"module": "dbupdater",
"action": "insert",
"options": {
"connection": "DB",
"sql": {
"type": "insert",
"values": [
{
"table": "ertPointData",
"column": "Owner",
"type": "text",
"value": "{{$_POST.Owner}}"
},
{
"table": "ertPointData",
"column": "numSection",
"type": "text",
"value": "{{$_POST.numSection}}"
},
{
"table": "ertPointData",
"column": "numSectionValue",
"type": "text",
"value": "{{$_POST.numSectionValue}}"
},
{
"table": "ertPointData",
"column": "remove",
"type": "text",
"value": "{{$_POST.remove}}"
}
],
"table": "ertPointData",
"returning": "ID",
"query": "insert into `ertPointData` (`Owner`, `numSection`, `numSectionValue`, `remove`) values (?, ?, ?, ?) returning `ID`",
"params": [
{
"name": ":P1",
"type": "expression",
"value": "{{$_POST.Owner}}",
"test": ""
},
{
"name": ":P2",
"type": "expression",
"value": "{{$_POST.numSection}}",
"test": ""
},
{
"name": ":P3",
"type": "expression",
"value": "{{$_POST.numSectionValue}}",
"test": ""
},
{
"name": ":P4",
"type": "expression",
"value": "{{$_POST.remove}}",
"test": ""
}
]
}
},
"meta": [
{
"name": "identity",
"type": "text"
},
{
"name": "affected",
"type": "number"
}
]
}
}
"exec": {}
}

View File

@ -0,0 +1,19 @@
{
"name": "dbCouch",
"module": "dbconnector",
"action": "connect",
"options": {
"client": "couchdb",
"connection": {
"host": "host.docker.internal",
"port": 9913,
"user": "trainer",
"password": "sGynUdlM9cuLtUdc",
"database": "db_training"
},
"databaseResource": "Local / dbCouch",
"cloudDatabaseName": "db_training",
"tz": "utc"
},
"fileName": "dbCouch.json"
}

View File

@ -44,7 +44,8 @@
"sqlite3": "^5.1.6",
"unzipper": "^0.12.1",
"uuid": "^10.0.0",
"sharp": "^0.32.6"
"sharp": "^0.32.6",
"nano": "^10.1.0"
},
"nodemonConfig": {
"watch": [

Binary file not shown.

View File

@ -1,4 +1,8 @@
// JavaScript Document
console.log("LIBRARY: dummyFunctions.js")
function myFunction() {
let myVar = 'Hello, Wappler!';

1069
public/js/bundle.js Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,2 @@
dmx.databases = dmx.databases || {};
dmx.databases['dbCouch'] = {type: "pouchdb", remote: "http://host.docker.internal:9913/db_training"}

View File

@ -0,0 +1,9 @@
// JavaScript Document
// Functions in this file will be run thru
// the 'browserify' script to make browser friendly.
const { v4: uuidv4 } = require('uuid');
// Example usage
const uuid = uuidv4();
console.log(uuid);

View File

@ -4,7 +4,7 @@
//
// ** OFFICIAL SCRIPT TO USE WHEN IN PRODUCTION
//
// Function to add Authenticator validation https://www.npmjs.com/package/speakeasy
// Utility to fetch PDF bytes

View File

@ -15,4 +15,5 @@
<a class="btn btn-primary" href="/">Return home</a>
</div>
</div>
</div>
</div>
<script src="/js/bundle.js"></script>