[
	{
		"name": "wikilove_log",
		"comment": "WikiLove logging schema. Logs all actions of giving WikiLove.",
		"columns": [
			{
				"name": "wll_id",
				"comment": "unique id",
				"type": "integer",
				"options": { "notnull": true, "autoincrement": true }
			},
			{
				"name": "wll_timestamp",
				"comment": "timestamp",
				"type": "mwtimestamp",
				"options": { "notnull": true }
			},
			{
				"name": "wll_sender",
				"comment": "user id of the sender",
				"type": "integer",
				"options": { "notnull": true, "unsigned": true }
			},
			{
				"name": "wll_sender_registration",
				"comment": "registration date of the sender",
				"type": "mwtimestamp",
				"options": { "notnull": false }
			},
			{
				"name": "wll_sender_editcount",
				"comment": "wll_sender_editcount",
				"type": "integer",
				"options": { "notnull": false }
			},
			{
				"name": "wll_receiver",
				"comment": "user id of reciever",
				"type": "integer",
				"options": { "notnull": true, "unsigned": true }
			},
			{
				"name": "wll_receiver_registration",
				"comment": "registration date of the receiver",
				"type": "mwtimestamp",
				"options": { "notnull": false }
			},
			{
				"name": "wll_receiver_editcount",
				"comment": "total number of edits for the receiver",
				"type": "integer",
				"options": { "notnull": false }
			},
			{
				"name": "wll_type",
				"comment": "type (and subtype) of message",
				"type": "string",
				"options": { "notnull": true, "length": 64 }
			},
			{
				"name": "wll_subject",
				"comment": "subject line",
				"type": "string",
				"options": { "notnull": true, "length": 255 }
			},
			{
				"name": "wll_message",
				"comment": "actual message",
				"type": "blob",
				"options": { "notnull": true, "length": 65530 }
			},
			{
				"name": "wll_email",
				"comment": "whether or not a notification mail has been sent",
				"type": "mwtinyint",
				"options": { "notnull": true, "length": 1, "default": 0 }
			}
		],
		"indexes": [
			{
				"name": "wll_timestamp",
				"columns": [ "wll_timestamp" ],
				"unique": false
			},
			{
				"name": "wll_type_time",
				"comment": "ASSUMPTION: once narrowed down to a single user (sender/receiver), we can afford a filesort as a single users will have only limited WikiLove messages from or to him/her. It's not worth the memory of extra indexes to cover all the combinations (sender/receiver/type => 8 indexes)",
				"columns": [ "wll_type", "wll_timestamp" ],
				"unique": false
			},
			{
				"name": "wll_sender_time",
				"columns": [ "wll_sender", "wll_timestamp" ],
				"unique": false
			},
			{
				"name": "wll_receiver_time",
				"columns": [ "wll_receiver", "wll_timestamp" ],
				"unique": false
			}
		],
		"pk": [ "wll_id" ]
	}
]
