-
Notifications
You must be signed in to change notification settings - Fork 1
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 #26 from MikeNeilson/locations_view_table
Locations view table
- Loading branch information
Showing
23 changed files
with
491 additions
and
101 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
2 changes: 1 addition & 1 deletion
2
.../migration/units/R__unit_conversions.java → ...ation/java/units/R__unit_conversions.java
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
4 changes: 4 additions & 0 deletions
4
database/src/main/resources/db/migration/V4/V4.5.1__fix_location_uniqueness.sql
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,4 @@ | ||
drop index housedb.location_names_lower; | ||
|
||
create unique index location_names_lower_no_parent on housedb.locations( lower(name) ) where parent_id is null; | ||
create unique index location_names_lower_has_parent on housedb.locations( lower(name), parent_id ) where parent_id is not null; |
5 changes: 5 additions & 0 deletions
5
database/src/main/resources/db/migration/V5/V5.0.0__location_coordinates.sql
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 @@ | ||
alter table housedb.locations add column latitude double precision; | ||
alter table housedb.locations add column longitude double precision; | ||
alter table housedb.locations add column horizontal_datum varchar(50); | ||
alter table housedb.locations add column elevation double precision; | ||
alter table housedb.locations add column vertical_datum varchar(50); |
20 changes: 20 additions & 0 deletions
20
database/src/main/resources/db/migration/Views/R__locations.sql
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,20 @@ | ||
create or replace view housedb.view_locations as | ||
select id, | ||
housedb_locations.expand_location_name( | ||
id | ||
) AS name, | ||
parent_id, | ||
housedb_locations.expand_location_name( | ||
parent_id | ||
) AS parent, | ||
latitude, | ||
longitude, | ||
horizontal_datum, | ||
elevation, | ||
vertical_datum | ||
from housedb.locations | ||
; | ||
|
||
drop trigger if exists insert_location_trigger on housedb.view_locations; | ||
create trigger insert_location_trigger instead of insert or update or delete on housedb.view_locations | ||
for each row execute procedure housedb_timeseries.insert_location(); |
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 was deleted.
Oops, something went wrong.
23 changes: 23 additions & 0 deletions
23
housedb-dao/src/main/java/net/hobbyscience/housedb/dao/Dao.java
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,23 @@ | ||
package net.hobbyscience.housedb.dao; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
import org.jooq.DSLContext; | ||
|
||
public abstract class Dao<T> { | ||
|
||
@SuppressWarnings("unused") | ||
protected DSLContext dsl = null; | ||
|
||
public Dao(DSLContext dsl){ | ||
this.dsl = dsl; | ||
} | ||
|
||
public abstract List<T> getAll(); | ||
public abstract Optional<T> getByUniqueName(String uniqueName); | ||
|
||
public abstract void update(T modified); | ||
public abstract void save(T newObj); | ||
|
||
} |
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
50 changes: 0 additions & 50 deletions
50
housedb-dao/src/main/java/net/hobbyscience/housedb/dao/Location.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.