Skip to content

Instantly share code, notes, and snippets.

@elof
Last active December 21, 2015 09:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elof/6285071 to your computer and use it in GitHub Desktop.
Save elof/6285071 to your computer and use it in GitHub Desktop.
Schema Design Lab
<group label="Character" color="rgb(255,200,200)">
	<type label="Char" length="1" sql="CHAR" quote="'"/>
	<type label="Varchar" length="1" sql="VARCHAR" quote="'"/>
	<type label="Text" length="0" sql="MEDIUMTEXT" re="TEXT" quote="'"/>
	<type label="Binary" length="1" sql="BINARY" quote="'"/>
	<type label="Varbinary" length="1" sql="VARBINARY" quote="'"/>
	<type label="BLOB" length="0" sql="BLOB" re="BLOB" quote="'"/>
</group>

<group label="Date &amp; Time" color="rgb(200,255,200)">
	<type label="Date" length="0" sql="DATE" quote="'"/>
	<type label="Time" length="0" sql="TIME" quote="'"/>
	<type label="Datetime" length="0" sql="DATETIME" quote="'"/>
	<type label="Year" length="0" sql="YEAR" quote=""/>
	<type label="Timestamp" length="0" sql="TIMESTAMP" quote="'"/>
</group>

<group label="Miscellaneous" color="rgb(200,200,255)">
	<type label="ENUM" length="1" sql="ENUM" quote=""/>
	<type label="SET" length="1" sql="SET" quote=""/>
	<type label="Bit" length="0" sql="bit" quote=""/>
</group>

TINYINT NULL VARCHAR NULL id users has_many lists, has_many todo through lists

TINYINT NULL TINYINT NULL TINYINT NULL TINYINT NULL id belongs_to list, belongs_to user through list
TINYINT NULL TINYINT NULL TINYINT NULL id belongs_to user, has_many todo
<group label="Character" color="rgb(255,200,200)">
	<type label="Char" length="1" sql="CHAR" quote="'"/>
	<type label="Varchar" length="1" sql="VARCHAR" quote="'"/>
	<type label="Text" length="0" sql="MEDIUMTEXT" re="TEXT" quote="'"/>
	<type label="Binary" length="1" sql="BINARY" quote="'"/>
	<type label="Varbinary" length="1" sql="VARBINARY" quote="'"/>
	<type label="BLOB" length="0" sql="BLOB" re="BLOB" quote="'"/>
</group>

<group label="Date &amp; Time" color="rgb(200,255,200)">
	<type label="Date" length="0" sql="DATE" quote="'"/>
	<type label="Time" length="0" sql="TIME" quote="'"/>
	<type label="Datetime" length="0" sql="DATETIME" quote="'"/>
	<type label="Year" length="0" sql="YEAR" quote=""/>
	<type label="Timestamp" length="0" sql="TIMESTAMP" quote="'"/>
</group>

<group label="Miscellaneous" color="rgb(200,200,255)">
	<type label="ENUM" length="1" sql="ENUM" quote=""/>
	<type label="SET" length="1" sql="SET" quote=""/>
	<type label="Bit" length="0" sql="bit" quote=""/>
</group>

TINYINT NULL VARCHAR NULL id has_many posts, has_many comments

TINYINT NULL INTEGER NULL VARCHAR NULL MEDIUMTEXT NULL id belongs_to user, has_many comments
TINYINT NULL MEDIUMTEXT NULL TINYINT NULL TINYINT NULL id belongs_to posts, belongs_to users
<group label="Character" color="rgb(255,200,200)">
	<type label="Char" length="1" sql="CHAR" quote="'"/>
	<type label="Varchar" length="1" sql="VARCHAR" quote="'"/>
	<type label="Text" length="0" sql="MEDIUMTEXT" re="TEXT" quote="'"/>
	<type label="Binary" length="1" sql="BINARY" quote="'"/>
	<type label="Varbinary" length="1" sql="VARBINARY" quote="'"/>
	<type label="BLOB" length="0" sql="BLOB" re="BLOB" quote="'"/>
</group>

<group label="Date &amp; Time" color="rgb(200,255,200)">
	<type label="Date" length="0" sql="DATE" quote="'"/>
	<type label="Time" length="0" sql="TIME" quote="'"/>
	<type label="Datetime" length="0" sql="DATETIME" quote="'"/>
	<type label="Year" length="0" sql="YEAR" quote=""/>
	<type label="Timestamp" length="0" sql="TIMESTAMP" quote="'"/>
</group>

<group label="Miscellaneous" color="rgb(200,200,255)">
	<type label="ENUM" length="1" sql="ENUM" quote=""/>
	<type label="SET" length="1" sql="SET" quote=""/>
	<type label="Bit" length="0" sql="bit" quote=""/>
</group>

TINYINT NULL id has_many surveys, has_many questions through surveys, has_many answers through questions, has_many taken_surveys, has_many sureveys through taken_surveys, has_many responses

TINYINT NULL INTEGER NULL id has_many questions, has_many answers through questions, belongs_to users, belongs to users through taken_survey, has_many responses through answers and questions
TINYINT NULL INTEGER NULL TINYINT NULL id
TINYINT NULL INTEGER NULL id has_many answers, has_many responses through answers, belongs to surveys, belongs to users through surveys
TINYINT NULL INTEGER NULL id has_many responses, belongs_to questions, belongs_to surveys through questions, belongs_to users through questions and surveys
TINYINT NULL INTEGER NULL INTEGER NULL id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment