-
Notifications
You must be signed in to change notification settings - Fork 0
/
seed.js
48 lines (43 loc) · 1.47 KB
/
seed.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
var sqlite3 = require('sqlite3').verbose();
var db = new sqlite3.Database('forum.db');
db.run("INSERT INTO user ( name , contact_number , username , password ) VALUES (?,?,?,?) , (?,?,?,?)",
'David Patlut','917-771-2221','[email protected]','ga123',
'Viki Hallow','913-741-5221','[email protected]','secret',
function(err){
if(err){
throw err
}
}
);
db.run("INSERT INTO thread (author , category_id , post_date , short_descr , content , location , comment_counter ) VALUES (?,?,?,?,?,?,?) , (?,?,?,?,?,?,?)",
1 , 1 , "7/13/2015" , "Mac Air Lost!" , " I lost my mac in class yesterday please help me find it!" , "Room : 3A" , 1,
2 , 2 , "7/13/2015" , "Charger Lost!" , " I lost my charger in class yesterday please help me find it!" , "Room : 3A" , 1,
function(err){
if(err){
throw err
}
}
);
db.run("INSERT INTO comments (unique_id , comment_author , thread_relation , comment_number, context , parent , child) VALUES (?,?,?,?,?,?,?) , (?,?,?,?,?,?,?)" ,
234512 , 1 , 1 , 1 ,"TEST 1", 1 , 0,
323365 , 2 , 2 , 1 ,"TEST 2", 1 , 0,
function(err){
if(err){
throw err
}
}
);
db.run("INSERT INTO categories (cat_id , category) VALUES (?,?) , (?,?) , (?,?) , (?,?) , (?,?) , (?,?) , (?,?)" ,
1 , "Electronics (Phone,Laptop,etc.)",
2 , "Charger",
3 , "Clothing",
4 , "Backpacks",
5 , "Umbrella",
6 , "Jewerly",
7 , "Miscellaneous",
function(err){
if(err){
throw err
}
}
);