Revision 6791
Added by Aaron Marcuse-Kubitza almost 12 years ago
vegbien.my.sql | ||
---|---|---|
1295 | 1295 |
|
1296 | 1296 |
|
1297 | 1297 |
-- |
1298 |
-- Name: sourcename; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
|
1298 |
-- Name: sourcelist; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
|
1299 | 1299 |
-- |
1300 | 1300 |
|
1301 |
CREATE TABLE sourcename (
|
|
1302 |
sourcename_id int(11) NOT NULL,
|
|
1301 |
CREATE TABLE sourcelist (
|
|
1302 |
sourcelist_id int(11) NOT NULL,
|
|
1303 | 1303 |
source_id int(11) NOT NULL, |
1304 |
name varchar(255) NOT NULL, |
|
1305 |
matched_source_id int(11) |
|
1304 |
name varchar(255) NOT NULL |
|
1306 | 1305 |
); |
1307 | 1306 |
|
1308 | 1307 |
|
... | ... | |
2835 | 2834 |
|
2836 | 2835 |
|
2837 | 2836 |
-- |
2838 |
-- Name: sourcename_sourcename_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
2837 |
-- Name: sourcelist_sourcelist_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
2839 | 2838 |
-- |
2840 | 2839 |
|
2841 | 2840 |
|
2842 | 2841 |
|
2843 | 2842 |
|
2844 | 2843 |
-- |
2845 |
-- Name: sourcename_sourcename_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
2844 |
-- Name: sourcelist_sourcelist_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
2846 | 2845 |
-- |
2847 | 2846 |
|
2848 | 2847 |
|
2849 | 2848 |
|
2850 | 2849 |
|
2851 | 2850 |
-- |
2852 |
-- Name: sourcename_sourcename_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
|
|
2851 |
-- Name: sourcelist_sourcelist_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
|
|
2853 | 2852 |
-- |
2854 | 2853 |
|
2855 | 2854 |
|
2856 | 2855 |
|
2857 | 2856 |
-- |
2857 |
-- Name: sourcename; Type: TABLE; Schema: public; Owner: -; Tablespace: |
|
2858 |
-- |
|
2859 |
|
|
2860 |
CREATE TABLE sourcename ( |
|
2861 |
sourcelist_id int(11) NOT NULL, |
|
2862 |
name varchar(255) NOT NULL, |
|
2863 |
matched_source_id int(11) |
|
2864 |
); |
|
2865 |
|
|
2866 |
|
|
2867 |
-- |
|
2858 | 2868 |
-- Name: specimen; Type: TABLE; Schema: public; Owner: -; Tablespace: |
2859 | 2869 |
-- |
2860 | 2870 |
|
... | ... | |
3675 | 3685 |
|
3676 | 3686 |
|
3677 | 3687 |
-- |
3678 |
-- Name: sourcename_id; Type: DEFAULT; Schema: public; Owner: -
|
|
3688 |
-- Name: sourcelist_id; Type: DEFAULT; Schema: public; Owner: -
|
|
3679 | 3689 |
-- |
3680 | 3690 |
|
3681 | 3691 |
|
... | ... | |
4149 | 4159 |
|
4150 | 4160 |
|
4151 | 4161 |
-- |
4162 |
-- Data for Name: sourcelist; Type: TABLE DATA; Schema: public; Owner: - |
|
4163 |
-- |
|
4164 |
|
|
4165 |
|
|
4166 |
|
|
4167 |
-- |
|
4152 | 4168 |
-- Data for Name: sourcename; Type: TABLE DATA; Schema: public; Owner: - |
4153 | 4169 |
-- |
4154 | 4170 |
|
... | ... | |
4677 | 4693 |
|
4678 | 4694 |
|
4679 | 4695 |
-- |
4696 |
-- Name: sourcelist_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: |
|
4697 |
-- |
|
4698 |
|
|
4699 |
ALTER TABLE sourcelist |
|
4700 |
ADD CONSTRAINT sourcelist_pkey PRIMARY KEY (sourcelist_id); |
|
4701 |
|
|
4702 |
|
|
4703 |
-- |
|
4680 | 4704 |
-- Name: sourcename_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: |
4681 | 4705 |
-- |
4682 | 4706 |
|
4683 | 4707 |
ALTER TABLE sourcename |
4684 |
ADD CONSTRAINT sourcename_pkey PRIMARY KEY (sourcename_id);
|
|
4708 |
ADD CONSTRAINT sourcename_pkey PRIMARY KEY (sourcelist_id, name);
|
|
4685 | 4709 |
|
4686 | 4710 |
|
4687 | 4711 |
-- |
... | ... | |
5198 | 5222 |
|
5199 | 5223 |
|
5200 | 5224 |
-- |
5201 |
-- Name: sourcename_unique; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
|
5225 |
-- Name: sourcelist_unique; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
|
5202 | 5226 |
-- |
5203 | 5227 |
|
5204 | 5228 |
|
... | ... | |
6128 | 6152 |
|
6129 | 6153 |
|
6130 | 6154 |
-- |
6155 |
-- Name: sourcelist_source_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - |
|
6156 |
-- |
|
6157 |
|
|
6158 |
|
|
6159 |
|
|
6160 |
|
|
6161 |
-- |
|
6131 | 6162 |
-- Name: sourcename_matched_source_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - |
6132 | 6163 |
-- |
6133 | 6164 |
|
... | ... | |
6136 | 6167 |
|
6137 | 6168 |
|
6138 | 6169 |
-- |
6139 |
-- Name: sourcename_source_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - |
|
6170 |
-- Name: sourcename_sourcelist_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
6140 | 6171 |
-- |
6141 | 6172 |
|
6173 |
ALTER TABLE sourcename |
|
6174 |
ADD CONSTRAINT sourcename_sourcelist_id_fkey FOREIGN KEY (sourcelist_id) REFERENCES sourcelist(sourcelist_id) ON UPDATE CASCADE ON DELETE CASCADE; |
|
6142 | 6175 |
|
6143 | 6176 |
|
6144 |
|
|
6145 | 6177 |
-- |
6146 | 6178 |
-- Name: specimenreplicate_institution_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - |
6147 | 6179 |
-- |
... | ... | |
6622 | 6654 |
|
6623 | 6655 |
|
6624 | 6656 |
-- |
6625 |
-- Name: sourcename; Type: ACL; Schema: public; Owner: -
|
|
6657 |
-- Name: sourcelist; Type: ACL; Schema: public; Owner: -
|
|
6626 | 6658 |
-- |
6627 | 6659 |
|
6628 | 6660 |
|
... | ... | |
7022 | 7054 |
|
7023 | 7055 |
|
7024 | 7056 |
-- |
7057 |
-- Name: sourcename; Type: ACL; Schema: public; Owner: - |
|
7058 |
-- |
|
7059 |
|
|
7060 |
|
|
7061 |
|
|
7062 |
|
|
7063 |
|
|
7064 |
|
|
7065 |
|
|
7066 |
-- |
|
7025 | 7067 |
-- Name: specimen; Type: ACL; Schema: public; Owner: - |
7026 | 7068 |
-- |
7027 | 7069 |
|
Also available in: Unified diff
schemas/vegbien.sql: Allow multiple institutionCodes for each specimenreplicate by linking new sourcelist table many-to-many to source via sourcename (which is now a linking table)