Skip to content
Carlos edited this page Dec 26, 2022 · 7 revisions

Main TODO list

Following the PostgreSQL features list on this page.

cte - Common Table Expressions

v0.1.0

  • DOCS!!!
    • Config
    • Auxiliary Statements
    • Interval
    • Enum
    • Distinct On
  • CTE queries (auxiliary statements)
    • Configure CTE queries on model, and enable using with(:name) on relations
    • Allow custom join type, besides the default InnerJoin
    • Only provides the CTE fields when the main query doesn't select columns
    • Create a exclusive class to hold all the generated auxiliary statements
    • Try to identify join columns
    • Improve performance by saving @base_table ||= base_table and @query_table ||= query_table
    • Allow access to table and table_name from the class scope
      • Allow those access on the settings too, this is important for recursivity
      • Allow easy access to SQL access and columns on setting
    • Allows select: {column: :expose} extra option to with command
    • Allows join: {column: :cte_column} to do extra filters when using with command
    • Allows cte.polymorphic 'name' so it can identify both id and type columns
    • Accept Proc as query when configuring the CTE, but asks the source table Class or Name
      • Allows query to be a string too
      • Allows with to receive extra parameters and send to the Proc or format the string with %
  • Interval data type DOCS
    • Setup the interval style to the easier 'iso_8601' DOCS
    • On create table, interval column method
    • Value OID
    • Accepts integer as a value
    • Accepts array and hash as a value
  • 'Enum' type manager DOCS
    • Configurations
    • Allow schema option for database statements
    • Create, remove and change values
    • Schema dumper
    • Migration up and down
    • On create table, enum column method
    • Create single Module or Class for each enum type
    • Enum for active model (based on Enumerize)
      • Generate a method _text so the i18n key can have the model name
    • Uses Ruby Comparable module DOCS
    • Allow methods ended with '?' to check or '!' to replace value
    • I18n support for translating values
    • Uses chomp! to check for '?' and '!' methods DOCS
    • Allow 'Enum::Roles.each', iteration over class using 'delegate :each, to: :values'
    • Allow manual enum initialization by calling 'enum :roles' on models
  • DISTINCT ON DOCS
    • Static model method
    • Relation method
    • Where-like columns search for querying

v0.2.0

  • DOCS!!!
    • Configuration
    • Auxiliary Statements
    • Table Inheritance
    • Dynamic Attribute
  • Dynamic Attribute
    • Create a way to manually load CTE data
  • CTE queries (auxiliary statements)
    • Improve performance by saving @base_table ||= base_table and @query_table ||= query_table
    • Allow access to table and table_name from the class scope
      • Allow those access on the settings too, this is important for recursivity
    • Allows select: {column: :expose} extra option to with command
    • Allows join: {column: :cte_column} to do extra filters when using with command
    • Allows cte.polymorphic 'name' so it can identify both id and type columns
    • Allows requires setting to create dependecy between CTEs
    • Accept Proc as the query when configuring the CTE, but asks the source table Class or Name
      • Allows query to be a string too
      • Allows with to receive extra parameters and send to the Proc or format the string with %
  • Table Inheritance DOCS
    • inherits option while creating a table
    • Allow table creation without columns when having inheritance
    • Keep inherits as an option on schema dump
    • FROM ONLY DOCS
      • Relation method only to affect the FROM operator
    • Identify inherited models using physically_inherited?
      • Create a method to identify all possible child tables
      • Associate this information for each individual connection
    • Method to correctly cast the records
      • Cast a single record
      • Cast multiple records
      • Cast only selected records
      • Do not user attributes from other tables when loading records

v0.3.0

  • DOCS!!!
    • New Data Types
  • New Data Types
    • Add optional dependency to Geometry
    • Circle
    • Line
    • Segment
    • Box
  • ``

next versions

  • DOCS!!!
    • Auxiliary Statements
    • Table Inheritance
    • Enum
    • Composite
  • Dynamic Attribute
    • Load one or more attributes with the same query
  • CTE queries (auxiliary statements)
    • Identify conflicting table names during merge and add a new alias
    • Accept Arel::SelectManager as the query when configuring the CTE
    • Allows requires setting to create dependency between CTEs
      • Create a subclass from ActiveRecord::Relation for internal references
      • Turn the dependent into a relation so it could be used on the query
    • Tree CTE queries
      • Provides an acts_as_tree method on models to activate this resource
    • Recursive CTE queries
      • Enables path
      • Enables depth
  • Table Inheritance
    • Load only extras columns for cast_inheritance
    • Calculate the columns that need to be used as attributes for discriminate_class_for_record
  • Enum
    • Allow generator to postgre cast enum to integer DOCS
    • Accept pluralize: true and singularize: true to create the enum methods
    • Enum equivalences
  • Integrate resources with form_for
    • Interval input type
    • Enum input type
    • Nested form for composite input type
  • 'Composite' type manager DOCS
    • Configurations
    • Allow schema option for database statements
    • Create composite type
    • Alter composite type
    • Schema dumper
    • On create table, composite column method
    • Read value from database TEST
    • Write value on database TEST
    • Write quotes properly
    • Create single Module for each composite type TEST
    • Model attribute using as much as possible from ActiveRecord::Base TEST
    • Bind parent instance and attribute where is attatched to internal composite instance (Act as has_one) TEST
    • Block querying on Composite types TEST
    • Nested callbacks and validations
    • Allow composite model class be edited by users by reopening the class
    • Allow belongs_to for composite types TEST
      • Allow eager load
      • Allow where conditions
    • Check how it works with human_attribute_name
      • It already works fine using dot syntax 'published.url' TEST

Rails features to take advantage

#compose_of for composite types

Backend

  • Create view and materialized view DOCS VIEW DOCS MATERIALIZED VIEW
  • Ranges and Ranges Index DOCS
  • Constrains and Checks DOCS
  • WITHIN GROUP DOCS
  • WITH ORDINALITY DOCS
  • Turn .select into a SelectManager to better control the selected columns

Performance

  • TABLE Command, when using .all DOCS
  • SKIP LOCKED clause DOCS
  • TABLESAMPLE clause DOCS

To check if already exists

  • Explicit Locking DOCS
  • Update views DOCS
  • Constrains to model error
  • Dictionaries (Fulltext) DOCS

To be evaluated

  • Arel tableoid and pg_class DOCS
  • GROUP BY using GROUPING SETS, CUBE, and ROLLUP DOCS
  • JSON functions DOCS
  • JSON index DOCS
  • INSERT INTO with conflict_target and conflict_action DOCS
  • Extra types of joins DOCS
  • LATERAL Queries DOCS
  • BRIN Indexes DOCS
  • 'Simple' type manager DOCS
  • Allow use the 'stream_each' method from PostgreSQL connection DOCS
    • Mark all includes as eager_load so each record brings the information needed
  • FILTER Clause DOCS
  • GIN Indexes DOCS
  • Both Enum and Composite builded methods inside a self-generated module
  • Ltree and Tree features (https://www.postgresql.org/docs/10/ltree.html)

Desirable

  • Turn queries on 'database_statements' into Arel queries
  • Simple nested relation find (User -> has_many :groups should search for User::Groups, then UserGroups then Groups)
    • Configuration to enable and disable this feature
  • Replace the 'postgres_ext' gem
    • Rank windows function
    • Array operators
  • Domain manager DOCS
    • Create domain
    • Use domain on table creation
    • Allow domain check
  • .group, .order, and .select Allowing hash association
    • User the new resolve_column on Group
    • User the new resolve_column on Select
    • User the new resolve_column as a base for Order, because it may have :asc or :desc as last value

Future features

  • CTE queries (auxiliary statements)
    • Connect relations with auxiliary statements
      • Allows with to accept an hash and identify statements from associations
  • Composite
    • Accept array of composite (Act as has_many)
  • Enum
    • Accept array of enum and consider it as a set
  • Distinct On
    • Sanitize test
  • Record column data type (maybe Vector) DOCS
    • Allow per record extra data customization
    • Allow using symbol (:string), constant name over ActiveRecord::Type (String), or anything that respond to #cast, #serialize, and #deserialize to map the values
    • Index on expressions DOCS
    • Partial index, using WHERE DOCS
    • Array of record