Migration to SQLite
This commit is contained in:
parent
9137a379ce
commit
461e52d323
|
|
@ -1,13 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "ERTdb",
|
"name": "DB",
|
||||||
"module": "dbconnector",
|
"module": "dbconnector",
|
||||||
"action": "connect",
|
"action": "connect",
|
||||||
"options": {
|
"options": {
|
||||||
"client": "sqlite3",
|
"client": "sqlite3",
|
||||||
"connection": {
|
"connection": {
|
||||||
"filename": "/ERTSQlite.db"
|
"filename": "/public/ERTSQlite.db"
|
||||||
},
|
},
|
||||||
"tz": "utc"
|
"tz": "utc"
|
||||||
},
|
}
|
||||||
"fileName": "ERTdb.json"
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,17 +1,20 @@
|
||||||
{
|
{
|
||||||
"type": "sqlite3",
|
"type": "sqlite3",
|
||||||
"connection": {
|
"connection": {
|
||||||
"filename": "/ERTSQlite.db"
|
"filename": "/public/ERTSQlite.db"
|
||||||
},
|
},
|
||||||
"direct": true,
|
"direct": true,
|
||||||
"schema": {
|
"schema": {
|
||||||
"tables": {
|
"tables": {
|
||||||
|
"_da_old_20241029": {
|
||||||
|
"db": {}
|
||||||
|
},
|
||||||
"da": {
|
"da": {
|
||||||
"db": {},
|
"db": {},
|
||||||
"columns": {
|
"columns": {
|
||||||
"ID": {
|
"ID": {
|
||||||
"db": {
|
"db": {
|
||||||
"type": "integer",
|
"type": "increments",
|
||||||
"primary": true,
|
"primary": true,
|
||||||
"unique": false,
|
"unique": false,
|
||||||
"nullable": false
|
"nullable": false
|
||||||
BIN
ERTSQlite.db
BIN
ERTSQlite.db
Binary file not shown.
|
|
@ -1,3 +0,0 @@
|
||||||
{
|
|
||||||
"exec": {}
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,60 @@
|
||||||
|
{
|
||||||
|
"meta": {
|
||||||
|
"$_POST": [
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"name": "deleteid"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"exec": {
|
||||||
|
"steps": {
|
||||||
|
"name": "delete",
|
||||||
|
"module": "dbupdater",
|
||||||
|
"action": "delete",
|
||||||
|
"options": {
|
||||||
|
"connection": "DB",
|
||||||
|
"sql": {
|
||||||
|
"type": "delete",
|
||||||
|
"table": "da",
|
||||||
|
"wheres": {
|
||||||
|
"condition": "AND",
|
||||||
|
"rules": [
|
||||||
|
{
|
||||||
|
"id": "ID",
|
||||||
|
"field": "ID",
|
||||||
|
"type": "double",
|
||||||
|
"operator": "equal",
|
||||||
|
"value": "{{$_POST.deleteid}}",
|
||||||
|
"data": {
|
||||||
|
"column": "ID"
|
||||||
|
},
|
||||||
|
"operation": "="
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"conditional": null,
|
||||||
|
"valid": true
|
||||||
|
},
|
||||||
|
"returning": "ID",
|
||||||
|
"query": "delete from `da` where `ID` = ?",
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"operator": "equal",
|
||||||
|
"type": "expression",
|
||||||
|
"name": ":P1",
|
||||||
|
"value": "{{$_POST.deleteid}}",
|
||||||
|
"test": ""
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"meta": [
|
||||||
|
{
|
||||||
|
"name": "affected",
|
||||||
|
"type": "number"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"output": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,116 @@
|
||||||
|
{
|
||||||
|
"meta": {
|
||||||
|
"$_POST": [
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"name": "db_fullName"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"name": "db_licenseNumber"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"name": "db_stateIssue"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "number",
|
||||||
|
"name": "db_employeeID"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"name": "owner"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"exec": {
|
||||||
|
"steps": {
|
||||||
|
"name": "insert",
|
||||||
|
"module": "dbupdater",
|
||||||
|
"action": "insert",
|
||||||
|
"options": {
|
||||||
|
"connection": "DB",
|
||||||
|
"sql": {
|
||||||
|
"type": "insert",
|
||||||
|
"values": [
|
||||||
|
{
|
||||||
|
"table": "da",
|
||||||
|
"column": "db_fullName",
|
||||||
|
"type": "text",
|
||||||
|
"value": "{{$_POST.db_fullName}}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"table": "da",
|
||||||
|
"column": "db_licenseNumber",
|
||||||
|
"type": "text",
|
||||||
|
"value": "{{$_POST.db_licenseNumber}}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"table": "da",
|
||||||
|
"column": "db_stateIssue",
|
||||||
|
"type": "text",
|
||||||
|
"value": "{{$_POST.db_stateIssue}}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"table": "da",
|
||||||
|
"column": "db_employeeID",
|
||||||
|
"type": "number",
|
||||||
|
"value": "{{$_POST.db_employeeID}}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"table": "da",
|
||||||
|
"column": "owner",
|
||||||
|
"type": "text",
|
||||||
|
"value": "{{$_POST.owner}}"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"table": "da",
|
||||||
|
"returning": "ID",
|
||||||
|
"query": "insert into `da` (`db_employeeID`, `db_fullName`, `db_licenseNumber`, `db_stateIssue`, `owner`) values (?, ?, ?, ?, ?) returning `ID`",
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"name": ":P1",
|
||||||
|
"type": "expression",
|
||||||
|
"value": "{{$_POST.db_fullName}}",
|
||||||
|
"test": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": ":P2",
|
||||||
|
"type": "expression",
|
||||||
|
"value": "{{$_POST.db_licenseNumber}}",
|
||||||
|
"test": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": ":P3",
|
||||||
|
"type": "expression",
|
||||||
|
"value": "{{$_POST.db_stateIssue}}",
|
||||||
|
"test": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": ":P4",
|
||||||
|
"type": "expression",
|
||||||
|
"value": "{{$_POST.db_employeeID}}",
|
||||||
|
"test": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": ":P5",
|
||||||
|
"type": "expression",
|
||||||
|
"value": "{{$_POST.owner}}",
|
||||||
|
"test": ""
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"meta": [
|
||||||
|
{
|
||||||
|
"name": "identity",
|
||||||
|
"type": "text"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "affected",
|
||||||
|
"type": "number"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
"module": "dbconnector",
|
"module": "dbconnector",
|
||||||
"action": "select",
|
"action": "select",
|
||||||
"options": {
|
"options": {
|
||||||
"connection": "ERTdb",
|
"connection": "DB",
|
||||||
"sql": {
|
"sql": {
|
||||||
"type": "select",
|
"type": "select",
|
||||||
"columns": [],
|
"columns": [],
|
||||||
|
|
@ -27,7 +27,6 @@
|
||||||
},
|
},
|
||||||
"primary": "ID",
|
"primary": "ID",
|
||||||
"joins": [],
|
"joins": [],
|
||||||
"orders": [],
|
|
||||||
"query": "select * from `da`"
|
"query": "select * from `da`"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -1,13 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "ERTdb",
|
"name": "DB",
|
||||||
"module": "dbconnector",
|
"module": "dbconnector",
|
||||||
"action": "connect",
|
"action": "connect",
|
||||||
"options": {
|
"options": {
|
||||||
"client": "sqlite3",
|
"client": "sqlite3",
|
||||||
"connection": {
|
"connection": {
|
||||||
"filename": "/ERTSQlite.db"
|
"filename": "/public/ERTSQlite.db"
|
||||||
},
|
},
|
||||||
"tz": "utc"
|
"tz": "utc"
|
||||||
},
|
}
|
||||||
"fileName": "ERTdb.json"
|
|
||||||
}
|
}
|
||||||
Binary file not shown.
|
|
@ -1,44 +0,0 @@
|
||||||
dmx.config({
|
|
||||||
"main": {
|
|
||||||
"datastore1": [
|
|
||||||
{
|
|
||||||
"type": "boolean",
|
|
||||||
"name": "dirty"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"index": {
|
|
||||||
"datastore1": [
|
|
||||||
{
|
|
||||||
"type": "text",
|
|
||||||
"name": "da_fullName"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "text",
|
|
||||||
"name": "da_driverLicense"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "text",
|
|
||||||
"name": "da_driverLicenseState"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"dataID": {
|
|
||||||
"outputType": "text"
|
|
||||||
},
|
|
||||||
"DSflow1": {
|
|
||||||
"meta": {},
|
|
||||||
"local": [
|
|
||||||
{
|
|
||||||
"name": "DSConfirm",
|
|
||||||
"type": "boolean",
|
|
||||||
"metaData": {
|
|
||||||
"confirmMessage": {
|
|
||||||
"meta": null,
|
|
||||||
"outputType": "text"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"Trainer": {
|
||||||
|
"Jeff": {},
|
||||||
|
"Amy": {},
|
||||||
|
"Justin": {},
|
||||||
|
"Teresa": {},
|
||||||
|
"Angie": {},
|
||||||
|
"Valerie": {},
|
||||||
|
"Pree": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
107
views/index.ejs
107
views/index.ejs
|
|
@ -1,5 +1,7 @@
|
||||||
<!-- Wappler include head-page="layouts/main" fontawesome_5="cdn" bootstrap5="local" is="dmx-app" id="index" appConnect="local" components="{dmxBootstrap5Navigation:{},dmxAnimateCSS:{},dmxStateManagement:{},dmxDatastore:{},dmxBootstrap5Modal:{},dmxFormatter:{},dmxBootstrap5TableGenerator:{},dmxBootstrap5Toasts:{}}" -->
|
<!-- Wappler include head-page="layouts/main" fontawesome_5="cdn" bootstrap5="local" is="dmx-app" id="index" appConnect="local" components="{dmxBootstrap5Navigation:{},dmxAnimateCSS:{},dmxStateManagement:{},dmxDatastore:{},dmxBootstrap5Modal:{},dmxFormatter:{},dmxBootstrap5TableGenerator:{},dmxBootstrap5Toasts:{}}" -->
|
||||||
<dmx-serverconnect id="DBSC1" url="/api/dbQuery"></dmx-serverconnect>
|
<dmx-serverconnect id="DBInsert" url="/api/insert" noload="true"></dmx-serverconnect>
|
||||||
|
<div is="dmx-bs5-toasts" id="toasts1"></div>
|
||||||
|
<dmx-serverconnect id="DBSC1" url="/api/query"></dmx-serverconnect>
|
||||||
<script is="dmx-flow" id="DSflow1" type="text/dmx-flow">{
|
<script is="dmx-flow" id="DSflow1" type="text/dmx-flow">{
|
||||||
confirm: {
|
confirm: {
|
||||||
name: "DSConfirm",
|
name: "DSConfirm",
|
||||||
|
|
@ -14,7 +16,7 @@
|
||||||
}</script>
|
}</script>
|
||||||
<dmx-value id="dataID"></dmx-value>
|
<dmx-value id="dataID"></dmx-value>
|
||||||
<dmx-json-datasource id="stateJSON" is="dmx-serverconnect" url="/states.json"></dmx-json-datasource>
|
<dmx-json-datasource id="stateJSON" is="dmx-serverconnect" url="/states.json"></dmx-json-datasource>
|
||||||
<dmx-datastore id="datastore1"></dmx-datastore>
|
<dmx-json-datasource id="trainerJSON" is="dmx-serverconnect" url="/trainer.json"></dmx-json-datasource>
|
||||||
<div class="modal" id="modal1" is="dmx-bs5-modal" tabindex="-1">
|
<div class="modal" id="modal1" is="dmx-bs5-modal" tabindex="-1">
|
||||||
<div class="modal-dialog" role="document">
|
<div class="modal-dialog" role="document">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
|
|
@ -24,33 +26,45 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<form id="form1">
|
<form is="dmx-serverconnect-form" id="serverconnectform1" method="post" action="/api/insert" dmx-generator="bootstrap5" dmx-form-type="horizontal" dmx-on:done="modal1.hide()">
|
||||||
<div class="form-group mb-3 row">
|
<div class="form-group mb-3 row">
|
||||||
<label for="input1" class="col-sm-2 col-form-label">Full Name</label>
|
<label for="inp_db_fullName" class="col-sm-2 col-form-label">full name</label>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
<input type="text" class="form-control" id="input1" name="input1" aria-describedby="input1_help">
|
<input type="text" class="form-control" id="inp_db_fullName" name="db_fullName" aria-describedby="inp_db_fullName_help" placeholder="Enter Db full name">
|
||||||
<small id="input1_help" class="form-text text-muted">*Enter your full name</small>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group mb-3 row">
|
<div class="form-group mb-3 row">
|
||||||
<label for="input2" class="col-sm-2 col-form-label">License no.</label>
|
<label for="inp_db_licenseNumber" class="col-sm-2 col-form-label">license number</label>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
<input type="text" class="form-control" id="input2" name="input2" aria-describedby="input1_help">
|
<input type="text" class="form-control" id="inp_db_licenseNumber" name="db_licenseNumber" aria-describedby="inp_db_licenseNumber_help" placeholder="Enter Db license number">
|
||||||
<small id="input1_help1" class="form-text text-muted">*Enter your driver license number</small>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group mb-3 row">
|
<div class="form-group mb-3 row">
|
||||||
<label for="input3" class="col-sm-2 col-form-label">License State</label>
|
<label for="inp_db_stateIssue" class="col-sm-2 col-form-label">state issue</label>
|
||||||
<div class="col">
|
<div class="col-sm-10">
|
||||||
<div class="form-group mb-3">
|
<select id="select1" class="form-select" dmx-bind:options="stateJSON.data.states" optiontext="name" optionvalue="abbreviation">
|
||||||
<label for="input3" class="form-label">Select</label>
|
<option value="1">Option One</option>
|
||||||
<select id="input3" class="form-select" dmx-bind:options="stateJSON.data.states" optiontext="name" optionvalue="abbreviation">
|
<option value="2">Option Two</option>
|
||||||
<option value="1">Option One</option>
|
<option value="3">Option Three</option>
|
||||||
<option value="2">Option Two</option>
|
</select>
|
||||||
<option value="3">Option Three</option>
|
</div>
|
||||||
</select>
|
</div>
|
||||||
<small id="select1Help" class="form-text text-muted">Pick the state your License is issued from</small>
|
<div class="form-group mb-3 row">
|
||||||
</div>
|
<label for="inp_db_employeeID" class="col-sm-2 col-form-label">Trainer</label>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<input type="number" class="form-control" id="inp_db_employeeID" name="db_employeeID" aria-describedby="inp_db_employeeID_help" placeholder="Enter Db employee">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group mb-3 row">
|
||||||
|
<label for="inp_owner" class="col-sm-2 col-form-label">Owner</label>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<input type="text" class="form-control" id="inp_owner" name="owner" aria-describedby="inp_owner_help" placeholder="Enter Owner">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group mb-3 row">
|
||||||
|
<div class="col-sm-2"> </div>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<button type="submit" class="btn btn-primary" dmx-bind:disabled="state.executing">Save <span class="spinner-border spinner-border-sm" role="status" dmx-show="state.executing"></span></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
@ -59,7 +73,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
||||||
<button type="button" class="btn btn-primary" dmx-on:click="datastore1.insert({da_fullName: form1.input1.value, da_driverLicense: form1.input2.value, da_driverLicenseState: form1.input3.selectedValue})">Save changes</button>
|
<button type="button" class="btn btn-primary" data-bs-toggle="button">Save changes</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -78,30 +92,37 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row" dmx-hide="datastore1.data.isEmpty()">
|
<div class="row" dmx-hide="datastore1.data.isEmpty()">
|
||||||
<table class="table table-striped table-sm">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>$id</th>
|
|
||||||
<th>Da full name</th>
|
|
||||||
<th>Da driver license</th>
|
|
||||||
<th dmx-on:click="datastore1.clear()">Da driver license state</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody is="dmx-repeat" dmx-generator="bs5table" dmx-bind:repeat="datastore1.data" id="tableRepeat1">
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<button id="btn3" class="btn btn-sm btn-warning" dmx-bind:value="$id" dmx-on:click="datastore1.delete({$id: $id})" data-bs-toggle="button">{{$id}}</button>
|
|
||||||
|
|
||||||
</td>
|
|
||||||
<td dmx-text="da_fullName"></td>
|
|
||||||
<td dmx-text="da_driverLicense"></td>
|
|
||||||
<td dmx-text="da_driverLicenseState"></td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
</div>
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Id</th>
|
||||||
|
<th>Db full name</th>
|
||||||
|
<th>Db license number</th>
|
||||||
|
<th>Db state issue</th>
|
||||||
|
<th>Db employee</th>
|
||||||
|
<th>Owner</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody is="dmx-repeat" dmx-generator="bs5table" dmx-bind:repeat="DBSC1.data.query" id="tableRepeat1">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<form id="IDAction" action="/api/delRecord" method="post" is="dmx-serverconnect-form" dmx-on:success="DBSC1.load({})">
|
||||||
|
<input id="deleteid" name="deleteid" type="hidden" class="form-control" dmx-bind:value="ID">
|
||||||
|
<button id="btn3" class="btn btn-sm btn-warning" dmx-text="ID" type="submit" dmx-on:click="btn3.setValue(ID)">Button</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td dmx-text="db_fullName"></td>
|
||||||
|
<td dmx-text="db_licenseNumber"></td>
|
||||||
|
<td dmx-text="db_stateIssue"></td>
|
||||||
|
<td dmx-text="db_employeeID"></td>
|
||||||
|
<td dmx-text="owner"></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<h3 dmx-show="datastore1.data.isEmpty()">No Records</h3>
|
<h3>{{DBSC1.data.query.count()+" Records"}}</h3>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body is="dmx-app" id="main">
|
<body is="dmx-app" id="main">
|
||||||
<dmx-datastore id="datastore1"></dmx-datastore>
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<nav class="navbar navbar-expand-lg">
|
<nav class="navbar navbar-expand-lg">
|
||||||
<div class="navbar-nav w-100">
|
<div class="navbar-nav w-100">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue