Sha256: 53e19baffa26faa0460e87d914e5cbe296a083ad0b5e86fa73300b276b9afe08
Contents?: true
Size: 1.81 KB
Versions: 2
Compression:
Stored size: 1.81 KB
Contents
# frozen_string_literal: true require_relative '../types/std' require_relative '../types/extras' require_relative '../entity' # require_relative 'project' # autoload :Project, 'inat/data/entity/project' class Project < Entity; end class ProjectObservationRule < Entity table :project_observation_rules field :project, type: Project, index: true field :operator, type: Symbol, index: true, required: true field :operand_type, type: Symbol, index: true field :operand_id, type: Integer, index: true class << self def DDL super + "CREATE VIEW IF NOT EXISTS project_children AS\n" + " SELECT project_id, operand_id as child_id\n" + " FROM project_observation_rules\n" + " WHERE operator = 'in_project?' AND operand_type = 'Project';\n" + "CREATE VIEW IF NOT EXISTS project_rule_taxa AS\n" + " SELECT project_id, operand_id as taxon_id\n" + " FROM project_observation_rules\n" + " WHERE operator = 'in_taxon?' AND operand_type = 'Taxon';\n" + "CREATE VIEW IF NOT EXISTS project_rule_places AS\n" + " SELECT project_id, operand_id as place_id\n" + " FROM project_observation_rules\n" + " WHERE operator = 'observed_in_place?' AND operand_type = 'Place';\n" + "CREATE VIEW IF NOT EXISTS project_rule_excluded_taxa AS\n" + " SELECT project_id, operand_id as taxon_id\n" + " FROM project_observation_rules\n" + " WHERE operator = 'not_in_taxon?' AND operand_type = 'Taxon';\n" + "CREATE VIEW IF NOT EXISTS project_rule_excluded_places AS\n" + " SELECT project_id, operand_id as place_id\n" + " FROM project_observation_rules\n" + " WHERE operator = 'not_observed_in_place?' AND operand_type = 'Place';\n" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
inat-get-0.8.0.12 | lib/inat/data/entity/projectobservationrule.rb |
inat-get-0.8.0.11 | lib/inat/data/entity/projectobservationrule.rb |