Permalink
Branch: master
Commits on Feb 14, 2019
  1. Remove unnecessary test_tasks script

    paulcsmith committed Feb 14, 2019
    This is covered in scripts/test now
Commits on Feb 6, 2019
  1. Fix comparisons to `nil` in queries & make such queries explicit (#46)

    HarrisonB authored and paulcsmith committed Feb 6, 2019
    * Add `where` clauses for checking if `NULL`
    
    * Disallow `is`/`is_not` from accepting possibly `Nil` parameters
    
    Will now throw an error at compile-time if one writes something like:
    ```
    UserQuery::BaseQuery.nickname.is(nil)
    ```
    
    The methods `is?`/`is_not?` exist for comparing to possibly `nil`
    values.
    
    * Fix typos & wording in error message
    
    * Invert inheritance tree for WHERE clauses
    
    `IS NULL`/`IS NOT NULL` is kind of a special case, so this makes a bit
    more sense.
    
    * Remove excess newline
    
    * Rename `is`/`is?` to `eq`/`nilable_eq` respectively
    
    The question mark already indicates "returns Bool" or "can return Nil",
    so it makes sense not to overload it with a third additional meaning
    
    This also eliminates `is_not`/`is_not?` as they are redundant--one can
    simply use `.not.eq`/`.not.nillable_eq` instead.
    
    * Remove Avram::Criteria#not(T)
    
    This was simply a shortcut for `Avram::Criteria#not.eq(T)`, which is not
    significantly longer and is a bit clearer.
    
    * Swap method bodies of `eq` and `nilable_eq`
    
    It makes sense to have `eq` have the primary business logic here
  2. Clean up Lucky CLI install in Dockerfile (#52)

    paulcsmith committed Feb 6, 2019
Commits on Feb 4, 2019
  1. updated README to include mention of where the name comes from (#50)

    jwoertink authored and paulcsmith committed Feb 4, 2019
Commits on Feb 2, 2019
  1. Check shards build (#45)

    paulcsmith committed Feb 2, 2019
  2. Use docker for development and testing

    paulcsmith committed Feb 2, 2019
Commits on Jan 26, 2019
  1. Upgrade Lucky CLI to master (#314)

    paulcsmith committed Jan 26, 2019
Commits on Jan 24, 2019
Commits on Jan 4, 2019
  1. Fix multiple belongs_to of the same class (#306)

    edwardloveall authored and paulcsmith committed Jan 4, 2019
    If a record has multiple belongs to that references the same class, it
    would error saying `<assoc_name> for <ClassName> must be preloaded with
    'preload_<assoc_name>' (LuckyRecord::LazyLoadError)`, even if the user
    has preloaded it.
    
    For example, with this Follow model:
    
    ```crystal
    class Follow < BaseModel
      table :follows do
        belongs_to from : User
        belongs_to to : User
      end
    end
    ```
    
    When queried like so:
    
    ```crystal
    FollowQuery.new.preload_from
    ```
    
    would not work and throw the above error.
    
    This is because when a belongs_to is defined, the method `preload`
    method is redefined. Since it uses the same class for the method, it
    essentially erases the previous method definitions.
    
    ```crystal
    belongs_to from : User
    belongs_to to : User
    ```
    
    is turned into
    
    ```crystal
    # define the from association
    def preload(preload_query : User::BaseQuery)
    
    # later, define the to association
    def preload(preload_query : User::BaseQuery)
    ```
    
    The fix was to append the association name to the preload method:
    
    ```crystal
    def preload_from(preload_query : User::BaseQuery)
    
    # later
    def preload_to(preload_query : User::BaseQuery)
    ```
    
    This also has the advantage of clarifying the API.
    
    ```crystal
    # Current way
    query.preload(UserQuery.new) # Is it preloading a "user", or an
    "author"? Not clear
    
    # New way
    query.preload_author(UserQuery.new) # Clear what association is
    preloaded
    ```
    
    fixes #290
  2. Add better type restrictions for forms (#307)

    paulcsmith committed Jan 4, 2019
    Closes #460
Commits on Nov 5, 2018
Commits on Nov 4, 2018
Commits on Oct 26, 2018
  1. Cleanup specs (#299)

    paulcsmith committed Oct 26, 2018
    * Drop then create and migrate
    
    * Use shards update instead of shards install
    
    * Remove output from Lucky specs
Commits on Oct 19, 2018
  1. Switch to Wordsmith (#298)

    paulcsmith committed Oct 19, 2018
Commits on Oct 16, 2018
  1. Add Float64::Lucky.parse(value : PG::Numeric) overload (#297)

    perezperret authored and paulcsmith committed Oct 16, 2018
    This is to allow for Float64? (optional) model fields
Commits on Oct 12, 2018
  1. Add ability to set default values for virtual fields (#292)

    HarrisonB authored and paulcsmith committed Oct 12, 2018
    * Add ability to set default values for virtual fields
    
    * Replace explicit `if` branching macro with simpler `||`
    
    * Fix falsey default values for virtual fields being overridden
Commits on Oct 10, 2018
  1. Add `Queryable#distinct_on` (#291)

    HarrisonB authored and paulcsmith committed Oct 10, 2018
    * Add `Queryable#distinct_on`
    
    * Remove unnecessary call to `Queryable#distinct`
    
    `@distinct` is set via `QueryBuilder#distinct_on`, so this is not needed
    
    * Centralize checking for `distinct` option
    
    * Change test for #distinct_on to check query results
    
    * Add type restriction to `#distinct_on`
    
    Now it should raise an error at compile time if you happen to pass in
    something that's nillable.
Commits on Aug 29, 2018
  1. Run create in Travis

    paulcsmith committed Aug 29, 2018
  2. Upgrade habitat to 0.4.0

    paulcsmith committed Aug 28, 2018
Commits on Aug 24, 2018
  1. Move LuckyMigrator into LuckyRecord (#281)

    paulcsmith committed Aug 24, 2018
    Closes #233
Commits on Aug 23, 2018
  1. Improve association joins in queries. (#277)

    oneiros authored and paulcsmith committed Aug 23, 2018
    * Add support for `has_many ..., through: ...`
    * Fix generated SQL for `belongs_to`
    * Add specs for and fix `left_join_*` methods
Commits on Aug 21, 2018
  1. Check schema by calling a class method. (#280)

    hanneskaeufler authored and paulcsmith committed Aug 21, 2018
    This removes the need to instantiate a model instance, as there is no
    technical requirement to do so.
Commits on Jul 27, 2018
  1. Fix time parsing

    edwardloveall committed Jul 27, 2018
    Crystal recently updated how it parses dates, but they also added a 
    nice 
    convenience method that we can use to parse strings since we expect 
    them 
    to be UTC.
Commits on Jul 24, 2018
  1. Remove Fillable module (#271)

    paulcsmith committed Jul 24, 2018
    It is not necessary
Commits on Jul 15, 2018
  1. FillableField is child of Field. Add Fillable module (#268)

    paulcsmith committed Jul 15, 2018
    This will make it easier to restrict these types
    
    Closes luckyframework/lucky_record#223
Commits on Jul 14, 2018
  1. has_many through with uuids (#259)

    hanneskaeufler authored and paulcsmith committed Jul 14, 2018
    * Cover has_many with through and uuids
    
    * Resolve pk type class
    
    * Hardcode type conditional to get compiling for refactoring
    
    * Extract private macro for base query
    
    * Extract private macro for association getter
    
    * Extract private macro for preloading setter
    
    * Extract private macro for preloading getters
    
    * Move more getter methods into private macro
    
    * Extract has_one base query private macro
    
    * Pseudo-namespace some macros
    
    * More pseudo namespaceing
    
    * Extract has_many base query private macro
    
    * Fix formatting
    
    * Remove duplication for public preloaded getters
    
    * Remove preloaded setter duplication
    
    * Extract private macro for has one private assoc getter
    
    * Extract has_many stuff, name pending
    
    * Move KeyHolder model into support file
    
    * Handle has_many associations in finished macro lifecyle
    
    * Rename method
    
    * Clean up migration
    
    * Avoid having to call association and has_many_association
    
    * Replace custom sql by migrator code
    
    * Avoid duplicate storage of associations
    
    * Fix formatting
  2. Ignore self when validating uniqueness. (#263)

    oneiros authored and paulcsmith committed Jul 14, 2018
    * Ignore self when validating uniqueness.
    
    validates_uniqueness_of can be useful on update, in case
    the unique field's value is being updated. But if the value
    stays the same, the validation reported an error.
    
    This is now fixed, as the current record is being ignored
    when searching for conflicting records in the database.
    
    * Simplify try block.
    
    As discussed in #263
    
    * Simplify query.
    
    As discussed in #263
Commits on Jul 2, 2018
  1. Infers the table name, closes #231 (#257)

    hanneskaeufler authored and paulcsmith committed Jul 2, 2018
    * Infers the table name, closes #231
    
    * Remove useless parens
    
    * Convert inferred table name to pluralized underscored
    
    * More sophisticated table name guessing with inflector
    
    * Revert to one version of #setup for arbitrary combination of args
    
    * s/gitbug/github
    
    * Avoid trailing 'unless' for clarity
  2. UUID support as primary key (#254)

    hanneskaeufler authored and paulcsmith committed Jul 2, 2018
    * Pass primary_key_type into the table macro
    
    * Add slightly working uuid ids for records
    
    Using of actual crystal uuids is still in the works.
    
    * Truncate tables after before each spec, not after
    
    So that the content is expectable
    
    * Try to use crystal UUIDs as column types
    
    * Working uuid sample
    
    * Improve test coverage and handle failed casts
    
    * Add comment in migration to remind for lucky_migrator change
    
    * Dont always generate a new uuid
    
    * Fix formatting
    
    * Allow manually setting a uuid id value
    
    * Clean up imports
    
    * More fitting spec title
    
    * Add spec for form#create with uuids
    
    * Make associations work with uuids
    
    * Format fixes
    
    * Simplify owner id by introducing constant
    
    * Add spec for uuid belongs_to
    
    * Preload uuid backed belongs_to associations
    
    * Working uuid based has_many assocs
    
    * Add spec for preloading has_many
    
    * Use lucky_migrator in master branch for now
    
    * Introduce type for primary key type
    
    * Remove comments, see luckyframework/lucky_migrator#113 instead