-
-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44 from kpcyrd/automatic-fields
Introduce automatic fields based on other fields
- Loading branch information
Showing
12 changed files
with
158 additions
and
6 deletions.
There are no files selected for viewing
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,25 @@ | ||
PRAGMA foreign_keys=off; | ||
|
||
ALTER TABLE urls RENAME TO _urls_old; | ||
|
||
CREATE TABLE urls ( | ||
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, | ||
subdomain_id INTEGER NOT NULL, | ||
value VARCHAR NOT NULL, | ||
status INTEGER, | ||
body BLOB, | ||
unscoped BOOLEAN DEFAULT 0 NOT NULL, | ||
online BOOLEAN, | ||
title VARCHAR, | ||
redirect VARCHAR, | ||
FOREIGN KEY(subdomain_id) REFERENCES subdomains(id) ON DELETE CASCADE, | ||
CONSTRAINT url_unique UNIQUE (value) | ||
); | ||
|
||
INSERT INTO urls (id, subdomain_id, value, status, body, unscoped, online, title, redirect) | ||
SELECT id, subdomain_id, value, status, body, unscoped, online, title, redirect | ||
FROM _urls_old; | ||
|
||
DROP TABLE _urls_old; | ||
|
||
PRAGMA foreign_keys=on; |
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,26 @@ | ||
PRAGMA foreign_keys=off; | ||
|
||
ALTER TABLE urls RENAME TO _urls_old; | ||
|
||
CREATE TABLE urls ( | ||
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, | ||
subdomain_id INTEGER NOT NULL, | ||
value VARCHAR NOT NULL, | ||
path VARCHAR NOT NULL, | ||
status INTEGER, | ||
body BLOB, | ||
unscoped BOOLEAN DEFAULT 0 NOT NULL, | ||
online BOOLEAN, | ||
title VARCHAR, | ||
redirect VARCHAR, | ||
FOREIGN KEY(subdomain_id) REFERENCES subdomains(id) ON DELETE CASCADE, | ||
CONSTRAINT url_unique UNIQUE (value) | ||
); | ||
|
||
INSERT INTO urls (id, subdomain_id, value, path, status, body, unscoped, online, title, redirect) | ||
SELECT id, subdomain_id, value, '/', status, body, unscoped, online, title, redirect | ||
FROM _urls_old; | ||
|
||
DROP TABLE _urls_old; | ||
|
||
PRAGMA foreign_keys=on; |
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
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
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
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
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