diff --git a/tracks/db/tracks_1.0.3_mysql.sql b/tracks/db/tracks_1.031_mysql.sql similarity index 51% rename from tracks/db/tracks_1.0.3_mysql.sql rename to tracks/db/tracks_1.031_mysql.sql index 02696ea6..75119046 100644 --- a/tracks/db/tracks_1.0.3_mysql.sql +++ b/tracks/db/tracks_1.031_mysql.sql @@ -1,11 +1,9 @@ --- CocoaMySQL dump --- Version 0.5 --- http://cocoamysql.sourceforge.net +-- NB: This schema should be redundant, and is just included for reference. If you are +-- using MySQL, you can just issue the following commands at your command prompt to create +-- the tables in the database you've specified in db/database.yml: -- --- Host: localhost (MySQL 4.0.20-max) --- Database: todo --- Generation Time: 2005-03-02 15:39:14 +0000 --- ************************************************************ +-- cd /PATH/TO/TRACKS +-- rake migrate -- Dump of table contexts -- ------------------------------------------------------------ @@ -13,12 +11,11 @@ CREATE TABLE `contexts` ( `id` int(11) NOT NULL auto_increment, `name` varchar(255) NOT NULL default '', - `hide` tinyint(4) NOT NULL default '0', - `position` int(11) NOT NULL, + `position` int(11) NOT NULL default '0', + `hide` tinyint(1) default '0', + `user_id` int(11) NOT NULL default '0', PRIMARY KEY (`id`) -) TYPE=MyISAM; - - +) TYPE=InnoDB; -- Dump of table projects -- ------------------------------------------------------------ @@ -26,55 +23,59 @@ CREATE TABLE `contexts` ( CREATE TABLE `projects` ( `id` int(11) NOT NULL auto_increment, `name` varchar(255) NOT NULL default '', - `position` int(11) NOT NULL, - `done` tinyint(4) NOT NULL default '0', + `position` int(11) NOT NULL default '0', + `done` tinyint(1) default '0', + `user_id` int(11) NOT NULL default '0', PRIMARY KEY (`id`) +) TYPE=InnoDB; + +-- Dump of table schema_info +-- ------------------------------------------------------------ + +CREATE TABLE `schema_info` ( + `version` int(11) default NULL ) TYPE=MyISAM; - - -- Dump of table todos -- ------------------------------------------------------------ CREATE TABLE `todos` ( `id` int(11) NOT NULL auto_increment, + `name` varchar(255) NOT NULL default '', `context_id` int(11) NOT NULL default '0', - `description` varchar(100) NOT NULL default '', + `project_id` int(11) default NULL, + `description` varchar(255) NOT NULL default '', `notes` text, - `done` tinyint(4) NOT NULL default '0', - `created` datetime NOT NULL default '0000-00-00 00:00:00', + `done` tinyint(1) NOT NULL default '0', + `created_at` datetime default NULL, `due` date default NULL, `completed` datetime default NULL, - `project_id` int(11) default NULL, + `user_id` int(11) NOT NULL default '0', PRIMARY KEY (`id`) -) TYPE=MyISAM; - - +) TYPE=InnoDB; -- Dump of table users -- ------------------------------------------------------------ CREATE TABLE `users` ( `id` int(11) NOT NULL auto_increment, - `login` varchar(80) default NULL, - `password` varchar(40) default NULL, + `login` varchar(80) NOT NULL default '', + `password` varchar(40) NOT NULL default '', `word` varchar(255) default NULL, - `is_admin` tinyint(4) NOT NULL default '0', + `is_admin` tinyint(1) NOT NULL default '0', PRIMARY KEY (`id`) -) TYPE=MyISAM; - +) TYPE=InnoDB; -- Dump of table notes -- ------------------------------------------------------------ CREATE TABLE `notes` ( `id` int(11) NOT NULL auto_increment, + `user_id` int(11) NOT NULL default '0', `project_id` int(11) NOT NULL default '0', `body` text, - `created_at` datetime NOT NULL default '0000-00-00 00:00:00', + `created_at` datetime default '0000-00-00 00:00:00', `updated_at` datetime default '0000-00-00 00:00:00', - PRIMARY KEY (`id`) -) TYPE=MyISAM; - - + PRIMARY KEY (`id`) +) TYPE=InnoDB; diff --git a/tracks/db/tracks_1.0.3_postgres.sql b/tracks/db/tracks_1.031_postgres.sql similarity index 72% rename from tracks/db/tracks_1.0.3_postgres.sql rename to tracks/db/tracks_1.031_postgres.sql index c610810e..3d032e1e 100644 --- a/tracks/db/tracks_1.0.3_postgres.sql +++ b/tracks/db/tracks_1.031_postgres.sql @@ -1,3 +1,10 @@ +-- NB: This schema should be redundant, and is just included for reference. If you are +-- using Postgresql, you can just issue the following commands at your command prompt to create +-- the tables in the database you've specified in db/database.yml: +-- +-- cd /PATH/TO/TRACKS +-- rake migrate + \connect tracks; drop table contexts; @@ -5,7 +12,8 @@ create table contexts ( id serial not null, name varchar(255) not null default '', hide int not null default 0, - position int NOT NULL, + position int not null, + user_id int not null default 0, primary key (id) ); @@ -17,14 +25,19 @@ drop table projects; create table projects ( id serial not null, name varchar(255) not null default '', - position int NOT NULL, + position int not null, done int not null default 0, + user_id int not null default 0, primary key (id) ); -- Set the sequence to the proper value select setval('projects_id_seq', (select max(id) from projects)); +create table schema_info ( + version int default null +); + drop table todos; create table todos ( id serial not null, @@ -32,10 +45,11 @@ create table todos ( description varchar(100) not null default '', notes text, done int not null default 0, - created timestamp not null default now(), + created_at timestamp not null default now(), due date default null, completed timestamp default null, project_id int default null, + user_id int not null default 0, primary key (id) ); @@ -61,6 +75,7 @@ create table notes ( body text, created_at timestamp default null, updated_at timestamp default null, + user_id int not null default 0, primary key (id) ); diff --git a/tracks/db/tracks_1.0.3_sqlite.sql b/tracks/db/tracks_1.031_sqlite.sql similarity index 72% rename from tracks/db/tracks_1.0.3_sqlite.sql rename to tracks/db/tracks_1.031_sqlite.sql index c75d23d9..46ede8a6 100644 --- a/tracks/db/tracks_1.0.3_sqlite.sql +++ b/tracks/db/tracks_1.031_sqlite.sql @@ -1,5 +1,5 @@ -- SQLite dump --- ************************************************************ +-- ------------------------------------------------------------ -- Dump of table contexts -- ------------------------------------------------------------ @@ -8,7 +8,8 @@ CREATE TABLE 'contexts' ( 'id' INTEGER PRIMARY KEY, 'name' varchar(255) NOT NULL default '', 'hide' tinyint(4) NOT NULL default '0', - 'position' int NOT NULL + 'position' int NOT NULL, + 'user_id' INTEGER NOT NULL default '0' ) ; @@ -20,10 +21,15 @@ CREATE TABLE 'projects' ( 'id' INTEGER PRIMARY KEY, 'name' varchar(255) NOT NULL default '', 'position' int NOT NULL, - 'done' tinyint(4) NOT NULL default '0' + 'done' tinyint(4) NOT NULL default '0', + 'user_id' INTEGER NOT NULL default '0' ) ; +-- Dump of table schema_info +CREATE TABLE 'schema_info' ( + 'version' INTEGER default NULL +) -- Dump of table todos -- ------------------------------------------------------------ @@ -34,10 +40,11 @@ CREATE TABLE 'todos' ( 'description' varchar(100) NOT NULL default '', 'notes' text, 'done' tinyint(4) NOT NULL default '0', - 'created' datetime NOT NULL default '0000-00-00 00:00:00', + 'created_at' datetime NOT NULL default '0000-00-00 00:00:00', 'due' date default NULL, 'completed' datetime default NULL, - 'project_id' int(11) default NULL + 'project_id' int(11) default NULL, + 'user_id' INTEGER NOT NULL default '0' ) ; @@ -61,6 +68,7 @@ CREATE TABLE 'notes' ( 'project_id' int(11) NOT NULL default '0', 'body' text, 'created_at' datetime NOT NULL default '0000-00-00 00:00:00', - 'updated_at' datetime default '0000-00-00 00:00:00' + 'updated_at' datetime default '0000-00-00 00:00:00', + 'user_id' INTEGER NOT NULL default '0' ) ;