Index: sitescripts/urlfixer/schema.sql |
=================================================================== |
new file mode 100644 |
--- /dev/null |
+++ b/sitescripts/urlfixer/schema.sql |
@@ -0,0 +1,25 @@ |
+DROP TABLE IF EXISTS domains; |
+DROP TABLE IF EXISTS corrections; |
+ |
+CREATE TABLE domains( |
+ id INT NOT NULL AUTO_INCREMENT, |
+ domain VARCHAR(50) NOT NULL, |
+ domain_correct FLOAT(10,10), |
+ correction_correct FLOAT(10,10), |
Wladimir Palant
2012/10/09 11:51:14
Aren't these two fields just derivatives of the da
|
+ PRIMARY KEY(id) |
+); |
+ |
+CREATE TABLE corrections( |
+ id INT NOT NULL AUTO_INCREMENT, |
+ domain INT NOT NULL, |
+ status INT NOT NULL, |
+ curr_month INT NOT NULL, |
+ prev_month INT NOT NULL, |
+ curr_year INT NOT NULL, |
+ prev_year INT NOT NULL, |
+ PRIMARY KEY(id), |
+ FOREIGN KEY(domain) REFERENCES domains(id) |
+); |
+ |
+CREATE UNIQUE INDEX idx_domain ON domains(domain); |
+CREATE UNIQUE INDEX idx_domain_status ON corrections(domain, status); |
Wladimir Palant
2012/10/09 11:51:14
Use UNIQUE constraint instead of these two indexes
Thomas Greiner
2012/10/09 13:47:02
I prefer having indexes because SELECTs on this ta
Wladimir Palant
2012/10/09 14:17:08
A UNIQUE constraint will always create an index im
|