Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/recipe-books.git
sql/nomenclature.png
Binary files differ
sql/nomenclature.svg
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="529.3869"
+ height="626.52979"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.48+devel r10022"
+ sodipodi:docname="nomenclature.svg"
+ inkscape:export-filename="/home/jarvisd/htdocs/www.recipezeal.com/book/sql/nomenclature.png"
+ inkscape:export-xdpi="99.979286"
+ inkscape:export-ydpi="99.979286">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="0.7"
+ inkscape:cx="183.97918"
+ inkscape:cy="300.40777"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="false"
+ inkscape:window-width="1409"
+ inkscape:window-height="979"
+ inkscape:window-x="100"
+ inkscape:window-y="352"
+ inkscape:window-maximized="0"
+ fit-margin-top="0"
+ fit-margin-left="0"
+ fit-margin-right="0"
+ fit-margin-bottom="0" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(-108.16367,-206.24015)">
+ <rect
+ style="color:#000000;fill:#aacad5;fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:0.81550425;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="rect10"
+ width="528.57141"
+ height="625.71429"
+ x="108.57143"
+ y="206.6479"
+ rx="40.128822"
+ ry="40.128822" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot783"
+ style="font-size:40px;font-style:normal;font-variant:normal;font-weight:600;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bookman Old Style;-inkscape-font-specification:Bookman Old Style Semi-Bold"
+ transform="translate(243.93526,94.285715)"><flowRegion
+ id="flowRegion785"><rect
+ id="rect787"
+ width="114.2857"
+ height="52.857147"
+ x="75.714287"
+ y="120.93361"
+ style="font-size:40px;font-style:normal;font-variant:normal;font-weight:600;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bookman Old Style;-inkscape-font-specification:Bookman Old Style Semi-Bold" /></flowRegion><flowPara
+ id="flowPara789">Book</flowPara></flowRoot> <rect
+ ry="31.30117"
+ rx="31.30117"
+ y="275.4711"
+ x="166.70975"
+ height="488.0679"
+ width="412.29477"
+ id="rect791"
+ style="color:#000000;fill:#c9e0e6;fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:0.63610733;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
+ <flowRoot
+ transform="matrix(0.93886932,0,0,0.93886932,235.8904,174.69784)"
+ style="font-size:40px;font-style:normal;font-variant:normal;font-weight:600;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bookman Old Style;-inkscape-font-specification:Bookman Old Style Semi-Bold"
+ id="flowRoot793"
+ xml:space="preserve"><flowRegion
+ id="flowRegion795"><rect
+ style="font-size:40px;font-style:normal;font-variant:normal;font-weight:600;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bookman Old Style;-inkscape-font-specification:Bookman Old Style Semi-Bold"
+ y="120.93361"
+ x="75.714287"
+ height="48.571434"
+ width="161.42856"
+ id="rect797" /></flowRegion><flowPara
+ id="flowPara799">Theme</flowPara></flowRoot> <rect
+ style="color:#000000;fill:#e0e9ee;fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:0.45759931;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="rect801"
+ width="296.5943"
+ height="351.10355"
+ x="224.55998"
+ y="343.95328"
+ rx="22.51726"
+ ry="22.51726" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot803"
+ style="font-size:40px;font-style:normal;font-variant:normal;font-weight:600;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bookman Old Style;-inkscape-font-specification:Bookman Old Style Semi-Bold"
+ transform="matrix(0.84108016,0,0,0.84108016,250.66561,254.12253)"><flowRegion
+ id="flowRegion805"><rect
+ id="rect807"
+ width="161.42856"
+ height="48.571434"
+ x="75.714287"
+ y="120.93361"
+ style="font-size:40px;font-style:normal;font-variant:normal;font-weight:600;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bookman Old Style;-inkscape-font-specification:Bookman Old Style Semi-Bold" /></flowRegion><flowPara
+ id="flowPara809">Aspect</flowPara></flowRoot> <rect
+ ry="13.550352"
+ rx="13.550352"
+ y="413.86215"
+ x="283.61545"
+ height="211.28577"
+ width="178.4834"
+ id="rect811"
+ style="color:#000000;fill:#dccda4;fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:0.27537239;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
+ <flowRoot
+ transform="matrix(0.69428273,0,0,0.69428273,264.32394,350.47277)"
+ style="font-size:40px;font-style:normal;font-variant:normal;font-weight:600;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bookman Old Style;-inkscape-font-specification:Bookman Old Style Semi-Bold"
+ id="flowRoot813"
+ xml:space="preserve"><flowRegion
+ id="flowRegion815"><rect
+ style="font-size:40px;font-style:normal;font-variant:normal;font-weight:600;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bookman Old Style;-inkscape-font-specification:Bookman Old Style Semi-Bold"
+ y="120.93361"
+ x="75.714287"
+ height="48.571434"
+ width="161.42856"
+ id="rect817" /></flowRegion><flowPara
+ id="flowPara819">Snippet</flowPara></flowRoot> <rect
+ style="color:#000000;fill:#99886e;fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:0.12289681;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="rect821"
+ width="79.655914"
+ height="94.295387"
+ x="333.02921"
+ y="490.92877"
+ rx="6.0474291"
+ ry="6.0474291" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot823"
+ style="font-size:40px;font-style:normal;font-variant:normal;font-weight:600;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Bookman Old Style;-inkscape-font-specification:Bookman Old Style Semi-Bold"
+ transform="matrix(0.2643498,-0.45786727,0.45786727,0.2643498,267.76526,564.20324)"><flowRegion
+ id="flowRegion825"><rect
+ id="rect827"
+ width="161.42856"
+ height="48.571434"
+ x="75.714287"
+ y="120.93361"
+ style="font-size:40px;font-style:normal;font-variant:normal;font-weight:600;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#ffffff;fill-opacity:1;font-family:Bookman Old Style;-inkscape-font-specification:Bookman Old Style Semi-Bold" /></flowRegion><flowPara
+ id="flowPara829">LaTeX</flowPara></flowRoot> </g>
+</svg>
sql/recipe-book.dbs
-<?xml version="1.0" encoding="UTF-8" ?>
-<project name="recipe" database="PostgreSQL" >
- <schema name="public" catalogname="recipe" schemaname="public" defo="y" >
- <table name="xpath_relations" >
- <comment>Map of tables and columns to XPaths for use in creating XML documents.</comment>
- <column name="id" type="bigserial" length="19" jt="-5" mandatory="y" >
- <defo>nextval(&#039;xpath_relations_id_seq&#039;::regclass)</defo>
- <comment> <![CDATA[Uniquely identifies each row.]]> </comment>
- </column>
- <column name="table_name" type="varchar" length="64" jt="12" >
- <comment> <![CDATA[Name of a table.]]> </comment>
- </column>
- <column name="column_name" type="varchar" length="64" jt="12" >
- <comment> <![CDATA[Name of a column in the table.]]> </comment>
- </column>
- <column name="relation" type="varchar" length="3" jt="12" >
- <comment> <![CDATA[Type of relationship between the table_ and column_name and XPath expression. For example: >, ->, =>.]]> </comment>
- </column>
- <column name="expression" type="varchar" length="128" jt="12" >
- <comment> <![CDATA[Expression that defines how to construct the XML document. This is usually an XPath expression, but could also be a fully qualified PK in a PK-FK relationship.]]> </comment>
- </column>
- <column name="document_name" type="varchar" length="64" jt="12" >
- <comment> <![CDATA[GROUP BY condition for the mapping.]]> </comment>
- </column>
- <column name="schema_name" type="varchar" length="64" jt="12" >
- <comment> <![CDATA[Name of a schema in which the table exists.]]> </comment>
- </column>
- <index name="pk_xpath_relations" unique="PRIMARY_KEY" >
- <column name="id" />
- </index>
- </table>
- <sequence name="xpath_relations_id_seq" start="1" />
- <function name="execute_xpath" >
- <string> <![CDATA[CREATE OR REPLACE FUNCTION public.execute_xpath(document_name text)
- RETURNS text
- LANGUAGE plpgsql
-AS $function$
-BEGIN
-
-END;
-$function$
-]]> </string>
- </function>
- </schema>
- <schema name="recipe" schemaname="recipe" defo="y" >
- <table name="account" >
- <comment>List of accounts used by people to author recipes.</comment>
- <column name="id" type="bigserial" length="19" jt="-5" mandatory="y" >
- <defo>nextval(&#039;accounts_id_seq&#039;::regclass)</defo>
- <comment> <![CDATA[Uniquely identifies each account.]]> </comment>
- </column>
- <column name="email" type="varchar" length="256" jt="12" mandatory="y" >
- <comment> <![CDATA[Email address associated with the account.]]> </comment>
- </column>
- <column name="created" type="date" jt="91" mandatory="y" >
- <defo>(&#039;now&#039;::text)::date</defo>
- <comment> <![CDATA[Date the account was created.]]> </comment>
- </column>
- <column name="updated" type="date" jt="91" >
- <comment> <![CDATA[Date the account was last updated.]]> </comment>
- </column>
- <column name="deleted" type="date" jt="91" >
- <comment> <![CDATA[Date the account was deleted.]]> </comment>
- </column>
- <index name="pk_accounts" unique="PRIMARY_KEY" >
- <column name="id" />
- </index>
- </table>
- <table name="action" >
- <comment>Name of an action that begins any given step.</comment>
- <column name="id" type="bigserial" length="19" jt="-5" mandatory="y" >
- <defo>nextval(&#039;action_id_seq&#039;::regclass)</defo>
- <comment> <![CDATA[Uniquely identifies the action.]]> </comment>
- </column>
- <column name="label" type="varchar" length="15" jt="12" mandatory="y" >
- <comment> <![CDATA[Name of this action (e.g., cut, fry, mash, slice).]]> </comment>
- </column>
- <index name="pk_action" unique="PRIMARY_KEY" >
- <column name="id" />
- </index>
- </table>
- <table name="cuisine" >
- <comment>All known cuisines.</comment>
- <column name="id" type="bigserial" length="19" jt="-5" mandatory="y" >
- <defo>nextval(&#039;cuisine_id_seq&#039;::regclass)</defo>
- <comment> <![CDATA[Uniquely identifies the known cuisines.]]> </comment>
- </column>
- <column name="label" type="varchar" length="30" jt="12" mandatory="y" />
- <index name="pk_cuisine" unique="PRIMARY_KEY" >
- <column name="id" />
- </index>
- <index name="idx_cuisine_label" unique="UNIQUE" >
- <column name="label" />
- </index>
- </table>
- <table name="description" >
- <comment>Meta data about the recipe.</comment>
- <column name="id" type="bigserial" length="19" jt="-5" mandatory="y" >
- <defo>nextval(&#039;description_id_seq&#039;::regclass)</defo>
- <comment> <![CDATA[Uniquely identifies this row.]]> </comment>
- </column>
- <column name="recipe_id" type="bigserial" length="19" jt="-5" mandatory="y" >
- <defo>nextval(&#039;description_recipe_id_seq&#039;::regclass)</defo>
- <comment> <![CDATA[Every recipe is uniquely identified.]]> </comment>
- </column>
- <column name="cuisine_id" type="bigserial" length="19" jt="-5" mandatory="y" >
- <defo>nextval(&#039;description_cuisine_id_seq&#039;::regclass)</defo>
- <comment> <![CDATA[Uniquely identifies the known cuisines.]]> </comment>
- </column>
- <column name="title" type="varchar" length="55" jt="12" mandatory="y" >
- <comment> <![CDATA[Recipe title.]]> </comment>
- </column>
- <column name="diet_id" type="bigserial" length="19" jt="-5" mandatory="y" >
- <defo>nextval(&#039;description_diet_id_seq&#039;::regclass)</defo>
- <comment> <![CDATA[Uniquely identifies the row.]]> </comment>
- </column>
- <index name="pk_description" unique="PRIMARY_KEY" >
- <column name="id" />
- </index>
- <index name="idx_description" unique="NORMAL" >
- <column name="recipe_id" />
- </index>
- <index name="idx_description_0" unique="NORMAL" >
- <column name="cuisine_id" />
- </index>
- <index name="idx_description_1" unique="NORMAL" >
- <column name="diet_id" />
- </index>
- <fk name="fk_description" to_schema="recipe" to_table="recipe" delete_action="CASCADE" >
- <fk_column name="recipe_id" pk="id" />
- </fk>
- <fk name="fk_description_cuisine" to_schema="recipe" to_table="cuisine" delete_action="CASCADE" >
- <fk_column name="cuisine_id" pk="id" />
- </fk>
- <fk name="fk_description_diet" to_schema="recipe" to_table="diet" delete_action="CASCADE" >
- <fk_column name="diet_id" pk="id" />
- </fk>
- </table>
- <table name="diet" >
- <comment>Types of diets.</comment>
- <column name="id" type="bigserial" length="19" jt="-5" mandatory="y" >
- <defo>nextval(&#039;diet_id_seq&#039;::regclass)</defo>
- <comment> <![CDATA[Uniquely identifies the row.]]> </comment>
- </column>
- <column name="label" type="varchar" length="15" jt="12" mandatory="y" >
- <comment> <![CDATA[The diet's name.]]> </comment>
- </column>
- <index name="pk_diet" unique="PRIMARY_KEY" >
- <column name="id" />
- </index>
- </table>
- <table name="direction" >
- <comment>Represents a single step in the set of directions that belong to a direction group.</comment>
- <column name="id" type="bigserial" length="19" jt="-5" mandatory="y" >
- <defo>nextval(&#039;direction_id_seq&#039;::regclass)</defo>
- <comment> <![CDATA[Uniquely identifies this instruction.]]> </comment>
- </column>
- <column name="instruction" type="varchar" length="100" jt="12" mandatory="y" >
- <comment> <![CDATA[Each step in the directions should be a short blurb that describes what to do with the action.]]> </comment>
- </column>
- <column name="min_time" type="int2" jt="5" mandatory="y" >
- <defo>1</defo>
- <comment> <![CDATA[The minimum amount of time the step requires.]]> </comment>
- </column>
- <column name="max_time" type="int2" jt="5" >
- <comment> <![CDATA[The maximum amount of time the step requires.]]> </comment>
- </column>
- <column name="action_id" type="bigserial" length="19" jt="-5" mandatory="y" >
- <defo>nextval(&#039;direction_action_id_seq&#039;::regclass)</defo>
- <comment> <![CDATA[Uniquely identifies the action.]]> </comment>
- </column>
- <column name="direction_group_id" type="bigserial" length="19" jt="-5" mandatory="y" >
- <defo>nextval(&#039;direction_direction_group_id_seq&#039;::regclass)</defo>
- <comment> <![CDATA[Associates a step in directions with a group of directions.]]> </comment>
- </column>
- <column name="seq" type="int2" jt="5" mandatory="y" >
- <defo>1</defo>
- <comment> <![CDATA[Sequence of steps to complete the directions.]]> </comment>
- </column>
- <index name="pk_direction" unique="PRIMARY_KEY" >
- <column name="id" />
- </index>
- <index name="idx_direction" unique="NORMAL" >
- <column name="action_id" />
- </index>
- <index name="idx_direction_0" unique="NORMAL" >
- <column name="direction_group_id" />
- </index>
- <fk name="fk_direction" to_schema="recipe" to_table="action" delete_action="CASCADE" >
- <fk_column name="action_id" pk="id" />
- </fk>
- <fk name="fk_direction_group_direction_id" to_schema="recipe" to_table="direction_group" delete_action="CASCADE" >
- <fk_column name="direction_group_id" pk="id" />
- </fk>
- </table>
- <table name="direction_group" >
- <comment>Joins ingredient groups to recipes.</comment>
- <column name="id" type="bigserial" length="19" jt="-5" mandatory="y" >
- <defo>nextval(&#039;recipe_ingredient_group_0_id_seq&#039;::regclass)</defo>
- <comment> <![CDATA[Uniquely identifies the row that associates a recipe with an ingredient group.]]> </comment>
- </column>
- <column name="recipe_id" type="bigserial" length="19" jt="-5" mandatory="y" >
- <defo>nextval(&#039;recipe_direction_group_recipe_id_seq&#039;::regclass)</defo>
- <comment> <![CDATA[Every recipe is uniquely identified.]]> </comment>
- </column>
- <column name="label" type="varchar" length="30" jt="12" mandatory="y" >
- <comment> <![CDATA[Name of a set of directions.]]> </comment>
- </column>
- <index name="pk_recipe_ingredient_group_0" unique="PRIMARY_KEY" >
- <column name="id" />
- </index>
- <index name="idx_recipe_direction_group" unique="NORMAL" >
- <column name="recipe_id" />
- </index>
- <fk name="fk_recipe_direction_group" to_schema="recipe" to_table="recipe" delete_action="CASCADE" >
- <fk_column name="recipe_id" pk="id" />
- </fk>
- </table>
- <table name="equipment" >
- <column name="id" type="bigserial" length="19" jt="-5" mandatory="y" >
- <defo>nextval(&#039;equipment_id_seq&#039;::regclass)</defo>
- <comment> <![CDATA[Uniquely identifies the type of equipment required by a recipe.]]> </comment>
- </column>
- <column name="name" type="varchar" length="30" jt="12" mandatory="y" >
- <comment> <![CDATA[Name of the piece of equipment required to make this recipe.]]> </comment>
- </column>
- <column name="abridge" type="varchar" length="15" jt="12" >
- <comment> <![CDATA[Shorter name for this piece of equipment (the alias, were alias not a keyword).]]> </comment>
- </column>
- <column name="equipment_group_id" type="serial" jt="4" mandatory="y" >
- <defo>nextval(&#039;equipment_equipment_group_id_seq&#039;::regclass)</defo>
- <comment> <![CDATA[Uniquely identifies the type of equipment.]]> </comment>
- </column>
- <column name="seq" type="int2" jt="5" mandatory="y" >
- <defo>1</defo>
- <comment> <![CDATA[Uniquely defines the order of each equipment object, independent of group.]]> </comment>
- </column>
- <index name="pk_eqiupment" unique="PRIMARY_KEY" >
- <column name="id" />
- </index>
- <index name="idx_equipment" unique="NORMAL" >
- <column name="equipment_group_id" />
- </index>
- <index name="uk_equipment" unique="UNIQUE" >
- <column name="name" />
- <column name="equipment_group_id" />
- </index>
- <fk name="fk_equipment" to_schema="recipe" to_table="equipment_group" delete_action="CASCADE" >
- <fk_column name="equipment_group_id" pk="id" />
- </fk>
- </table>
- <table name="equipment_group" >
- <column name="id" type="serial" jt="4" mandatory="y" >
- <defo>nextval(&#039;equipment_class_id_seq&#039;::regclass)</defo>
- <comment> <![CDATA[Uniquely identifies the type of equipment.]]> </comment>
- </column>
- <column name="label" type="varchar" length="15" jt="12" mandatory="y" >
- <comment> <![CDATA[cookware, bakeware, kitchenware, utensils, etc.]]> </comment>
- </column>
- <index name="pk_equipment_class" unique="PRIMARY_KEY" >
- <column name="id" />
- </index>
- </table>
- <table name="ingredient" >
- <comment>An ingredient that belongs to an ingredient group, which, in turn, belongs to a recipe.</comment>
- <column name="id" type="bigserial" length="19" jt="-5" mandatory="y" >
- <defo>nextval(&#039;ingredient_id_seq&#039;::regclass)</defo>
- <comment> <![CDATA[Uniquely identifies the ingredient.]]> </comment>
- </column>
- <column name="ingredient_name_id" type="bigserial" length="19" jt="-5" mandatory="y" >
- <defo>nextval(&#039;ingredient_ingredient_name_id_seq&#039;::regclass)</defo>
- </column>
- <column name="ingredient_group_id" type="bigserial" length="19" jt="-5" mandatory="y" >
- <defo>nextval(&#039;ingredient_ingredient_group_id_seq&#039;::regclass)</defo>
- <comment> <![CDATA[The ingredient group that links to this ingredient.]]> </comment>
- </column>
- <column name="min_quantity" type="float4" jt="7" mandatory="y" >
- <comment> <![CDATA[Indicates how much of the ingredient that the recipe requires.]]> </comment>
- </column>
- <column name="max_quantity" type="float4" jt="7" >
- <comment> <![CDATA[Indicates the maximum amount of this ingredient that the recipe requires.]]> </comment>
- </column>
- <column name="scalar" type="int2" jt="5" >
- <comment> <![CDATA[Weight or length (modified by the unit of measurement).]]> </comment>
- </column>
- <column name="unit_id" type="bigserial" length="19" jt="-5" >
- <defo>nextval(&#039;ingredient_unit_id_seq1&#039;::regclass)</defo>
- <comment> <![CDATA[Uniquely identifies this ingredient unit.]]> </comment>
- </column>
- <column name="condition" type="varchar" length="30" jt="12" >
- <comment> <![CDATA[Comma-separated initial preparations for this food item (e.g., "peeled,chopped").]]> </comment>
- </column>
- <column name="required" type="bool" jt="-7" mandatory="y" >
- <defo>true</defo>
- <comment> <![CDATA[Indicates whether the ingredient is optional.]]> </comment>
- </column>
- <column name="seq" type="int2" jt="5" mandatory="y" >
- <defo>1</defo>
- <comment> <![CDATA[Ingredient order (spans ingredient groups).]]> </comment>
- </column>
- <index name="pk_ingredient" unique="PRIMARY_KEY" >
- <column name="id" />
- </index>
- <index name="idx_ingredient_1" unique="NORMAL" >
- <column name="unit_id" />
- </index>
- <index name="idx_ingredient_2" unique="NORMAL" >
- <column name="ingredient_name_id" />
- </index>
- <index name="idx_ingredient" unique="NORMAL" >
- <column name="ingredient_group_id" />
- </index>
- <fk name="fk_ingredient_1" to_schema="recipe" to_table="ingredient_unit" delete_action="CASCADE" >
- <fk_column name="unit_id" pk="id" />
- </fk>
- <fk name="fk_ingredient_2" to_schema="recipe" to_table="ingredient_name" delete_action="CASCADE" >
- <fk_column name="ingredient_name_id" pk="id" />
- </fk>
- <fk name="fk_ingredient_group_id" to_schema="recipe" to_table="ingredient_group" delete_action="CASCADE" >
- <fk_column name="ingredient_group_id" pk="id" />
- </fk>
- </table>
- <table name="ingredient_group" >
- <comment>Joins ingredient groups to recipes.</comment>
- <column name="id" type="bigserial" length="19" jt="-5" mandatory="y" >
- <defo>nextval(&#039;recipe_ingredient_group_id_seq&#039;::regclass)</defo>
- <comment> <![CDATA[Uniquely identifies the row that associates a recipe with an ingredient group.]]> </comment>
- </column>
- <column name="recipe_id" type="bigserial" length="19" jt="-5" mandatory="y" >
- <defo>nextval(&#039;recipe_ingredient_group_recipe_id_seq&#039;::regclass)</defo>
- <comment> <![CDATA[Every recipe is uniquely identified.]]> </comment>
- </column>
- <column name="label" type="varchar" length="30" jt="12" mandatory="y" >
- <comment> <![CDATA[Name of this ingredient group.]]> </comment>
- </column>
- <index name="pk_recipe_ingredient_group" unique="PRIMARY_KEY" >
- <column name="id" />
- </index>
- <index name="idx_recipe_ingredient_group" unique="NORMAL" >
- <column name="recipe_id" />
- </index>
- <fk name="fk_recipe_ingredient_group" to_schema="recipe" to_table="recipe" delete_action="CASCADE" >
- <fk_column name="recipe_id" pk="id" />
- </fk>
- </table>
- <table name="ingredient_name" >
- <comment>List of all the ingredient names in the world.</comment>
- <column name="id" type="bigserial" length="19" jt="-5" mandatory="y" >
- <defo>nextval(&#039;ingredient_name_id_seq&#039;::regclass)</defo>
- <comment> <![CDATA[Uniquely identifies the ingredient.]]> </comment>
- </column>
- <column name="label" type="varchar" length="30" jt="12" mandatory="y" >
- <comment> <![CDATA[Ingredient name.]]> </comment>
- </column>
- <column name="abridge" type="varchar" length="15" jt="12" >
- <comment> <![CDATA[Shorter name for the ingredient.]]> </comment>
- </column>
- <index name="pk_ingredient_name" unique="PRIMARY_KEY" >
- <column name="id" />
- </index>
- <index name="uk_ingredient_label" unique="UNIQUE" >
- <column name="label" />
- </index>
- </table>
- <table name="ingredient_substitute" >
- <column name="id" type="bigserial" length="19" jt="-5" mandatory="y" >
- <defo>nextval(&#039;ingredient_substitute_id_seq&#039;::regclass)</defo>
- <comment> <![CDATA[Uniquely identifies the row.]]> </comment>
- </column>
- <column name="ingredient_id" type="bigserial" length="19" jt="-5" mandatory="y" >
- <defo>nextval(&#039;ingredient_substitute_ingredient_id_seq&#039;::regclass)</defo>
- <comment> <![CDATA[The ingredient that has an associated substitution.]]> </comment>
- </column>
- <column name="substitute_id" type="bigserial" length="19" jt="-5" mandatory="y" >
- <defo>nextval(&#039;ingredient_substitute_substitute_id_seq&#039;::regclass)</defo>
- <comment> <![CDATA[The ingredient that substitutes for ingredient_id.]]> </comment>
- </column>
- <index name="pk_ingredient_substitute" unique="PRIMARY_KEY" >
- <column name="id" />
- </index>
- <index name="idx_ingredient_substitute" unique="NORMAL" >
- <column name="ingredient_id" />
- </index>
- <index name="idx_ingredient_substitute_0" unique="NORMAL" >
- <column name="substitute_id" />
- </index>
- <fk name="fk_ingredient_substitute_ingredient" to_schema="recipe" to_table="ingredient" delete_action="CASCADE" >
- <fk_column name="ingredient_id" pk="id" />
- </fk>
- <fk name="fk_ingredient_substitute_substitute" to_schema="recipe" to_table="ingredient" delete_action="CASCADE" >
- <fk_column name="substitute_id" pk="id" />
- </fk>
- </table>
- <table name="ingredient_unit" >
- <comment>List of possible units (e.g., cup, teaspoon).</comment>
- <column name="id" type="bigserial" length="19" jt="-5" mandatory="y" >
- <defo>nextval(&#039;ingredient_unit_id_seq&#039;::regclass)</defo>
- <comment> <![CDATA[Uniquely identifies this ingredient unit.]]> </comment>
- </column>
- <column name="label" type="varchar" length="15" jt="12" mandatory="y" >
- <comment> <![CDATA[Name of the unit (e.g., teaspoon, tablespoon).]]> </comment>
- </column>
- <index name="pk_unit" unique="PRIMARY_KEY" >
- <column name="id" />
- </index>
- </table>
- <table name="preparation" >
- <column name="id" type="bigserial" length="19" jt="-5" mandatory="y" >
- <defo>nextval(&#039;preparation_id_seq&#039;::regclass)</defo>
- <comment> <![CDATA[Uniquely identifies each row.]]> </comment>
- </column>
- <column name="recipe_id" type="bigserial" length="19" jt="-5" mandatory="y" >
- <defo>nextval(&#039;preparation_recipe_id_seq&#039;::regclass)</defo>
- <comment> <![CDATA[Recipe that requires a prehated oven.]]> </comment>
- </column>
- <column name="temperature" type="float4" jt="7" mandatory="y" >
- <comment> <![CDATA[Oven temperature setting.]]> </comment>
- </column>
- <column name="unit" type="varchar" length="1" jt="12" mandatory="y" >
- <comment> <![CDATA[F, C, or K.]]> </comment>
- </column>
- <index name="pk_preparation" unique="PRIMARY_KEY" >
- <column name="id" />
- </index>
- <index name="idx_preparation" unique="NORMAL" >
- <column name="recipe_id" />
- </index>
- <fk name="fk_preparation_recipe" to_schema="recipe" to_table="recipe" delete_action="CASCADE" >
- <fk_column name="recipe_id" pk="id" />
- </fk>
- </table>
- <table name="recipe" >
- <column name="id" type="bigserial" length="19" jt="-5" mandatory="y" >
- <defo>nextval(&#039;recipe_id_seq&#039;::regclass)</defo>
- <comment> <![CDATA[Every recipe is uniquely identified.]]> </comment>
- </column>
- <column name="account_id" type="bigserial" length="19" jt="-5" mandatory="y" >
- <defo>nextval(&#039;recipe_account_id_seq1&#039;::regclass)</defo>
- <comment> <![CDATA[Recipe author.]]> </comment>
- </column>
- <column name="created" type="date" jt="91" mandatory="y" >
- <defo>(&#039;now&#039;::text)::date</defo>
- <comment> <![CDATA[When the recipe was inserted into the system.]]> </comment>
- </column>
- <column name="updated" type="date" jt="91" >
- <comment> <![CDATA[When the recipe was changed in the system.]]> </comment>
- </column>
- <column name="deleted" type="date" jt="91" >
- <comment> <![CDATA[When the recipe was deleted from the system.]]> </comment>
- </column>
- <index name="pk_recipe" unique="PRIMARY_KEY" >
- <column name="id" />
- </index>
- <index name="idx_recipe" unique="NORMAL" >
- <column name="account_id" />
- </index>
- <fk name="fk_recipe_account" to_schema="recipe" to_table="account" delete_action="CASCADE" >
- <fk_column name="account_id" pk="id" />
- </fk>
- </table>
- <table name="recipe_equipment_group" >
- <column name="id" type="bigserial" length="19" jt="-5" mandatory="y" >
- <defo>nextval(&#039;recipe_equipment_group_id_seq&#039;::regclass)</defo>
- <comment> <![CDATA[Uniquely identifies each row that associates a set of equipment with a recipe.]]> </comment>
- </column>
- <column name="recipe_id" type="bigserial" length="19" jt="-5" mandatory="y" >
- <defo>nextval(&#039;recipe_equipment_group_recipe_id_seq&#039;::regclass)</defo>
- <comment> <![CDATA[Every recipe is uniquely identified.]]> </comment>
- </column>
- <column name="equipment_group_id" type="serial" jt="4" mandatory="y" >
- <defo>nextval(&#039;recipe_equipment_group_equipment_group_id_seq&#039;::regclass)</defo>
- <comment> <![CDATA[Uniquely identifies the type of equipment.]]> </comment>
- </column>
- <index name="pk_recipe_equipment_group" unique="PRIMARY_KEY" >
- <column name="id" />
- </index>
- <index name="idx_recipe_equipment_group" unique="NORMAL" >
- <column name="recipe_id" />
- </index>
- <index name="idx_recipe_equipment_group_0" unique="NORMAL" >
- <column name="equipment_group_id" />
- </index>
- <fk name="fk_recipe_equipment_group" to_schema="recipe" to_table="recipe" delete_action="CASCADE" >
- <fk_column name="recipe_id" pk="id" />
- </fk>
- <fk name="fk_recipe_equipment_group_0" to_schema="recipe" to_table="equipment_group" delete_action="CASCADE" >
- <fk_column name="equipment_group_id" pk="id" />
- </fk>
- </table>
- <table name="result" >
- <column name="xmlelement" type="xml" jt="1111" />
- </table>
- <sequence name="accounts_id_seq" start="1" />
- <sequence name="action_id_seq" start="1" />
- <sequence name="cuisine_id_seq" start="1" />
- <sequence name="description_cuisine_id_seq" start="1" />
- <sequence name="description_diet_id_seq" start="1" />
- <sequence name="description_id_seq" start="1" />
- <sequence name="description_recipe_id_seq" start="1" />
- <sequence name="diet_id_seq" start="1" />
- <sequence name="direction_action_id_seq" start="1" />
- <sequence name="direction_direction_group_id_seq" start="1" />
- <sequence name="direction_id_seq" start="1" />
- <sequence name="equipment_class_id_seq" start="1" />
- <sequence name="equipment_equipment_group_id_seq" start="1" />
- <sequence name="equipment_id_seq" start="1" />
- <sequence name="ingredient_id_seq" start="1" />
- <sequence name="ingredient_ingredient_group_id_seq" start="1" />
- <sequence name="ingredient_ingredient_name_id_seq" start="1" />
- <sequence name="ingredient_name_id_seq" start="1" />
- <sequence name="ingredient_substitute_id_seq" start="1" />
- <sequence name="ingredient_substitute_ingredient_id_seq" start="1" />
- <sequence name="ingredient_substitute_substitute_id_seq" start="1" />
- <sequence name="ingredient_unit_id_seq" start="1" />
- <sequence name="ingredient_unit_id_seq1" start="1" />
- <sequence name="preparation_id_seq" start="1" />
- <sequence name="preparation_recipe_id_seq" start="1" />
- <sequence name="recipe_account_id_seq1" start="1" />
- <sequence name="recipe_direction_group_recipe_id_seq" start="1" />
- <sequence name="recipe_equipment_group_equipment_group_id_seq" start="1" />
- <sequence name="recipe_equipment_group_id_seq" start="1" />
- <sequence name="recipe_equipment_group_recipe_id_seq" start="1" />
- <sequence name="recipe_id_seq" start="1" />
- <sequence name="recipe_ingredient_group_0_id_seq" start="1" />
- <sequence name="recipe_ingredient_group_id_seq" start="1" />
- <sequence name="recipe_ingredient_group_recipe_id_seq" start="1" />
- <function name="generate_equipment_xml" >
- <string> <![CDATA[CREATE OR REPLACE FUNCTION recipe.generate_equipment_xml(recipe_id integer)
- RETURNS text
- LANGUAGE plpgsql
-AS $function$
-DECLARE
- result TEXT;
-BEGIN
-SELECT
- xmlelement( name equipment, xmlconcat( array_to_string( array_agg( t.xmlelement ), '' )::xml ) )
-INTO
- result
-FROM
-(
-SELECT
- xmlelement( name "bakeware",
- xmlconcat(
- array_to_string( array_agg(
- xmlelement( name "object",
- xmlattributes( e.abridge AS "alias" ),
- e.name
- )
- ), '')::xml
- )
- )
-FROM
- recipe.equipment_group eg,
- recipe.equipment e,
- recipe.recipe_equipment_group reg
-WHERE
- eg.label='bakeware' AND
- eg.id = e.equipment_group_id AND
- eg.id = reg.equipment_group_id AND
- reg.recipe_id = recipe_id
-UNION ALL
-SELECT
- xmlelement( name "cookware",
- xmlconcat(
- array_to_string( array_agg(
- xmlelement( name "object",
- xmlattributes( e.abridge AS "alias" ),
- e.name
- )
- ), '')::xml
- )
- )
-FROM
- recipe.equipment_group eg,
- recipe.equipment e,
- recipe.recipe_equipment_group reg
-WHERE
- eg.label='cookware' AND
- eg.id = e.equipment_group_id AND
- eg.id = reg.equipment_group_id AND
- reg.recipe_id = recipe_id
-UNION ALL
-SELECT
- xmlelement( name "kitchenware",
- xmlconcat(
- array_to_string( array_agg(
- xmlelement( name "object",
- xmlattributes( e.abridge AS "alias" ),
- e.name
- )
- ), '')::xml
- )
- )
-FROM
- recipe.equipment_group eg,
- recipe.equipment e,
- recipe.recipe_equipment_group reg
-WHERE
- eg.label='kitchenware' AND
- eg.id = e.equipment_group_id AND
- eg.id = reg.equipment_group_id AND
- reg.recipe_id = recipe_id
-UNION ALL
-SELECT
- xmlelement( name "utensils",
- xmlconcat(
- array_to_string( array_agg(
- xmlelement( name "object",
- xmlattributes( e.abridge AS "alias" ),
- e.name
- )
- ), '')::xml
- )
- )
-FROM
- recipe.equipment_group eg,
- recipe.equipment e,
- recipe.recipe_equipment_group reg
-WHERE
- eg.label='utensils' AND
- eg.id = e.equipment_group_id AND
- eg.id = reg.equipment_group_id AND
- reg.recipe_id = recipe_id
-) t;
- RETURN result;
-END;
-$function$
-]]> </string>
- </function>
- <function name="generate_ingredients_xml" >
- <string> <![CDATA[CREATE OR REPLACE FUNCTION recipe.generate_ingredients_xml(recipe_id integer)
- RETURNS text
- LANGUAGE plpgsql
-AS $function$
-DECLARE
- recipe_group_id INTEGER;
- ingredients_xml TEXT;
- ingredient_list TEXT;
- result TEXT;
-BEGIN
- result = '';
- /**
- * Remove this loop. It should be possible to build the entire
- * list of ingredients with a single SQL statement. This is an
- * optimization to do later.
- */
- FOR recipe_group_id IN
- SELECT
- rig.id
- FROM
- recipe.ingredient_group rig
- WHERE
- rig.recipe_id = recipe_id
- LOOP
- /* Build the inner <ingredient> elements, one per ingredient group. */
- SELECT
- array_to_string(
- array_agg(
- xmlelement( name "ingredient",
- xmlattributes(
- ri.id AS "id",
- ri.min_quantity AS "min-quantity",
- ri.max_quantity AS "max-quantity",
- riu.label AS "unit",
- ri.condition AS "condition",
- not(ri.required) AS "optional",
- rin.abridge AS "alias",
- ris.substitute_id AS "subtitute" ),
- rin.label
- ) ), '' )
- INTO
- ingredient_list
- FROM
- recipe.ingredient ri
- LEFT OUTER JOIN recipe.ingredient_unit riu ON
- ri.unit_id = riu.id
- LEFT OUTER JOIN recipe.ingredient_substitute ris ON
- ri.id = ris.ingredient_id
- INNER JOIN recipe.ingredient_group rig ON
- rig.id = ri.ingredient_group_id AND
- rig.id = recipe_group_id
- INNER JOIN recipe.ingredient_name rin ON
- rin.id = ri.ingredient_name_id;
- /* Build the outer <ingredients> elements around the ingredients_list elements. */
- SELECT
- xmlelement( name "ingredients",
- xmlattributes( rig.label AS "label" ),
- xmlconcat( ingredient_list::xml )
- )
- INTO
- ingredients_xml
- FROM
- recipe.ingredient_group rig
- WHERE
- rig.id = recipe_group_id;
- /* Append all the <ingredients> elements together. */
- result = result || ingredients_xml;
- END LOOP;
- RETURN result;
-END;
-$function$
-]]> </string>
- </function>
- <function name="generate_xml" >
- <string> <![CDATA[CREATE OR REPLACE FUNCTION recipe.generate_xml(recipe_id integer)
- RETURNS text
- LANGUAGE plpgsql
-AS $function$
-DECLARE
- result TEXT;
-BEGIN
- SELECT
- xmlelement( name recipe,
- xmlelement( name description,
- xmlelement( name title, d.title ),
- xmlelement( name diet, diet.label ) ),
- xmlelement( name equipment,
- xmlconcat( ('<'||eg.label||'>')::xml,
- xmlelement( name object,
- xmlattributes( e.abridge AS "alias" ) )
- )
- )
- )
- INTO
- result
- FROM
- recipe.recipe r,
- recipe.description d,
- recipe.diet diet,
- recipe.equipment e,
- recipe.equipment_group eg,
- recipe.recipe_equipment_group reg
- WHERE
- r.id = recipe_id AND
- r.id = d.recipe_id AND
- d.diet_id = diet.id AND
- r.id = reg.recipe_id AND
- reg.equipment_group_id = eg.id AND
- e.equipment_group_id = eg.id;
- RETURN result;
-END;
-$function$
-]]> </string>
- </function>
- </schema>
- <schema name="recipe_book" schemaname="recipe_book" defo="y" >
- <comment>Defines operations and data stores for information related to generating books.</comment>
- <table name="book" >
- <comment>Defines the common items to every book.</comment>
- <column name="id" type="serial" jt="4" mandatory="y" >
- <comment> <![CDATA[Primary key.]]> </comment>
- </column>
- <column name="label" type="varchar" length="128" jt="12" mandatory="y" >
- <comment> <![CDATA[Book title.]]> </comment>
- </column>
- <column name="spine_label" type="varchar" length="128" jt="12" mandatory="y" >
- <comment> <![CDATA[Book spine label.]]> </comment>
- </column>
- <column name="dedication" type="text" jt="12" >
- <comment> <![CDATA[Text for the dedication.]]> </comment>
- </column>
- <column name="isbn" type="varchar" length="13" jt="12" >
- <comment> <![CDATA[International standard book number and EAN, can be null.]]> </comment>
- </column>
- <column name="created" type="timestamptz" jt="93" mandatory="y" >
- <defo>current_timestamp</defo>
- <comment> <![CDATA[Date the book was created.]]> </comment>
- </column>
- <column name="deleted" type="timestamptz" jt="93" >
- <comment> <![CDATA[Date the book was (or is to be?) deleted.]]> </comment>
- </column>
- <column name="updated" type="timestamptz" jt="93" >
- <comment> <![CDATA[Date the book was last updated.]]> </comment>
- </column>
- <index name="pk_book" unique="PRIMARY_KEY" >
- <column name="id" />
- </index>
- </table>
- <table name="book_account" >
- <comment>Associates a book with an account.</comment>
- <column name="id" type="serial" jt="4" mandatory="y" >
- <comment> <![CDATA[Primary key.]]> </comment>
- </column>
- <column name="book_id" type="int4" jt="4" mandatory="y" >
- <comment> <![CDATA[The book associated with an account.]]> </comment>
- </column>
- <column name="account_id" type="int4" jt="4" mandatory="y" >
- <comment> <![CDATA[The account associated with a book.]]> </comment>
- </column>
- <index name="pk_book_account" unique="PRIMARY_KEY" >
- <column name="id" />
- </index>
- <index name="idx_book_account" unique="NORMAL" >
- <column name="book_id" />
- </index>
- <index name="idx_book_account_0" unique="NORMAL" >
- <column name="account_id" />
- </index>
- <fk name="fk_book_account_book_id" to_schema="recipe_book" to_table="book" delete_action="CASCADE" >
- <fk_column name="book_id" pk="id" />
- </fk>
- <fk name="fk_book_account_account_id" to_schema="recipe" to_table="account" delete_action="CASCADE" >
- <fk_column name="account_id" pk="id" />
- </fk>
- </table>
- <table name="book_photograph" >
- <comment>Describes attributes about a photograph that can be used in the book.</comment>
- <column name="id" type="serial" jt="4" mandatory="y" >
- <comment> <![CDATA[Primary key.]]> </comment>
- </column>
- <column name="book_id" type="int4" length="256" jt="4" mandatory="y" >
- <comment> <![CDATA[The book to which this photograph belongs.]]> </comment>
- </column>
- <column name="image_url" type="varchar" length="2048" jt="12" mandatory="y" >
- <comment> <![CDATA[The website address where the image can be retrieved.]]> </comment>
- </column>
- <column name="book_photograph_category_id" type="int4" jt="4" mandatory="y" >
- <comment> <![CDATA[The type of photograph (e.g., cover page, meal inset, divider page, category section page).]]> </comment>
- </column>
- <index name="pk_book_photograph" unique="PRIMARY_KEY" >
- <column name="id" />
- </index>
- <index name="idx_book_photograph" unique="NORMAL" >
- <column name="book_id" />
- </index>
- <index name="idx_book_photograph_0" unique="NORMAL" >
- <column name="book_photograph_category_id" />
- </index>
- <fk name="fk_book_photograph_book_id" to_schema="recipe_book" to_table="book" delete_action="CASCADE" >
- <fk_column name="book_id" pk="id" />
- </fk>
- <fk name="fk_book_photograph_book_photograph_category_id" to_schema="recipe_book" to_table="book_photograph_category" delete_action="CASCADE" >
- <fk_column name="book_photograph_category_id" pk="id" />
- </fk>
- </table>
- <table name="book_photograph_category" >
- <comment>Contains a list of categories for book photographs.</comment>
- <column name="id" type="serial" jt="4" mandatory="y" >
- <comment> <![CDATA[Primary key.]]> </comment>
- </column>
- <column name="label" type="varchar" jt="12" mandatory="y" >
- <comment> <![CDATA[Text to display to the user.]]> </comment>
- </column>
- <column name="description" type="varchar" length="128" jt="12" mandatory="y" >
- <comment> <![CDATA[Brief description regarding how the category is used.]]> </comment>
- </column>
- <index name="pk_book_photograph_category" unique="PRIMARY_KEY" >
- <column name="id" />
- </index>
- </table>
- <table name="book_latex" >
- <comment>Associates LaTeX code with a book preference.</comment>
- <column name="id" type="serial" jt="4" mandatory="y" >
- <comment> <![CDATA[Primary key.]]> </comment>
- </column>
- <column name="book_preference_code_id" type="int4" jt="4" mandatory="y" >
- <comment> <![CDATA[Associates LaTeX source code with a book preference code.]]> </comment>
- </column>
- <column name="latex" type="text" jt="12" mandatory="y" >
- <comment> <![CDATA[Source code associated with a configurable preference.]]> </comment>
- </column>
- <index name="pk_book_preamble" unique="PRIMARY_KEY" >
- <column name="id" />
- </index>
- <index name="idx_book_latex" unique="NORMAL" >
- <column name="book_preference_code_id" />
- </index>
- <fk name="fk_book_latex_book_preference_code" to_schema="recipe_book" to_table="book_preference_code" delete_action="CASCADE" >
- <fk_column name="book_preference_code_id" pk="id" />
- <comment> <![CDATA[Associates LaTeX code with a book preference.]]> </comment>
- </fk>
- </table>
- <table name="book_preference" >
- <comment>Stores configuration parameters used to generate the book (e.g., layout, fonts, colours). The system must select default values for a book. This table allows users to override the defaults. This indirectly drives the settings for generating a book.</comment>
- <column name="id" type="serial" jt="4" mandatory="y" >
- <comment> <![CDATA[Primary key.]]> </comment>
- </column>
- <column name="book_id" type="int4" jt="4" mandatory="y" >
- <comment> <![CDATA[The preference's reference to a book.]]> </comment>
- </column>
- <column name="book_preference_code_id" type="int4" jt="4" mandatory="y" >
- <comment> <![CDATA[Reference to the book preference code table.]]> </comment>
- </column>
- <index name="pk_book_preference" unique="PRIMARY_KEY" >
- <column name="id" />
- </index>
- <index name="idx_book_preference" unique="NORMAL" >
- <column name="book_id" />
- </index>
- <fk name="fk_book_preference_book_id" to_schema="recipe_book" to_table="book" delete_action="CASCADE" >
- <fk_column name="book_id" pk="id" />
- </fk>
- <fk name="fk_book_preference_book_preference_code_id" to_schema="recipe_book" to_table="book_preference_code" delete_action="CASCADE" >
- <fk_column name="book_id" pk="id" />
- </fk>
- </table>
- <table name="book_preference_code" >
- <comment>List of domains, codes, and values related to book preferences. If later need arises, this table can be split into separate tables to establish foreign key constraints.</comment>
- <column name="id" type="serial" jt="4" mandatory="y" >
- <comment> <![CDATA[Primary key.]]> </comment>
- </column>
- <column name="domain" type="varchar" length="32" jt="12" mandatory="y" >
- <comment> <![CDATA[Grouping for codes and values (e.g., COLOUR_SCHEME).]]> </comment>
- </column>
- <column name="code" type="varchar" length="32" jt="12" mandatory="y" >
- <comment> <![CDATA[Unique identifier within a given domain (e.g., BLUEBERRY).]]> </comment>
- </column>
- <column name="label" type="varchar" length="32" jt="12" mandatory="y" >
- <comment> <![CDATA[Text that can be displayed to the user (e.g., Blueberry).]]> </comment>
- </column>
- <column name="description" type="varchar" length="128" jt="12" mandatory="y" >
- <comment> <![CDATA[Brief description about how the code is used.]]> </comment>
- </column>
- <index name="pk_book_preference_code" unique="PRIMARY_KEY" >
- <column name="id" />
- </index>
- <index name="idx_book_preference_code" unique="NORMAL" >
- <column name="domain" />
- </index>
- <fk name="fk_book_preference_code_domain" to_schema="recipe_book" to_table="book_theme_name" delete_action="CASCADE" >
- <fk_column name="domain" pk="domain" />
- </fk>
- </table>
- <table name="book_recipe" >
- <comment>Associates a book with a recipe.</comment>
- <column name="id" type="serial" jt="4" mandatory="y" >
- <comment> <![CDATA[Primary key.]]> </comment>
- </column>
- <column name="book_id" type="int4" jt="4" mandatory="y" >
- <comment> <![CDATA[Reference to the book table.]]> </comment>
- </column>
- <column name="recipe_id" type="serial" jt="4" mandatory="y" >
- <comment> <![CDATA[Reference to the recipe table.]]> </comment>
- </column>
- <index name="pk_book_recipe" unique="PRIMARY_KEY" >
- <column name="id" />
- </index>
- <index name="idx_book_recipe" unique="NORMAL" >
- <column name="recipe_id" />
- </index>
- <index name="idx_book_recipe_0" unique="NORMAL" >
- <column name="book_id" />
- </index>
- <fk name="fk_book_recipe_recipe_id" to_schema="recipe" to_table="recipe" delete_action="CASCADE" >
- <fk_column name="recipe_id" pk="id" />
- </fk>
- <fk name="fk_book_recipe_book_id" to_schema="recipe_book" to_table="book" delete_action="CASCADE" >
- <fk_column name="book_id" pk="id" />
- </fk>
- </table>
- <table name="book_theme_name" >
- <comment>Lists all the book theme names (e.g., maps MODERN_SQUARE to &quot;Modern Square&quot;).</comment>
- <column name="id" type="int4" jt="4" mandatory="y" >
- <comment> <![CDATA[Primary key.]]> </comment>
- </column>
- <column name="domain" type="varchar" length="32" jt="12" mandatory="y" >
- <comment> <![CDATA[Uniquely identifies the theme. This is used by the book theme preferences.]]> </comment>
- </column>
- <column name="label" type="varchar" jt="12" mandatory="y" >
- <comment> <![CDATA[Textual description of the book.]]> </comment>
- </column>
- <index name="pk_book_theme" unique="PRIMARY_KEY" >
- <comment>Primary key.</comment>
- <column name="id" />
- </index>
- <index name="uk_book_theme_name_code" unique="UNIQUE" >
- <comment>Uniquely identifies each theme&#039;s code.</comment>
- <column name="domain" />
- </index>
- </table>
- </schema>
- <connector name="recipe" database="PostgreSQL" driver_class="org.postgresql.Driver" driver_jar="postgresql-8.4-701.jdbc3.jar" host="localhost" port="5432" instance="recipe" user="recipe" schema_mapping="public:null;recipe:null;recipe_book:null" />
- <layout name="Chaos" >
- <entity schema="recipe" name="account" x="476" y="420" />
- <entity schema="recipe" name="action" x="350" y="420" />
- <entity schema="recipe" name="cuisine" x="686" y="84" />
- <entity schema="recipe" name="description" x="644" y="420" />
- <entity schema="recipe" name="direction" x="476" y="224" />
- <entity schema="recipe" name="direction_group" x="812" y="420" />
- <entity schema="recipe" name="equipment" x="644" y="602" />
- <entity schema="recipe" name="equipment_group" x="280" y="280" />
- <entity schema="recipe" name="ingredient" x="266" y="602" />
- <entity schema="recipe" name="ingredient_group" x="812" y="266" />
- <entity schema="recipe" name="ingredient_name" x="854" y="602" />
- <entity schema="recipe" name="ingredient_substitute" x="42" y="112" />
- <entity schema="recipe" name="ingredient_unit" x="154" y="420" />
- <entity schema="recipe" name="recipe" x="476" y="42" />
- <entity schema="recipe" name="recipe_equipment_group" x="854" y="770" />
- <entity schema="recipe" name="result" x="308" y="84" />
- <callout x="84" y="84" pointer="SV" >
- <comment> <![CDATA[Use this layer for database synch.]]> </comment>
- </callout>
- </layout>
- <layout name="Public" >
- <entity schema="public" name="xpath_relations" x="42" y="42" />
- </layout>
- <layout name="recipe_book" >
- <entity schema="recipe" name="account" x="630" y="42" />
- <entity schema="recipe_book" name="book" x="308" y="42" />
- <entity schema="recipe_book" name="book_account" x="448" y="42" />
- <entity schema="recipe_book" name="book_recipe" x="462" y="154" />
- <entity schema="recipe_book" name="book_preference" x="238" y="266" />
- <entity schema="recipe" name="recipe" x="630" y="196" />
- <entity schema="recipe_book" name="book_photograph_category" x="42" y="266" />
- <entity schema="recipe_book" name="book_photograph" x="42" y="42" />
- <entity schema="recipe_book" name="book_theme_name" x="84" y="406" />
- <entity schema="recipe_book" name="book_latex" x="42" y="588" />
- <entity schema="recipe_book" name="book_preference_code" x="280" y="406" />
- <group name="Book" color="ffcccc" >
- <entity schema="recipe_book" name="book_account" />
- <entity schema="recipe_book" name="book_photograph" />
- <entity schema="recipe_book" name="book" />
- <entity schema="recipe_book" name="book_photograph_category" />
- <entity schema="recipe_book" name="book_preference" />
- <entity schema="recipe_book" name="book_preference_code" />
- <entity schema="recipe_book" name="book_recipe" />
- <entity schema="recipe_book" name="book_theme_name" />
- </group>
- <group name="Recipe" color="ccffcc" >
- <entity schema="recipe" name="account" />
- <entity schema="recipe" name="recipe" />
- </group>
- <group name="Latex" color="ffccff" >
- <entity schema="recipe_book" name="book_latex" />
- </group>
- </layout>
- <layout name="recipe_zeal" confirmed="y" >
- <entity schema="recipe" name="account" x="154" y="406" />
- <entity schema="recipe" name="cuisine" x="462" y="574" />
- <entity schema="recipe" name="diet" x="462" y="672" />
- <entity schema="recipe" name="direction_group" x="602" y="420" />
- <entity schema="recipe" name="equipment" x="42" y="42" />
- <entity schema="recipe" name="equipment_group" x="238" y="42" />
- <entity schema="recipe" name="ingredient" x="462" y="154" />
- <entity schema="recipe" name="ingredient_group" x="462" y="42" />
- <entity schema="recipe" name="ingredient_unit" x="686" y="42" />
- <entity schema="recipe" name="preparation" x="462" y="462" />
- <entity schema="recipe" name="recipe_equipment_group" x="182" y="168" />
- <entity schema="recipe" name="description" x="280" y="574" />
- <entity schema="recipe" name="recipe" x="280" y="406" />
- <entity schema="recipe" name="direction" x="602" y="602" />
- <entity schema="recipe" name="action" x="798" y="602" />
- <entity schema="recipe" name="ingredient_name" x="686" y="252" />
- <entity schema="recipe" name="ingredient_substitute" x="686" y="154" />
- <group name="Recipe" color="ccffcc" >
- <entity schema="recipe" name="preparation" />
- <entity schema="recipe" name="cuisine" />
- <entity schema="recipe" name="diet" />
- <entity schema="recipe" name="direction_group" />
- <entity schema="recipe" name="action" />
- <entity schema="recipe" name="direction" />
- </group>
- <group name="Equipment" color="99ffff" >
- <entity schema="recipe" name="recipe_equipment_group" />
- <entity schema="recipe" name="equipment_group" />
- <entity schema="recipe" name="equipment" />
- </group>
- <group name="Ingredient" color="ccccff" >
- <entity schema="recipe" name="ingredient_name" />
- <entity schema="recipe" name="ingredient_group" />
- <entity schema="recipe" name="ingredient_unit" />
- <entity schema="recipe" name="ingredient_substitute" />
- <entity schema="recipe" name="ingredient" />
- </group>
- </layout>
-</project>
+
sql/recipe-book.sql
image_url varchar( 2048 ) NOT NULL,
book_photograph_category_id int4 NOT NULL,
- CONSTRAINT pk_book_photograph PRIMARY KEY ( id ),
- CONSTRAINT fk_book_photograph_book_id FOREIGN KEY ( book_id ) REFERENCES recipe_book.book( id ) ON DELETE CASCADE ,
- CONSTRAINT fk_book_photograph_book_photograph_category_id FOREIGN KEY ( book_photograph_category_id ) REFERENCES recipe_book.book_photograph_category( id ) ON DELETE CASCADE
+ CONSTRAINT pk_book_photograph PRIMARY KEY ( id )
);
label varchar( 32 ) NOT NULL,
description varchar( 128 ) NOT NULL,
- CONSTRAINT pk_book_preference_code PRIMARY KEY ( id ),
- CONSTRAINT fk_book_preference_code_domain FOREIGN KEY ( domain ) REFERENCES recipe_book.book_theme_name( domain ) ON DELETE CASCADE
+ CONSTRAINT pk_book_preference_code PRIMARY KEY ( id )
);
book_preference_code_id int4 NOT NULL,
latex text NOT NULL,
- CONSTRAINT pk_book_preamble PRIMARY KEY ( id ),
- CONSTRAINT fk_book_latex_book_preference_code FOREIGN KEY ( book_preference_code_id ) REFERENCES recipe_book.book_preference_code( id ) ON DELETE CASCADE
+ CONSTRAINT pk_book_preamble PRIMARY KEY ( id )
);
book_id int4 NOT NULL,
book_preference_code_id int4 NOT NULL,
- CONSTRAINT pk_book_preference PRIMARY KEY ( id ),
- CONSTRAINT fk_book_preference_book_id FOREIGN KEY ( book_id ) REFERENCES recipe_book.book( id ) ON DELETE CASCADE ,
- CONSTRAINT fk_book_preference_book_preference_code_id FOREIGN KEY ( book_id ) REFERENCES recipe_book.book_preference_code( id ) ON DELETE CASCADE
+ CONSTRAINT pk_book_preference PRIMARY KEY ( id )
);
ALTER TABLE recipe_book.book_account ADD CONSTRAINT fk_book_account_account_id FOREIGN KEY ( account_id ) REFERENCES recipe.account( id ) ON DELETE CASCADE;
+
+ALTER TABLE recipe_book.book_latex ADD CONSTRAINT fk_book_latex_book_preference_code FOREIGN KEY ( book_preference_code_id ) REFERENCES recipe_book.book_preference_code( id ) ON DELETE CASCADE;
+
+ALTER TABLE recipe_book.book_photograph ADD CONSTRAINT fk_book_photograph_book_id FOREIGN KEY ( book_id ) REFERENCES recipe_book.book( id ) ON DELETE CASCADE;
+
+ALTER TABLE recipe_book.book_photograph ADD CONSTRAINT fk_book_photograph_book_photograph_category_id FOREIGN KEY ( book_photograph_category_id ) REFERENCES recipe_book.book_photograph_category( id ) ON DELETE CASCADE;
+
+ALTER TABLE recipe_book.book_preference ADD CONSTRAINT fk_book_preference_book_id FOREIGN KEY ( book_id ) REFERENCES recipe_book.book( id ) ON DELETE CASCADE;
+
+ALTER TABLE recipe_book.book_preference ADD CONSTRAINT fk_book_preference_book_preference_code_id FOREIGN KEY ( book_id ) REFERENCES recipe_book.book_preference_code( id ) ON DELETE CASCADE;
+
+ALTER TABLE recipe_book.book_preference_code ADD CONSTRAINT fk_book_preference_code_domain FOREIGN KEY ( domain ) REFERENCES recipe_book.book_theme_name( domain ) ON DELETE CASCADE;
ALTER TABLE recipe_book.book_recipe ADD CONSTRAINT fk_book_recipe_recipe_id FOREIGN KEY ( recipe_id ) REFERENCES recipe.recipe( id ) ON DELETE CASCADE;
sql/recipe-book.txt
+
COLOUR_SCHEME, BLUEBERRY, Blueberry, \header{\color{blue}}
+ Aspect, Snippet, LaTeX
+
COLOUR_SCHEME, RASPBERRY, Raspberry, \header{\color{red}}
COLOUR_SCHEME, PEACH, Peach, \header{\color{...}}
HEADER_BACKGROUND, SQUARE, Square header background line, \header{\background{...}}
HEADER_BACKGROUND, NONE, No header background
- LAYOUT, ONE_SIDED, One-sided, ...
- LAYOUT, TWO_SIDED, Two-sided, ...
- PICTURE, TILT, Tilt Picture, \picture_tilt{ true }
+ PICTURE, TILT, Inset photos are tilted a few degrees, ...
+ PICTURE, TILT_RANDOM, Inset photos are tilted a random amount, ...
+ PICTURE, TILT_ANGLE, Inset photos are tilted by a specific degree, ...
PICTURE, DROP_SHADOW, Drop Shadow, \picture_shadow{ true }
PICTURE, FADED_SHADOW, Faded Shadow, \picture_faded_shadow{ true }
PICTURE, BORDER_THICKNESS, Border Thickness, \picture_border_thickness{ 0 }
PICTURE, BORDER_COLOUR, Border Colour, \picture_border_colour{ \primarycolour }
Then, the ModernSquare would be stored in the database as:
- THEME, MODERN_SQUARE, COLOUR_SCHEME, PEACH
- THEME, MODERN_SQUARE, LIST, ENUMERATED
- THEME, MODERN_SQUARE, LIST_BACKGROUND, SQUARE
- THEME, MODERN_SQUARE, HEADER_BACKGROUND, SQUARE
- THEME, MODERN_SQUARE, LAYOUT, ONE_SIDED
+ MODERN_SQUARE, COLOUR_SCHEME, PEACH
+ MODERN_SQUARE, LIST, ENUMERATED
+ MODERN_SQUARE, LIST_BACKGROUND, SQUARE
+ MODERN_SQUARE, HEADER_BACKGROUND, SQUARE
+
update-admin.sh
+#!/bin/bash
+
+rm -rf admin
+
+# Copy over the generated scripts...
+mv $HOME/video/admin .
+echo "DirectoryIndex login.php" > admin/.htaccess
+chmod 777 admin/templates_c
+

Removed commented lines and the word 'from' in preparation for database entry

Author Dave Jarvis <email>
Date 2013-01-24 15:30:29 GMT-0800
Commit c802573bbc7762c549cbddd3619257847e0625c7
Parent b67024b
Delta 205 lines added, 1084 lines removed, 879-line decrease