|
1318 | 1318 | (assoc-in db [:schema e-ident a-ident] v-ident)))))
|
1319 | 1319 |
|
1320 | 1320 | (defn update-rschema [db]
|
1321 |
| - (assoc db :rschema (rschema (get-schema db)))) |
| 1321 | + (assoc db :rschema (rschema (merge implicit-schema (get-schema db))))) |
1322 | 1322 |
|
1323 | 1323 | ;; In context of `with-datom` we can use faster comparators which
|
1324 | 1324 | ;; do not check for nil (~10-15% performance gain in `transact`)
|
|
1615 | 1615 | {:error :transact/syntax, :tempids unused})))
|
1616 | 1616 | (dissoc report ::value-tempids ::tx-redundant)))
|
1617 | 1617 |
|
| 1618 | +(defn check-schema-update [db entity] |
| 1619 | + (when (ds/schema-entity? entity) |
| 1620 | + (when (and (contains? entity :db/ident) |
| 1621 | + (ds/is-system-keyword? (:db/ident entity))) |
| 1622 | + (raise "Using namespace 'db' for attribute identifiers is not allowed" |
| 1623 | + {:error :transact/schema :entity entity})) |
| 1624 | + (when (or (:db/cardinality entity) (:db/valueType entity)) |
| 1625 | + (when-not (ds/schema? entity) |
| 1626 | + (raise "Incomplete schema transaction attributes, expected :db/ident, :db/cardinality" |
| 1627 | + {:error :transact/schema :entity entity}))))) |
| 1628 | + |
1618 | 1629 | (defn+ transact-tx-data [initial-report initial-es]
|
1619 | 1630 | (when-not (or (nil? initial-es)
|
1620 | 1631 | (sequential? initial-es))
|
|
1653 | 1664 |
|
1654 | 1665 | (map? entity)
|
1655 | 1666 | (let [old-eid (:db/id entity)]
|
| 1667 | + (check-schema-update db entity) |
1656 | 1668 | (cond+
|
1657 | 1669 | ;; trivial entity
|
1658 | 1670 | ; (if (contains? entity :db/id)
|
|
0 commit comments