Browse Source

added comment column for visits

master
Sean Clarke 1 year ago
parent
commit
b14105ec28
  1. 1
      database/build.js
  2. 10
      database/fill-visits.js
  3. 1
      views/site.pug

1
database/build.js

@ -44,6 +44,7 @@ con.connect(function(err) {
id int NOT NULL AUTO_INCREMENT,\
date varchar(255),\
img varchar(255),\
comment varchar(1000),\
site_id int,\
FOREIGN KEY (site_id) REFERENCES sites(id),\
PRIMARY KEY (id)\

10
database/fill-visits.js

@ -1,11 +1,11 @@
var con = require('./db');
sql = "INSERT INTO visits (date, img, site_id) VALUES ?";
sql = "INSERT INTO visits (date, img, comment, site_id) VALUES ?";
val = [
['10-15-2019','https://seanland.ca', '203'],
['10-17-2019','https://seanland.ca', '169'],
['01-17-2020','https://seanland.ca', '520'],
['11-23-2019','https://seanland.ca', '520']
['10-15-2019','https://seanland.ca', 'This is a comment about the place I went, or some details max 1000 characters. They are not supposed to be super long - but you can write a bit.' ,'203'],
['10-17-2019','https://seanland.ca', 'This is a comment about the place I went, or some details max 1000 characters. They are not supposed to be super long - but you can write a bit.' ,'169'],
['01-17-2020','https://seanland.ca', 'This is a comment about the place I went, or some details max 1000 characters. They are not supposed to be super long - but you can write a bit.' ,'520'],
['11-23-2019','https://seanland.ca', 'This is a comment about the place I went, or some details max 1000 characters. They are not supposed to be super long - but you can write a bit.' ,'520']
];
con.query(sql, [val], function(err, res){

1
views/site.pug

@ -17,6 +17,7 @@ block content
h2(class="visits")= "Visits"
each visit in visits
p #{visit.date}: #{visit.img} at the site: #{visit.site_id}
p #{visit.comment}
else
h2(class="visits")= "This site has yet to be visited. Soon... "

Loading…
Cancel
Save