Skip to content

Commit

Permalink
database uploading properly
Browse files Browse the repository at this point in the history
  • Loading branch information
visionthex committed Feb 12, 2024
1 parent f4f36c9 commit 7e4137f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
3 changes: 2 additions & 1 deletion app/src/components/DatabaseFetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ function DataFetchComponent() {
setIsLoading(true);
try {
const response = await axios.get('http://localhost:4000/api/analysis_results');
setData(response.data);
const dataWithIds = response.data.map((item, index) => ({ ...item, id: index }));
setData(dataWithIds);
} catch (error) {
console.error("Error fetching data:", error);
setError('Error fetching data');
Expand Down
13 changes: 7 additions & 6 deletions server/migrations/20240211072255_create_tbl_scan.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
exports.up = function(knex) {
return knex.schema.createTable('csv_scan', function(table) {
table.increments('id').primary();
table.text('data');
table.string('f/p');
table.string('module');
table.string('scanName');
table.string('source');
table.string('type');
table.text('Scan Name');
table.text('Updated');
table.text('Type');
table.text('Module');
table.text('Source');
table.text('F/P');
table.text('Data', 'longtext');
});
};

Expand Down

0 comments on commit 7e4137f

Please sign in to comment.