Skip to content

Instantly share code, notes, and snippets.

@gurdasnijor
Created November 9, 2015 18:53
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save gurdasnijor/03e9ea105ed77775367c to your computer and use it in GitHub Desktop.
(def dataset-schema [{:db/id #db/id [:db.part/db]
:db/ident :dataset/id
:db/valueType :db.type/uuid
:db/cardinality :db.cardinality/one
:db/unique :db.unique/identity
:db/index true
:db/doc "The globally unique id for a dataset"
:db.install/_attribute :db.part/db}
{:db/id #db/id [:db.part/db]
:db/ident :dataset/name
:db/valueType :db.type/string
:db/cardinality :db.cardinality/one
:db/doc "The name of the dataset"
:db.install/_attribute :db.part/db}
{:db/id #db/id [:db.part/db]
:db/ident :dataset/description
:db/valueType :db.type/string
:db/cardinality :db.cardinality/one
:db/doc "The description for the dataset"
:db.install/_attribute :db.part/db}
{:db/id #db/id [:db.part/db]
:db/ident :dataset/year
:db/valueType :db.type/bigint
:db/cardinality :db.cardinality/one
:db/doc "The dataset year"
:db.install/_attribute :db.part/db}
{:db/id #db/id [:db.part/db]
:db/ident :dataset/month
:db/valueType :db.type/bigint
:db/cardinality :db.cardinality/one
:db/doc "The dataset month"
:db.install/_attribute :db.part/db}
{:db/id #db/id [:db.part/db]
:db/ident :dataset/type
:db/valueType :db.type/string
:db/cardinality :db.cardinality/one
:db/doc "The dataset type (Actual/Budget/etc)"
:db.install/_attribute :db.part/db}])
(def lines-schema [{:db/id #db/id [:db.part/db]
:db/ident :line/nodes
:db/valueType :db.type/ref
:db/cardinality :db.cardinality/many
:db.install/_attribute :db.part/db
:db/doc "The CoA nodes associated with a line"}
{:db/id #db/id [:db.part/db]
:db/ident :line/dataset
:db/valueType :db.type/ref
:db/cardinality :db.cardinality/one
:db.install/_attribute :db.part/db
:db/doc "The dataset this line exists in"}
{:db/id #db/id [:db.part/db]
:db/ident :line/amount
:db/valueType :db.type/double
:db/cardinality :db.cardinality/one
:db/doc "The amount for this GL line"
:db.install/_attribute :db.part/db}
{:db/id #db/id [:db.part/db]
:db/ident :line/units
:db/valueType :db.type/string
:db/cardinality :db.cardinality/one
:db/doc "The currency units for this line"
:db.install/_attribute :db.part/db}
{:db/id #db/id [:db.part/db]
:db/ident :line/ledgerType
:db/index true
:db/valueType :db.type/string
:db/cardinality :db.cardinality/one
:db/doc "The type of ledger for this line (exp/rev/equity/etc)"
:db.install/_attribute :db.part/db}])
(def node-schema [{:db/id #db/id [:db.part/db]
:db/ident :node/id
:db/valueType :db.type/uuid
:db/cardinality :db.cardinality/one
:db/unique :db.unique/identity
:db/index true
:db/doc "The globally unique id for a CoA node"
:db.install/_attribute :db.part/db}
{:db/id #db/id [:db.part/db]
:db/ident :node/tree
:db/valueType :db.type/ref
:db/cardinality :db.cardinality/one
:db.install/_attribute :db.part/db
:db/doc "The tree this node is associated with"}
{:db/id #db/id [:db.part/db]
:db/ident :node/category
:db/valueType :db.type/bigint
:db/cardinality :db.cardinality/one
:db/doc "The depth of the node in the tree"
:db.install/_attribute :db.part/db}
{:db/id #db/id [:db.part/db]
:db/ident :node/order
:db/valueType :db.type/bigint
:db/cardinality :db.cardinality/one
:db/doc "The order of the node in its sibling group"
:db.install/_attribute :db.part/db}
{:db/id #db/id [:db.part/db]
:db/ident :node/name
:db/valueType :db.type/string
:db/cardinality :db.cardinality/one
:db/doc "The description for this node"
:db.install/_attribute :db.part/db}
{:db/id #db/id [:db.part/db]
:db/ident :node/parent
:db/valueType :db.type/ref
:db/cardinality :db.cardinality/one
:db.install/_attribute :db.part/db
:db/doc "A reference to the parent node"}])
(def tree-schema [{:db/id #db/id [:db.part/db]
:db/ident :tree/id
:db/valueType :db.type/uuid
:db/cardinality :db.cardinality/one
:db/unique :db.unique/identity
:db/index true
:db/doc "The globally unique id for a CoA tree"
:db.install/_attribute :db.part/db}
{:db/id #db/id [:db.part/db]
:db/ident :tree/order
:db/valueType :db.type/bigint
:db/cardinality :db.cardinality/one
:db/doc "The order of the tree"
:db.install/_attribute :db.part/db}
{:db/id #db/id [:db.part/db]
:db/ident :tree/name
:db/valueType :db.type/string
:db/cardinality :db.cardinality/one
:db/doc "The description for this node"
:db.install/_attribute :db.part/db}
{:db/id #db/id [:db.part/db]
:db/ident :tree/ledgerType
:db/valueType :db.type/string
:db/cardinality :db.cardinality/one
:db/doc "The type of ledger for this tree (exp/rev/equity/etc)"
:db.install/_attribute :db.part/db}])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment