-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommands.txt
84 lines (47 loc) · 2.14 KB
/
commands.txt
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
**GIT COMMANDS**
// FRONTEND
run 'npm run build' before each commit and push
// pull all branches from repository
1. git clone <<REPO-URL>>
2. git branch -r | grep -v '\->' | sed "s,\x1B\[[0-9;]*[a-zA-Z],,g" | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
3. git pull all
// create a branch
// MAKE SURE NEW BRANCHES START
// FROM CORRECT BRANCH (usually dev)
git checkout -b <<BRANCH-NAME>>
// push created branch to GitHub remote repository
git push origin <<BRANCH-NAME>>
// move to specific branch
git checkout <<BRANCH-NAME>>
// merge a branch
1. git checkout dev
2. git pull origin dev
3. git merge <<NEW-BRANCH-NAME>>
4. git push origin dev
// revert to previous commit
1. git log
2. git reset --hard <<commit #>>
// delete branch
git branch -D <<branch-name>>
**SEQUELIZE COMMANDS**
npx dotenv sequelize db:seed:undo:all && npx dotenv sequelize db:migrate:undo:all
npx dotenv sequelize db:migrate && npx dotenv sequelize db:seed:all
// create Spot model
npx sequelize model:generate --name Spot --attributes ownerId:integer,address:string,city:string,state:string,country:string,lat:decimal,lng:decimal,name:string,description:string,price:decimal
npx sequelize model:generate --name SpotImage --attributes spotId:integer,url:string,preview:boolean
npx sequelize model:generate --name Review --attributes spotId:integer,userId:integer,review:string,stars:integer
npx sequelize model:generate --name ReviewImage --attributes reviewId:integer,url:string
npx sequelize model:generate --name Booking --attributes spotId:integer,userId:integer,startDate:date,endDate:date
//create associations
npx sequelize migration:generate --name review-association
// generate demo-spot seeder
npx sequelize seed:generate --name demo-spot
npx sequelize seed:generate --name demo-review
npx sequelize seed:generate --name demo-booking
npx sequelize seed:generate --name demo-review-img
npx sequelize seed:generate --name demo-spot-img
One-to-Many between Review and ReviewImage
review.js
Review.hasMany(models.ReviewImage, { foreignKey: "reviewId" });
reviewimage.js
ReviewImage.belongsTo(models.Review, { foreignKey: "reviewId" });