works but need some cleanup
This commit is contained in:
parent
0ec83db287
commit
e40a859b7d
752 changed files with 4866 additions and 27923 deletions
0
db/migrate/20090107193228_init.rb
Normal file → Executable file
0
db/migrate/20090107193228_init.rb
Normal file → Executable file
|
@ -1,111 +0,0 @@
|
|||
CREATE TABLE customers (
|
||||
id bigint(20) NOT NULL auto_increment,
|
||||
fname varchar(50) default NULL,
|
||||
lname varchar(50) default NULL,
|
||||
email varchar(100) NOT NULL,
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE INDEX (email)
|
||||
) TYPE=MyISAM;
|
||||
|
||||
CREATE TABLE filters (
|
||||
id bigint(20) NOT NULL auto_increment,
|
||||
name varchar(50) default NULL,
|
||||
destination_folder varchar(50) default NULL,
|
||||
customer_id bigint(20) NOT NULL,
|
||||
order_num int default 1,
|
||||
PRIMARY KEY (id),
|
||||
INDEX (customer_id),
|
||||
FOREIGN KEY (customer_id) REFERENCES customers(id)
|
||||
) TYPE=MyISAM;
|
||||
|
||||
CREATE TABLE expressions (
|
||||
id bigint(20) NOT NULL auto_increment,
|
||||
field_name varchar(20) default '^Subject' NOT NULL,
|
||||
operator varchar(20) default 'contains' NOT NULL,
|
||||
expr_value varchar(100) default '' NOT NULL,
|
||||
case_sensitive bool default 0,
|
||||
filter_id bigint(20) NOT NULL,
|
||||
PRIMARY KEY (id),
|
||||
INDEX (filter_id),
|
||||
FOREIGN KEY (filter_id) REFERENCES filters(id)
|
||||
) TYPE=MyISAM;
|
||||
|
||||
CREATE TABLE `mail_prefs` (
|
||||
`id` int(11) NOT NULL auto_increment,
|
||||
`mail_type` varchar(10) default 'text/plain',
|
||||
`wm_rows` int(11) default '20',
|
||||
`customer_id` bigint(20) default NULL,
|
||||
`check_external_mail` tinyint(1) default '0',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `customer_id` (`customer_id`)
|
||||
) TYPE=MyISAM;
|
||||
|
||||
CREATE TABLE contacts (
|
||||
id bigint(20) NOT NULL auto_increment,
|
||||
fname varchar(50) default NULL,
|
||||
lname varchar(50) default NULL,
|
||||
email varchar(100) default NULL,
|
||||
hphone varchar(20) default NULL,
|
||||
wphone varchar(20) default NULL,
|
||||
mobile varchar(20) default NULL,
|
||||
fax varchar(20) default NULL,
|
||||
notes text,
|
||||
create_date datetime default NULL,
|
||||
delete_date datetime default NULL,
|
||||
customer_id bigint(20) default NULL,
|
||||
PRIMARY KEY (id),
|
||||
INDEX (customer_id),
|
||||
INDEX (customer_id, email),
|
||||
INDEX (email),
|
||||
FOREIGN KEY (customer_id) REFERENCES customers(id)
|
||||
) TYPE=MyISAM;
|
||||
|
||||
CREATE TABLE contact_groups (
|
||||
id bigint(20) NOT NULL auto_increment,
|
||||
name varchar(50) default NULL,
|
||||
customer_id bigint(20) default NULL,
|
||||
PRIMARY KEY (id),
|
||||
INDEX (customer_id),
|
||||
FOREIGN KEY (customer_id) REFERENCES customers(id)
|
||||
) TYPE=MyISAM;
|
||||
|
||||
CREATE TABLE contact_contact_groups (
|
||||
contact_id bigint(20) NOT NULL,
|
||||
contact_group_id bigint(20) NOT NULL,
|
||||
PRIMARY KEY (contact_id, contact_group_id),
|
||||
INDEX (contact_id),
|
||||
INDEX (contact_group_id),
|
||||
FOREIGN KEY (contact_id) REFERENCES contacts(id),
|
||||
FOREIGN KEY (contact_group_id) REFERENCES contact_groups(id)
|
||||
) TYPE=MyISAM;
|
||||
|
||||
-- Mysql Sessions
|
||||
create table sessions (
|
||||
id bigint(20) NOT NULL auto_increment,
|
||||
session_id varchar(255),
|
||||
data text,
|
||||
updated_at timestamp,
|
||||
primary key(id),
|
||||
index(session_id)
|
||||
);
|
||||
|
||||
-- Cache
|
||||
CREATE TABLE imap_messages (
|
||||
id bigint(20) NOT NULL auto_increment,
|
||||
folder_name varchar(100) NOT NULL,
|
||||
username varchar(100) NOT NULL,
|
||||
msg_id varchar(100),
|
||||
uid bigint(20) NOT NULL,
|
||||
`from` varchar(255),
|
||||
`from_flat` varchar(255),
|
||||
`to` varchar(255),
|
||||
`to_flat` varchar(255),
|
||||
`subject` varchar(255),
|
||||
`content_type` varchar(30),
|
||||
`date` timestamp,
|
||||
`unread` tinyint(1),
|
||||
`size` bigint(20),
|
||||
PRIMARY KEY (id),
|
||||
INDEX (folder_name, username),
|
||||
INDEX (folder_name, username,uid)
|
||||
) TYPE=MyISAM;
|
|
@ -1,111 +0,0 @@
|
|||
CREATE TABLE customers (
|
||||
id bigserial NOT NULL,
|
||||
fname varchar(50) default NULL,
|
||||
lname varchar(50) default NULL,
|
||||
email varchar(100) NOT NULL,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
CREATE UNIQUE INDEX customers_email_idx ON customers(email);
|
||||
|
||||
CREATE TABLE filters (
|
||||
id bigserial NOT NULL,
|
||||
name varchar(50) default NULL,
|
||||
destination_folder varchar(50) default NULL,
|
||||
customer_id bigint NOT NULL,
|
||||
order_num int default 1,
|
||||
PRIMARY KEY (id),
|
||||
FOREIGN KEY (customer_id) REFERENCES customers(id)
|
||||
);
|
||||
CREATE INDEX filters_customer_id_idx ON filters(customer_id);
|
||||
|
||||
CREATE TABLE expressions (
|
||||
id bigserial NOT NULL,
|
||||
field_name varchar(20) default '^Subject' NOT NULL,
|
||||
operator varchar(20) default 'contains' NOT NULL,
|
||||
expr_value varchar(100) default '' NOT NULL,
|
||||
case_sensitive bool default FALSE,
|
||||
filter_id bigint NOT NULL,
|
||||
PRIMARY KEY (id),
|
||||
FOREIGN KEY (filter_id) REFERENCES filters(id)
|
||||
);
|
||||
CREATE INDEX expressions_filter_id_idx ON expressions(filter_id);
|
||||
|
||||
CREATE TABLE mail_prefs (
|
||||
id serial NOT NULL,
|
||||
mail_type varchar(10) default 'text/plain',
|
||||
wm_rows int default '20',
|
||||
customer_id bigint default NULL,
|
||||
check_external_mail bool default false,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
CREATE UNIQUE INDEX mail_prefs_customer_id_idx ON mail_prefs(customer_id);
|
||||
|
||||
CREATE TABLE contacts (
|
||||
id bigserial NOT NULL,
|
||||
fname varchar(50) default NULL,
|
||||
lname varchar(50) default NULL,
|
||||
email varchar(100) default NULL,
|
||||
hphone varchar(20) default NULL,
|
||||
wphone varchar(20) default NULL,
|
||||
mobile varchar(20) default NULL,
|
||||
fax varchar(20) default NULL,
|
||||
notes text,
|
||||
create_date timestamp default NULL,
|
||||
delete_date timestamp default NULL,
|
||||
customer_id bigint default NULL,
|
||||
PRIMARY KEY (id),
|
||||
FOREIGN KEY (customer_id) REFERENCES customers(id)
|
||||
);
|
||||
CREATE INDEX contacts_customer_id_idx ON contacts(customer_id);
|
||||
CREATE INDEX contacts_customer_id_email_idx ON contacts(customer_id,email);
|
||||
CREATE INDEX contacts_email_idx ON contacts(email);
|
||||
|
||||
|
||||
CREATE TABLE contact_groups (
|
||||
id bigserial NOT NULL,
|
||||
name varchar(50) default NULL,
|
||||
customer_id bigint default NULL,
|
||||
PRIMARY KEY (id),
|
||||
FOREIGN KEY (customer_id) REFERENCES customers(id)
|
||||
);
|
||||
CREATE INDEX contact_groups_customer_id_idx ON contact_groups(customer_id);
|
||||
|
||||
CREATE TABLE contact_contact_groups (
|
||||
contact_id bigint NOT NULL,
|
||||
contact_group_id bigint NOT NULL,
|
||||
PRIMARY KEY (contact_id, contact_group_id),
|
||||
FOREIGN KEY (contact_id) REFERENCES contacts(id),
|
||||
FOREIGN KEY (contact_group_id) REFERENCES contact_groups(id)
|
||||
);
|
||||
CREATE INDEX contact_contact_groups_contact_id_idx ON contact_contact_groups(contact_id);
|
||||
CREATE INDEX contact_contact_groups_contact_group_id_idx ON contact_contact_groups(contact_group_id);
|
||||
|
||||
create table sessions (
|
||||
id BIGSERIAL NOT NULL,
|
||||
session_id VARCHAR(255) NULL,
|
||||
data TEXT NULL,
|
||||
updated_at TIMESTAMP default null,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
CREATE INDEX session_idx ON sessions(session_id);
|
||||
|
||||
CREATE TABLE imap_messages (
|
||||
id BIGSERIAL NOT NULL,
|
||||
folder_name VARCHAR(100) NOT NULL,
|
||||
username VARCHAR(100) NOT NULL,
|
||||
msg_id VARCHAR(100),
|
||||
uid BIGINT NOT NULL,
|
||||
"from" TEXT,
|
||||
"from_flat" TEXT,
|
||||
"to" TEXT,
|
||||
"to_flat" TEXT,
|
||||
"subject" TEXT,
|
||||
"content_type" VARCHAR(30),
|
||||
"date" TIMESTAMP,
|
||||
"unread" BOOL default false,
|
||||
"size" BIGINT,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
CREATE INDEX msg_cache_fu_idx ON imap_messages(folder_name, username);
|
||||
CREATE INDEX msg_cache_fuui_idx ON imap_messages(folder_name, username, uid);
|
13
db/schema.rb
Normal file → Executable file
13
db/schema.rb
Normal file → Executable file
|
@ -1,10 +1,11 @@
|
|||
# This file is auto-generated from the current state of the database. Instead of editing this file,
|
||||
# please use the migrations feature of Active Record to incrementally modify your database, and
|
||||
# then regenerate this schema definition.
|
||||
# This file is auto-generated from the current state of the database. Instead
|
||||
# of editing this file, please use the migrations feature of Active Record to
|
||||
# incrementally modify your database, and then regenerate this schema definition.
|
||||
#
|
||||
# Note that this schema.rb definition is the authoritative source for your database schema. If you need
|
||||
# to create the application database on another system, you should be using db:schema:load, not running
|
||||
# all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
||||
# Note that this schema.rb definition is the authoritative source for your
|
||||
# database schema. If you need to create the application database on another
|
||||
# system, you should be using db:schema:load, not running all the migrations
|
||||
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
||||
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
||||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
|
7
db/seeds.rb
Executable file
7
db/seeds.rb
Executable file
|
@ -0,0 +1,7 @@
|
|||
# This file should contain all the record creation needed to seed the database with its default values.
|
||||
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
|
||||
#
|
||||
# Examples:
|
||||
#
|
||||
# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
|
||||
# Mayor.create(:name => 'Daley', :city => cities.first)
|
Loading…
Add table
Add a link
Reference in a new issue