strds_metadata_table.sql 2.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. --#############################################################################
  2. -- This SQL script generates the space time raster dataset metadata table.
  3. --
  4. -- Author: Soeren Gebbert soerengebbert <at> googlemail <dot> com
  5. --#############################################################################
  6. --PRAGMA foreign_keys = ON;
  7. CREATE TABLE strds_metadata (
  8. id VARCHAR NOT NULL, -- Id of the space-time dataset, this is the primary foreign key
  9. raster_register VARCHAR, -- The id of the table in which the raster maps are registered for this dataset
  10. number_of_maps INTEGER, -- The number of registered raster maps
  11. max_min DOUBLE PRECISION, -- The minimal maximum of the registered raster maps
  12. min_min DOUBLE PRECISION, -- The minimal minimum of the registered raster maps
  13. max_max DOUBLE PRECISION, -- The maximal maximum of the registered raster maps
  14. min_max DOUBLE PRECISION, -- The maximal minimum of the registered raster maps
  15. nsres_min DOUBLE PRECISION, -- The lowest north-south resolution of the registered raster maps
  16. nsres_max DOUBLE PRECISION, -- The highest north-south resolution of the registered raster maps
  17. ewres_min DOUBLE PRECISION, -- The lowest east-west resolution of the registered raster maps
  18. ewres_max DOUBLE PRECISION, -- The highest east-west resolution of the registered raster maps
  19. title VARCHAR, -- Title of the space-time raster dataset
  20. description VARCHAR, -- Detailed description of the space-time raster dataset
  21. command VARCHAR, -- The command that was used to create the space time raster dataset
  22. PRIMARY KEY (id),
  23. FOREIGN KEY (id) REFERENCES strds_base (id) ON DELETE CASCADE
  24. );
  25. -- Create a trigger to update the modification time and revision number in case the metadata or timestanps have been updated
  26. -- Uncommented due to performance issues
  27. --CREATE TRIGGER update_strds_metadata AFTER UPDATE ON strds_metadata
  28. -- BEGIN
  29. -- UPDATE strds_base SET modification_time = datetime("NOW") WHERE id = old.id;
  30. -- UPDATE strds_base SET revision = (revision + 1) WHERE id = old.id;
  31. -- END;