Proposed SQL 'schema':
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
-- an author is a person that has written a library
-- mandatory fields: username , password and mail address
DROP TABLE IF EXISTS `al_authors`;
CREATE TABLE IF NOT EXISTS `al_authors` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(64) NOT NULL,
`password` varchar(32) DEFAULT NULL,
`mail` varchar(64) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
-- sample data for authors
INSERT INTO `al_authors` (`id`, `name`, `password`, `mail`) VALUES
(1, 'Alexander Brevig', 'temp', 'alexanderbrevig@gmail.com'),
(2, 'lsascha', 'temp', 'lsascha@gmail.com');
-- a category is classification of a library, we should discuss the complete list
-- mandatory fields: category name
DROP TABLE IF EXISTS `al_categories`;
CREATE TABLE IF NOT EXISTS `al_categories` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`category` varchar(64) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;
-- sample data for categories
INSERT INTO `al_categories` (`id`, `category`) VALUES
(1, 'Hardware Abstraction'),
(3, 'Data Structure'),
(4, 'Math'),
(5, 'Timing & Multitasking');
-- a library is a collection of library versions for a specific purpose
-- mandatory fields: category_id, library name, library general description
DROP TABLE IF EXISTS `al_libraries`;
CREATE TABLE IF NOT EXISTS `al_libraries` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`category_id` int(11) NOT NULL,
`name` varchar(64) DEFAULT NULL,
`description` text,
`popularity` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `category_id` (`category_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
-- sample data for libraries
INSERT INTO `al_libraries` (`id`, `category_id`, `name`, `description`, `popularity`) VALUES
(1, 1, 'Button', 'Button is created to help readability of code. It abstracts away the pinMode, and digitalRead calls for the user.\r\nIt supports pullup and pulldown configurations.', NULL);
-- libraries and authors are linked together in this table
-- mandatory fields: library_id, author_id
DROP TABLE IF EXISTS `al_libraryauthors`;
CREATE TABLE IF NOT EXISTS `al_libraryauthors` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`library_id` int(11) NOT NULL,
`author_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `library_id` (`library_id`),
KEY `author_id` (`author_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
-- sample data for library authors
INSERT INTO `al_libraryauthors` (`id`, `library_id`, `author_id`) VALUES
(1, 1, 1); -- button > alexander
-- tags are content and context describers and can be specified by simple text in the backend
-- mandatory fields: tag text
DROP TABLE IF EXISTS `al_tags`;
CREATE TABLE IF NOT EXISTS `al_tags` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`tag` varchar(32) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;
-- sample data for tags
INSERT INTO `al_tags` (`id`, `tag`) VALUES
(1, 'button'),
(2, 'switch'),
(3, 'state'),
(4, 'press');
-- libraries and tags are linked together by this table
-- mandatory fields: library_id, tag_id
DROP TABLE IF EXISTS `al_librarytags`;
CREATE TABLE IF NOT EXISTS `al_librarytags` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`library_id` int(11) NOT NULL,
`tag_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `library_id` (`library_id`),
KEY `tag_id` (`tag_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;
-- sample data for library tags
INSERT INTO `al_librarytags` (`id`, `library_id`, `tag_id`) VALUES
(1, 1, 1), -- button > button
(2, 1, 2), -- button > switch
(3, 1, 3), -- button > state
(4, 1, 4); -- button > press
-- libraries and versions of that library are linked toghether by this table
-- mandatory fields: library_id, major minor micro verion (1.4.3), url (optional description for changelogs etc)
DROP TABLE IF EXISTS `al_libraryversions`;
CREATE TABLE IF NOT EXISTS `al_libraryversions` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`library_id` int(11) NOT NULL,
`v_major` int(11) NOT NULL,
`v_minor` int(11) NOT NULL,
`v_micro` int(11) NOT NULL,
`url` varchar(64) NOT NULL,
`description` text,
`score` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `library_id` (`library_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
-- sample data for a library version
INSERT INTO `al_libraryversions` (`id`, `library_id`, `v_major`, `v_minor`, `v_micro`, `url`, `description`, `score`) VALUES
(1, 1, 1, 6, 0, 'http://www.arduino.cc/playground/uploads/Code/Button.zip', 'Added uniquePress():bool\r\nAdded stateChanged():bool\r\nAdded wasPressed():bool\r\nConstructor that only requires a buttonPin. Presumes PULLDOWN', NULL);
I've not implemented anything regarding the 'tested on Arduino IDE 0021 with the UNO' feature. Is this necessary?