-
-
Notifications
You must be signed in to change notification settings - Fork 186
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
376 additions
and
5 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# For documentation on how to configure this file, | ||
# see diesel.rs/guides/configuring-diesel-cli | ||
|
||
[print_schema] | ||
file = "src/schema.rs" |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
DROP TABLE urls; | ||
DROP TABLE subdomain_ipaddrs; | ||
DROP TABLE subdomains; | ||
DROP TABLE ipaddrs; | ||
DROP TABLE domains; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
CREATE TABLE domains ( | ||
id INTEGER PRIMARY KEY AUTOINCREMENT, | ||
value VARCHAR NOT NULL, | ||
CONSTRAINT domain_unique UNIQUE (value) | ||
); | ||
|
||
CREATE TABLE subdomains ( | ||
id INTEGER PRIMARY KEY AUTOINCREMENT, | ||
domain_id INTEGER NOT NULL, | ||
value VARCHAR NOT NULL, | ||
FOREIGN KEY(domain_id) REFERENCES domains(id), | ||
CONSTRAINT subdomain_unique UNIQUE (value) | ||
); | ||
|
||
/* family maybe not needed */ | ||
CREATE TABLE ipaddrs ( | ||
id INTEGER PRIMARY KEY AUTOINCREMENT, | ||
family VARCHAR NOT NULL, | ||
value VARCHAR NOT NULL, | ||
CONSTRAINT ipaddr_unique UNIQUE (value) | ||
); | ||
|
||
CREATE TABLE subdomain_ipaddrs ( | ||
id INTEGER PRIMARY KEY AUTOINCREMENT, | ||
subdomain_id INTEGER NOT NULL, | ||
ip_addr_id INTEGER NOT NULL, | ||
FOREIGN KEY(subdomain_id) REFERENCES domains(id), | ||
FOREIGN KEY(ip_addr_id) REFERENCES ipaddrs(id), | ||
CONSTRAINT subdomain_ipaddr_unique UNIQUE (subdomain_id, ip_addr_id) | ||
); | ||
|
||
CREATE TABLE urls ( | ||
id INTEGER PRIMARY KEY AUTOINCREMENT, | ||
subdomain_id INTEGER NOT NULL, | ||
value VARCHAR NOT NULL, | ||
status INTEGER, | ||
body BLOB, | ||
FOREIGN KEY(subdomain_id) REFERENCES domains(id), | ||
CONSTRAINT url_unique UNIQUE (value) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
pub use failure::{Error, ResultExt}; | ||
pub type Result<T> = ::std::result::Result<T, Error>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#![allow(unused_imports)] | ||
use errors::*; | ||
|
||
use diesel::sqlite::*; | ||
|
||
embed_migrations!(); | ||
|
||
pub fn run(conn: &SqliteConnection) -> Result<()> { | ||
embedded_migrations::run(conn)?; | ||
Ok(()) | ||
} |
Oops, something went wrong.