-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bind reports to areas by in instead of url_alias
- Loading branch information
Showing
4 changed files
with
148 additions
and
176 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,16 @@ | ||
DROP TRIGGER report_updated_at; | ||
|
||
UPDATE report SET area_url_alias = 'earth' WHERE area_url_alias = ''; | ||
|
||
ALTER TABLE report ADD COLUMN area_id INTEGER; | ||
|
||
CREATE INDEX idx_area_tags_url_alias ON area(json_extract(tags, '$.url_alias')); | ||
|
||
UPDATE report SET area_id = (SELECT rowid FROM area WHERE json_extract(tags, '$.url_alias') = area_url_alias); | ||
|
||
ALTER TABLE report DROP COLUMN area_url_alias; | ||
|
||
CREATE TRIGGER report_updated_at UPDATE OF area_id, date, tags, created_at, deleted_at ON report | ||
BEGIN | ||
UPDATE report SET updated_at = strftime('%Y-%m-%dT%H:%M:%fZ') WHERE rowid = old.rowid; | ||
END; |
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
Oops, something went wrong.