Sha256: 06c09f5c183a3415de0a2560a7343b383ece15437bfe9a1e8002c6cf9bf0290f
Contents?: true
Size: 1.81 KB
Versions: 3
Compression:
Stored size: 1.81 KB
Contents
# frozen_string_literal: true require_relative '../types/std' require_relative '../types/extras' require_relative '../entity' class INat::Entity::Project < INat::Data::Entity; end class INat::Entity::ProjectObservationRule < INat::Data::Entity include INat::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
3 entries across 3 versions & 1 rubygems