Liking cljdoc? Tell your friends :D

fx.migrate


->add-ddlclj

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

->array-typeclj

(->array-type type)

Returns supported by Postgres array type

Returns supported by Postgres array type
sourceraw docstring

->column-nameclj

(->column-name entity field-name)
source

->constraint-nameclj

(->constraint-name table column constraint)
source

->constraints-drop-ddlclj

(->constraints-drop-ddl entity columns)

Converts table fields to the list of HoneySQL drop clauses

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

->drop-ddlclj

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

->set-ddlclj

(->set-ddl entity columns)

Converts table fields to the list of HoneySQL alter clauses

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

add-enum-valueclj

(add-enum-value enum value)
source

alter-table-ddlclj

(alter-table-ddl table changes)

Returns HoneySQL formatted map representing alter SQL clause

Returns HoneySQL formatted map representing alter SQL clause
sourceraw 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
sourceraw docstring

clean-up-entitiesclj

(clean-up-entities entities)
source

column->constraints-mapclj

(column->constraints-map {:keys [nullable pk-name fkcolumn-name pktable-name
                                 column-def non-unique delete-rule]})

Convert table field map to field constraints map

Convert table field map to field constraints map
sourceraw docstring

column->modifiersclj

(column->modifiers entity col-name column)

Converts field to HoneySQL vector definition

Converts field to HoneySQL vector definition
sourceraw docstring

column-name?clj

source

column-typeclj

source

create-enumclj

(create-enum entity enum migrations)
source

create-enum-ddlclj

(create-enum-ddl enum values)

Returns HoneySQL formatted map representing create enum SQL clause

Returns HoneySQL formatted map representing create enum SQL clause
sourceraw 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
sourceraw 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
sourceraw docstring

default-column-sizeclj

source

default-path-patternclj

source

drop-enum-ddlclj

(drop-enum-ddl enum)

Returns HoneySQL formatted map representing drop enum SQL clause

Returns HoneySQL formatted map representing drop enum SQL clause
sourceraw docstring

drop-migrations!clj

(drop-migrations! database rollback-migrations)

Rollback all changes made by apply-migrations! call

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

drop-table-ddlclj

(drop-table-ddl table)

Returns HoneySQL formatted map representing drop SQL clause

Returns HoneySQL formatted map representing drop SQL clause
sourceraw 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]] ...]
sourceraw 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
sourceraw docstring

enum-exist?clj

(enum-exist? database enum)
source

extract-db-columnsclj

(extract-db-columns database table)

Returns all table fields metadata

Returns all table fields metadata
sourceraw docstring

extract-default-valclj

(extract-default-val column-def)

Parse column definition and return a default value

Parse column definition and return a default value
sourceraw 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'
sourceraw 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
sourceraw docstring

get-db-enum-valuesclj

(get-db-enum-values database enum)
source

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}}
sourceraw 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'}}
sourceraw docstring

get-ref-tableclj

(get-ref-table entity field)
source

get-ref-typeclj

(get-ref-type entity-key)

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]
sourceraw 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
sourceraw docstring

has-migration?clj

(has-migration? entity)
source

index-by-nameclj

source

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
sourceraw docstring

migratable-propsclj

source

prep-changesclj

(prep-changes entity 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
sourceraw 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)
sourceraw docstring

raw-table-fieldclj

source

schema->column-modifiersclj

(schema->column-modifiers entity field-key field-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]]
sourceraw docstring

schema->column-typeclj

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

Given a field type and optional properties will return a unified (simplified) type representation. Few implementation notes: interval with fields - only DAY, HOUR, MINUTE and SECOND supported due to conversion from Duration class time with timezone doesn't really work - zone part is missed somewhere in between DB and PGDriver

Given a field type and optional properties will return a unified (simplified) type representation.
Few implementation notes:
interval with fields - only DAY, HOUR, MINUTE and SECOND supported due to conversion from Duration class
time with timezone doesn't really work - zone part is missed somewhere in between DB and PGDriver
sourceraw docstring

schema->constraints-mapclj

(schema->constraints-map entry-schema)

Converts entity field spec to a map of fields constraints used primarily for diffing states e.g. {:optional false :primary-key true}

Converts entity field spec to a map of fields constraints
used primarily for diffing states
e.g. {:optional false :primary-key true}
sourceraw 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
sourceraw 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
sourceraw docstring

table-exist?clj

(table-exist? database table)

Checks if table exists in database

Checks if table exists in database
sourceraw docstring

table-fieldclj

source

table-field-constraintsclj

source

table-fieldsclj

source

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])
sourceraw docstring

update-enumclj

(update-enum database entity enum migrations)
source

update-tableclj

(update-table database entity table migrations)

Adds two SQL commands to update fields and to roll back all updates

Adds two SQL commands to update fields and to roll back all updates
sourceraw 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
sourceraw docstring

vars-matcherclj

Regex that matches string template variables

Regex that matches string template variables
sourceraw docstring

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

× close