hobodave (owner)

Revisions

gist: 228179 Download_button fork
public
Public Clone URL: git://gist.github.com/228179.git
Embed All Files: show embed
SQL #
1
2
3
4
5
6
7
8
9
CREATE TABLE ticket_sources (
  ticket_id int(11) NOT NULL,
  creation_source enum('web', 'phone', 'pda', 'email') NOT NULL,
  resolution_source enum('web', 'phone', 'pda', 'email'),
  last_update_source enum('web', 'phone', 'pda', 'email'),
  created_by int(11) NOT NULL,
  updated_by int(11),
  resolved_by int(11)
) ENGINE=InnoDB;
SQL #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
CREATE TABLE ticket_sources (
  ticket_id int(11) NOT NULL,
  creation_source_id int(11) NOT NULL,
  resolution_source_id int(11),
  last_update_source_id int(11),
  created_by int(11) NOT NULL,
  updated_by int(11),
  resolved_by int(11)
) ENGINE=InnoDB;
 
CREATE TABLE sources (
  id int(11) NOT NULL AUTO_INCREMENT,
  name CHAR(5) NOT NULL,
  PRIMARY KEY (id),
  UNIQUE KEY name (name)
) ENGINE=InnoDB;
INSERT INTO sources (name) VALUES ('web'), ('phone'), ('pda'), ('email');
SQL #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
CREATE TABLE ticket_sources (
  ticket_id int(11) NOT NULL,
  creation_source CHAR(5) NOT NULL,
  resolution_source CHAR(5),
  last_update_source CHAR(5),
  created_by int(11) NOT NULL,
  updated_by int(11),
  resolved_by int(11),
  FOREIGN KEY (creation_source) REFERENCES sources(name),
  FOREIGN KEY (resolution_source) REFERENCES sources(name),
  FOREIGN KEY (last_update_source) REFERENCES sources(name)
) ENGINE=InnoDB;
 
CREATE TABLE sources (
  name CHAR(5) NOT NULL,
  PRIMARY KEY (name)
) ENGINE=InnoDB;
INSERT INTO sources (name) VALUES ('web'), ('phone'), ('pda'), ('email');