str3ds_metadata_table.sql 2.4 KB

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