Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
CryptoCurrencyTracker
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
rs11g21
CryptoCurrencyTracker
Commits
52d6782f
Commit
52d6782f
authored
2 years ago
by
rs11g21
Browse files
Options
Downloads
Patches
Plain Diff
Able to handle error if xampp is not connected to internet
parent
6298843f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
databaseCryptoUpdated3.sh
+136
-0
136 additions, 0 deletions
databaseCryptoUpdated3.sh
with
136 additions
and
0 deletions
databaseCryptoUpdated3.sh
0 → 100644
+
136
−
0
View file @
52d6782f
#! /usr/bin/bash
if
[
"
$(
curl
-s
-o
/dev/null
-w
"%{http_code}"
http://www.google.com/
)
"
-eq
"200"
]
;
then
echo
"XAMPP's Apache server is connected to the internet."
$(
/opt/lampp/bin/mysql
-u
root
-e
"create database cryptoTracker; use cryptoTracker"
)
#To store different types of crypto
$(
/opt/lampp/bin/mysql
-u
root
-e
"use cryptoTracker; create table crypto (cryptoId int PRIMARY KEY, name varchar(20))"
)
$(
/opt/lampp/bin/mysql
-u
root
-e
"use cryptoTracker; insert into crypto values (1,'Bitcoin')"
)
#To store the crypto price (value)
$(
/opt/lampp/bin/mysql
-u
root
-e
"use cryptoTracker;
create table cryptoPrice (
id int AUTO_INCREMENT,
cryptoID int,
value float,
collected datetime,
PRIMARY KEY(id),
FOREIGN KEY(cryptoID) REFERENCES crypto(cryptoId)
)"
)
#To store the 24 Hour Low
$(
/opt/lampp/bin/mysql
-u
root
-e
"use cryptoTracker;
create table lowPrice (
id int AUTO_INCREMENT,
cryptoID int,
value float,
collected datetime,
PRIMARY KEY(id),
FOREIGN KEY(cryptoID) REFERENCES crypto(cryptoId)
)"
)
#To store the 24 Hour High
$(
/opt/lampp/bin/mysql
-u
root
-e
"use cryptoTracker;
create table highPrice (
id int AUTO_INCREMENT,
cryptoID int,
value float,
collected datetime,
PRIMARY KEY(id),
FOREIGN KEY(cryptoID) REFERENCES crypto(cryptoId)
)"
)
#To store the 24 Hour Open
$(
/opt/lampp/bin/mysql
-u
root
-e
"use cryptoTracker;
create table openPrice (
id int AUTO_INCREMENT,
cryptoID int,
value float,
collected datetime,
PRIMARY KEY(id),
FOREIGN KEY(cryptoID) REFERENCES crypto(cryptoId)
)"
)
#To store the Market Cap
$(
/opt/lampp/bin/mysql
-u
root
-e
"use cryptoTracker;
create table marketCap (
id int AUTO_INCREMENT,
cryptoID int,
value float,
collected datetime,
PRIMARY KEY(id),
FOREIGN KEY(cryptoID) REFERENCES crypto(cryptoId)
)"
)
#To store the Change In Value
$(
/opt/lampp/bin/mysql
-u
root
-e
"use cryptoTracker;
create table changeInValue (
id int AUTO_INCREMENT,
cryptoID int,
value float,
collected datetime,
PRIMARY KEY(id),
FOREIGN KEY(cryptoID) REFERENCES crypto(cryptoId)
)"
)
#To store the Return Percentage
$(
/opt/lampp/bin/mysql
-u
root
-e
"use cryptoTracker;
create table returnPercentage (
id int AUTO_INCREMENT,
cryptoID int,
value float,
collected datetime,
PRIMARY KEY(id),
FOREIGN KEY(cryptoID) REFERENCES crypto(cryptoId)
)"
)
#To store the Volatility
$(
/opt/lampp/bin/mysql
-u
root
-e
"use cryptoTracker;
create table volatility (
id int AUTO_INCREMENT,
cryptoID int,
value float,
collected datetime,
PRIMARY KEY(id),
FOREIGN KEY(cryptoID) REFERENCES crypto(cryptoId)
)"
)
#To store the Transaction Count
$(
/opt/lampp/bin/mysql
-u
root
-e
"use cryptoTracker;
create table transactionCount (
id int AUTO_INCREMENT,
cryptoID int,
value float,
collected datetime,
PRIMARY KEY(id),
FOREIGN KEY(cryptoID) REFERENCES crypto(cryptoId)
)"
)
#To store the Transaction Fee
$(
/opt/lampp/bin/mysql
-u
root
-e
"use cryptoTracker;
create table transactionFee (
id int AUTO_INCREMENT,
cryptoID int,
value float,
collected datetime,
PRIMARY KEY(id),
FOREIGN KEY(cryptoID) REFERENCES crypto(cryptoId)
)"
)
else
echo
"XAMPP's Apache server is not connected to the internet."
fi
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment