Liking cljdoc? Tell your friends :D

fx.migrate


->add-ddlclj

(->add-ddl all-columns cols-to-add)

->constraints-drop-ddlclj

(->constraints-drop-ddl columns)

Converts table fields to the list of HoneySQL drop clauses

Converts table fields to the list of HoneySQL drop clauses
raw docstring

->drop-ddlclj

(->drop-ddl cols-to-delete)

->set-ddlclj

(->set-ddl columns)

Converts table fields to the list of HoneySQL alter clauses

Converts table fields to the list of HoneySQL alter clauses
raw docstring

alter-table-ddlclj

(alter-table-ddl table changes)

Returns HoneySQL formatted map representing alter SQL clause

Returns HoneySQL formatted map representing alter SQL clause
raw docstring

apply-migrations!clj

(apply-migrations! {:keys [database entities]})

Generates and applies migrations related to entities on database All migrations run in a single transaction

Generates and applies migrations related to entities on database
All migrations run in a single transaction
raw docstring

column->constraints-mapclj

(column->constraints-map {:keys [nullable pk-name fkcolumn-name pktable-name]})

Convert table field map to field constraints map

Convert table field map to field constraints map
raw docstring

column->modifiersclj

(column->modifiers column)

Converts field to HonetSQL vector definition

Converts field to HonetSQL vector definition
raw docstring

create-tableclj

(create-table entity table migrations)

Adds two SQL commands to create DB table and to delete this table

Adds two SQL commands to create DB table and to delete this table
raw docstring

create-table-ddlclj

(create-table-ddl table columns)

Returns HoneySQL formatted map representing create SQL clause

Returns HoneySQL formatted map representing create SQL clause
raw docstring

default-column-sizeclj


default-path-patternclj


drop-migrations!clj

(drop-migrations! database rollback-migrations)

Rollback all changes made by apply-migrations! call

Rollback all changes made by apply-migrations! call
raw docstring

drop-table-ddlclj

(drop-table-ddl table)

Returns HoneySQL formatted map representing drop SQL clause

Returns HoneySQL formatted map representing drop SQL clause
raw docstring

entity->columns-ddlclj

(entity->columns-ddl entity)

Converts entity spec to a list of HoneySQL vectors representing individual fields e.g. [[:id :uuid [:not nil] [:primary-key]] ...]

Converts entity spec to a list of HoneySQL vectors representing individual fields
e.g. [[:id :uuid [:not nil] [:primary-key]] ...]
raw docstring

entity->migrationclj

(entity->migration database migrations entity)

Given an entity will check if some updates were introduced If so will return a set of SQL migrations string

Given an entity will check if some updates were introduced
If so will return a set of SQL migrations string
raw docstring

extract-db-columnsclj

(extract-db-columns database table)

Returns all table fields metadata

Returns all table fields metadata
raw docstring

get-all-migrationsclj

(get-all-migrations database entities)

Returns a two-dimensional vector of migration strings for all changed entities. For each entity will be two items 'SQL to apply changes' followed with 'SQL to drop changes'

Returns a two-dimensional vector of migration strings for all changed entities.
For each entity will be two items 'SQL to apply changes' followed with 'SQL to drop changes'
raw docstring

get-db-columnsclj

(get-db-columns database table)

Fetches the table fields definition and convert them to simplified Clojure maps

Fetches the table fields definition and convert them to simplified Clojure maps
raw docstring

get-entity-columnsclj

(get-entity-columns entity)

Given an entity will return a simplified representation of its fields as Clojure map e.g. {:id {:type uuid? :optional false :primary-key? true} :name {:type string? :optional true}}

Given an entity will return a simplified representation of its fields as Clojure map
e.g. {:id    {:type uuid?   :optional false :primary-key? true}
       :name {:type string? :optional true}}
raw docstring

get-entity-migrations-mapclj

(get-entity-migrations-map database entities)

Returns a map of shape {:entity/name {:up 'SQL to apply changes' :down 'SQL to drop changes'}}

Returns a map of shape {:entity/name {:up 'SQL to apply changes' :down 'SQL to drop changes'}}
raw docstring

get-ref-typeclj

(get-ref-type entity)

Given an entity name will find a primary key field and return its type. e.g. :my/user -> :uuid Type could be complex e.g. [:string 250]

Given an entity name will find a primary key field and return its type.
e.g. :my/user -> :uuid
Type could be complex e.g. [:string 250]
raw docstring

has-changes?clj

(has-changes? db-columns entity-columns)

Given the simplified existing and updated fields definition will return true if there's a difference between them, otherwise false

Given the simplified existing and updated fields definition
will return true if there's a difference between them, otherwise false
raw docstring

index-by-nameclj


interpolateclj

(interpolate template replacement)

Takes a template string with ${} placeholders and a hashmap with replacement values. Returns interpolated string

Takes a template string with ${} placeholders and a hashmap with replacement values.
Returns interpolated string
raw docstring

prep-changesclj

(prep-changes db-columns entity-columns)

Given the simplified existing and updated fields definition will return a set of HoneySQL clauses to eliminate the difference

Given the simplified existing and updated fields definition
will return a set of HoneySQL clauses to eliminate the difference
raw docstring

prep-migrationsclj

(prep-migrations database entities)

Generates migrations for all entities in the system (forward and backward)

Generates migrations for all entities in the system (forward and backward)
raw docstring

raw-table-fieldclj


schema->column-modifiersclj

(schema->column-modifiers entry-schema)

Given an entity schema will return a vector of SQL field constraints, shaped as HoneySQL clauses e.g. [[:not nil] [:primary-key]]

Given an entity schema will return a vector of SQL field constraints, shaped as HoneySQL clauses
e.g. [[:not nil] [:primary-key]]
raw docstring

schema->column-typeclj

(schema->column-type {:keys [type props]})

Given a field type and optional properties will return a unified (simplified) type representation

Given a field type and optional properties will return a unified (simplified) type representation
raw docstring

schema->constraints-mapclj

(schema->constraints-map entry-schema)

Converts entity field spec to a map of fields constraints e.g. {:optional false :primary-key? true}

Converts entity field spec to a map of fields constraints
e.g. {:optional false :primary-key? true}
raw docstring

sort-by-dependenciesclj

(sort-by-dependencies entities)

According to dependencies between entities will sort them in the topological order

According to dependencies between entities will sort them in the topological order
raw docstring

store-migrations!clj

(store-migrations! {:keys [database entities clock path-pattern path-params]
                    :or {clock (Clock/systemUTC)}})

Writes entities migrations code into files in .edn format

Writes entities migrations code into files in .edn format
raw docstring

table-exist?clj

(table-exist? database table)

Checks if table exists in database

Checks if table exists in database
raw docstring

table-fieldclj


table-field-constraintsclj


table-fieldsclj


unzipclj

(unzip coll)

Reverse operation to interleave function e.g. [1 2 3 4] -> ([1 3] [2 4])

Reverse operation to interleave function
e.g. [1 2 3 4] -> ([1 3] [2 4])
raw docstring

update-tableclj

(update-table database entity table migrations)

Adds two SQL commands to update fields and to rollback all updates

Adds two SQL commands to update fields and to rollback all updates
raw docstring

validate-schema!clj

(validate-schema! {:keys [database entities]})

Compares DB schema with entities specs. Returns true if there's no changes false otherwise

Compares DB schema with entities specs.
Returns true if there's no changes false otherwise
raw docstring

vars-matcherclj

Regex that matches string template variables

Regex that matches string template variables
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close