fix servicealert editor due to "end" field master
[busui.git] / setup / transitdata.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
 
--
-- PostgreSQL database dump
--
 
SET statement_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
 
--
-- Name: topology; Type: SCHEMA; Schema: -; Owner: postgres
--
 
CREATE SCHEMA topology;
 
 
ALTER SCHEMA topology OWNER TO postgres;
 
--
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: 
--
 
CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
 
 
--
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: 
--
 
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
 
 
--
-- Name: postgis; Type: EXTENSION; Schema: -; Owner: 
--
 
CREATE EXTENSION IF NOT EXISTS postgis WITH SCHEMA public;
 
 
--
-- Name: EXTENSION postgis; Type: COMMENT; Schema: -; Owner: 
--
 
COMMENT ON EXTENSION postgis IS 'postgis geometry,geography, and raster spatial types and functions';
 
 
--
-- Name: postgis_topology; Type: EXTENSION; Schema: -; Owner: 
--
 
CREATE EXTENSION IF NOT EXISTS postgis_topology WITH SCHEMA topology;
 
 
--
-- Name: EXTENSION postgis_topology; Type: COMMENT; Schema: -; Owner: 
--
 
COMMENT ON EXTENSION postgis_topology IS 'postgis topology spatial types and functions';
 
 
SET search_path = public, pg_catalog;
 
--
-- Name: linefromtext(text); Type: FUNCTION; Schema: public; Owner: postgres
--
 
CREATE FUNCTION linefromtext(text) RETURNS geometry
    LANGUAGE sql IMMUTABLE STRICT
    AS $_$
        SELECT CASE WHEN geometrytype(GeomFromText($1)) = 'LINESTRING'
        THEN GeomFromText($1)
        ELSE NULL END
        $_$;
 
 
ALTER FUNCTION public.linefromtext(text) OWNER TO postgres;
 
--
-- Name: linefromtext(text, integer); Type: FUNCTION; Schema: public; Owner: postgres
--
 
CREATE FUNCTION linefromtext(text, integer) RETURNS geometry
    LANGUAGE sql IMMUTABLE STRICT
    AS $_$
        SELECT CASE WHEN geometrytype(GeomFromText($1, $2)) = 'LINESTRING'
        THEN GeomFromText($1,$2)
        ELSE NULL END
        $_$;
 
 
ALTER FUNCTION public.linefromtext(text, integer) OWNER TO postgres;
 
--
-- Name: linefromwkb(bytea); Type: FUNCTION; Schema: public; Owner: postgres
--
 
CREATE FUNCTION linefromwkb(bytea) RETURNS geometry
    LANGUAGE sql IMMUTABLE STRICT
    AS $_$
        SELECT CASE WHEN geometrytype(GeomFromWKB($1)) = 'LINESTRING'
        THEN GeomFromWKB($1)
        ELSE NULL END
        $_$;
 
 
ALTER FUNCTION public.linefromwkb(bytea) OWNER TO postgres;
 
--
-- Name: linefromwkb(bytea, integer); Type: FUNCTION; Schema: public; Owner: postgres
--
 
CREATE FUNCTION linefromwkb(bytea, integer) RETURNS geometry
    LANGUAGE sql IMMUTABLE STRICT
    AS $_$
        SELECT CASE WHEN geometrytype(GeomFromWKB($1, $2)) = 'LINESTRING'
        THEN GeomFromWKB($1, $2)
        ELSE NULL END
        $_$;
 
 
ALTER FUNCTION public.linefromwkb(bytea, integer) OWNER TO postgres;
 
--
-- Name: linestringfromtext(text); Type: FUNCTION; Schema: public; Owner: postgres
--
 
CREATE FUNCTION linestringfromtext(text) RETURNS geometry
    LANGUAGE sql IMMUTABLE STRICT
    AS $_$SELECT LineFromText($1)$_$;
 
 
ALTER FUNCTION public.linestringfromtext(text) OWNER TO postgres;
 
--
-- Name: linestringfromtext(text, integer); Type: FUNCTION; Schema: public; Owner: postgres
--
 
CREATE FUNCTION linestringfromtext(text, integer) RETURNS geometry
    LANGUAGE sql IMMUTABLE STRICT
    AS $_$SELECT LineFromText($1, $2)$_$;
 
 
ALTER FUNCTION public.linestringfromtext(text, integer) OWNER TO postgres;
 
--
-- Name: linestringfromwkb(bytea); Type: FUNCTION; Schema: public; Owner: postgres
--
 
CREATE FUNCTION linestringfromwkb(bytea) RETURNS geometry
    LANGUAGE sql IMMUTABLE STRICT
    AS $_$
        SELECT CASE WHEN geometrytype(GeomFromWKB($1)) = 'LINESTRING'
        THEN GeomFromWKB($1)
        ELSE NULL END
        $_$;
 
 
ALTER FUNCTION public.linestringfromwkb(bytea) OWNER TO postgres;
 
--
-- Name: linestringfromwkb(bytea, integer); Type: FUNCTION; Schema: public; Owner: postgres
--
 
CREATE FUNCTION linestringfromwkb(bytea, integer) RETURNS geometry
    LANGUAGE sql IMMUTABLE STRICT
    AS $_$
        SELECT CASE WHEN geometrytype(GeomFromWKB($1, $2)) = 'LINESTRING'
        THEN GeomFromWKB($1, $2)
        ELSE NULL END
        $_$;
 
 
ALTER FUNCTION public.linestringfromwkb(bytea, integer) OWNER TO postgres;
 
--
-- Name: mlinefromtext(text); Type: FUNCTION; Schema: public; Owner: postgres
--
 
CREATE FUNCTION mlinefromtext(text) RETURNS geometry
    LANGUAGE sql IMMUTABLE STRICT
    AS $_$
        SELECT CASE WHEN geometrytype(GeomFromText($1)) = 'MULTILINESTRING'
        THEN GeomFromText($1)
        ELSE NULL END
        $_$;
 
 
ALTER FUNCTION public.mlinefromtext(text) OWNER TO postgres;
 
--
-- Name: mlinefromtext(text, integer); Type: FUNCTION; Schema: public; Owner: postgres
--
 
CREATE FUNCTION mlinefromtext(text, integer) RETURNS geometry
    LANGUAGE sql IMMUTABLE STRICT
    AS $_$
        SELECT CASE
        WHEN geometrytype(GeomFromText($1, $2)) = 'MULTILINESTRING'
        THEN GeomFromText($1,$2)
        ELSE NULL END
        $_$;
 
 
ALTER FUNCTION public.mlinefromtext(text, integer) OWNER TO postgres;
 
--
-- Name: mlinefromwkb(bytea); Type: FUNCTION; Schema: public; Owner: postgres
--
 
CREATE FUNCTION mlinefromwkb(bytea) RETURNS geometry
    LANGUAGE sql IMMUTABLE STRICT
    AS $_$
        SELECT CASE WHEN geometrytype(GeomFromWKB($1)) = 'MULTILINESTRING'
        THEN GeomFromWKB($1)
        ELSE NULL END
        $_$;
 
 
ALTER FUNCTION public.mlinefromwkb(bytea) OWNER TO postgres;
 
--
-- Name: mlinefromwkb(bytea, integer); Type: FUNCTION; Schema: public; Owner: postgres
--
 
CREATE FUNCTION mlinefromwkb(bytea, integer) RETURNS geometry
    LANGUAGE sql IMMUTABLE STRICT
    AS $_$
        SELECT CASE WHEN geometrytype(GeomFromWKB($1, $2)) = 'MULTILINESTRING'
        THEN GeomFromWKB($1, $2)
        ELSE NULL END
        $_$;
 
 
ALTER FUNCTION public.mlinefromwkb(bytea, integer) OWNER TO postgres;
 
--
-- Name: mpointfromtext(text); Type: FUNCTION; Schema: public; Owner: postgres
--
 
CREATE FUNCTION mpointfromtext(text) RETURNS geometry
    LANGUAGE sql IMMUTABLE STRICT
    AS $_$
        SELECT CASE WHEN geometrytype(GeomFromText($1)) = 'MULTIPOINT'
        THEN GeomFromText($1)
        ELSE NULL END
        $_$;
 
 
ALTER FUNCTION public.mpointfromtext(text) OWNER TO postgres;
 
--
-- Name: mpointfromtext(text, integer); Type: FUNCTION; Schema: public; Owner: postgres
--
 
CREATE FUNCTION mpointfromtext(text, integer) RETURNS geometry
    LANGUAGE sql IMMUTABLE STRICT
    AS $_$
        SELECT CASE WHEN geometrytype(GeomFromText($1,$2)) = 'MULTIPOINT'
        THEN GeomFromText($1,$2)
        ELSE NULL END
        $_$;
 
 
ALTER FUNCTION public.mpointfromtext(text, integer) OWNER TO postgres;
 
--
-- Name: mpointfromwkb(bytea); Type: FUNCTION; Schema: public; Owner: postgres
--
 
CREATE FUNCTION mpointfromwkb(bytea) RETURNS geometry
    LANGUAGE sql IMMUTABLE STRICT
    AS $_$
        SELECT CASE WHEN geometrytype(GeomFromWKB($1)) = 'MULTIPOINT'
        THEN GeomFromWKB($1)
        ELSE NULL END
        $_$;
 
 
ALTER FUNCTION public.mpointfromwkb(bytea) OWNER TO postgres;
 
--
-- Name: mpointfromwkb(bytea, integer); Type: FUNCTION; Schema: public; Owner: postgres
--
 
CREATE FUNCTION mpointfromwkb(bytea, integer) RETURNS geometry
    LANGUAGE sql IMMUTABLE STRICT
    AS $_$
        SELECT CASE WHEN geometrytype(GeomFromWKB($1,$2)) = 'MULTIPOINT'
        THEN GeomFromWKB($1, $2)
        ELSE NULL END
        $_$;
 
 
ALTER FUNCTION public.mpointfromwkb(bytea, integer) OWNER TO postgres;
 
--
-- Name: mpolyfromtext(text); Type: FUNCTION; Schema: public; Owner: postgres
--
 
CREATE FUNCTION mpolyfromtext(text) RETURNS geometry
    LANGUAGE sql IMMUTABLE STRICT
    AS $_$
        SELECT CASE WHEN geometrytype(GeomFromText($1)) = 'MULTIPOLYGON'
        THEN GeomFromText($1)
        ELSE NULL END
        $_$;
 
 
ALTER FUNCTION public.mpolyfromtext(text) OWNER TO postgres;
 
--
-- Name: mpolyfromtext(text, integer); Type: FUNCTION; Schema: public; Owner: postgres
--
 
CREATE FUNCTION mpolyfromtext(text, integer) RETURNS geometry
    LANGUAGE sql IMMUTABLE STRICT
    AS $_$
        SELECT CASE WHEN geometrytype(GeomFromText($1, $2)) = 'MULTIPOLYGON'
        THEN GeomFromText($1,$2)
        ELSE NULL END
        $_$;
 
 
ALTER FUNCTION public.mpolyfromtext(text, integer) OWNER TO postgres;
 
--
-- Name: mpolyfromwkb(bytea, integer); Type: FUNCTION; Schema: public; Owner: postgres
--
 
CREATE FUNCTION mpolyfromwkb(bytea, integer) RETURNS geometry
    LANGUAGE sql IMMUTABLE STRICT
    AS $_$
        SELECT CASE WHEN geometrytype(GeomFromWKB($1, $2)) = 'MULTIPOLYGON'
        THEN GeomFromWKB($1, $2)
        ELSE NULL END
        $_$;
 
 
ALTER FUNCTION public.mpolyfromwkb(bytea, integer) OWNER TO postgres;
 
--
-- Name: multilinefromwkb(bytea); Type: FUNCTION; Schema: public; Owner: postgres
--
 
CREATE FUNCTION multilinefromwkb(bytea) RETURNS geometry
    LANGUAGE sql IMMUTABLE STRICT
    AS $_$
        SELECT CASE WHEN geometrytype(GeomFromWKB($1)) = 'MULTILINESTRING'
        THEN GeomFromWKB($1)
        ELSE NULL END
        $_$;
 
 
ALTER FUNCTION public.multilinefromwkb(bytea) OWNER TO postgres;
 
--
-- Name: multilinefromwkb(bytea, integer); Type: FUNCTION; Schema: public; Owner: postgres
--
 
CREATE FUNCTION multilinefromwkb(bytea, integer) RETURNS geometry
    LANGUAGE sql IMMUTABLE STRICT
    AS $_$
        SELECT CASE WHEN geometrytype(GeomFromWKB($1, $2)) = 'MULTILINESTRING'
        THEN GeomFromWKB($1, $2)
        ELSE NULL END
        $_$;
 
 
ALTER FUNCTION public.multilinefromwkb(bytea, integer) OWNER TO postgres;
 
--
-- Name: multilinestringfromtext(text); Type: FUNCTION; Schema: public; Owner: postgres
--
 
CREATE FUNCTION multilinestringfromtext(text) RETURNS geometry
    LANGUAGE sql IMMUTABLE STRICT
    AS $_$SELECT ST_MLineFromText($1)$_$;
 
 
ALTER FUNCTION public.multilinestringfromtext(text) OWNER TO postgres;
 
--
-- Name: multilinestringfromtext(text, integer); Type: FUNCTION; Schema: public; Owner: postgres
--
 
CREATE FUNCTION multilinestringfromtext(text, integer) RETURNS geometry
    LANGUAGE sql IMMUTABLE STRICT
    AS $_$SELECT MLineFromText($1, $2)$_$;
 
 
ALTER FUNCTION public.multilinestringfromtext(text, integer) OWNER TO postgres;
 
--
-- Name: multipointfromtext(text); Type: FUNCTION; Schema: public; Owner: postgres
--
 
CREATE FUNCTION multipointfromtext(text) RETURNS geometry
    LANGUAGE sql IMMUTABLE STRICT
    AS $_$SELECT MPointFromText($1)$_$;
 
 
ALTER FUNCTION public.multipointfromtext(text) OWNER TO postgres;
 
--
-- Name: multipointfromtext(text, integer); Type: FUNCTION; Schema: public; Owner: postgres
--
 
CREATE FUNCTION multipointfromtext(text, integer) RETURNS geometry
    LANGUAGE sql IMMUTABLE STRICT
    AS $_$SELECT MPointFromText($1, $2)$_$;
 
 
ALTER FUNCTION public.multipointfromtext(text, integer) OWNER TO postgres;
 
--
-- Name: multipointfromwkb(bytea); Type: FUNCTION; Schema: public; Owner: postgres
--
 
CREATE FUNCTION multipointfromwkb(bytea) RETURNS geometry
    LANGUAGE sql IMMUTABLE STRICT
    AS $_$
        SELECT CASE WHEN geometrytype(GeomFromWKB($1)) = 'MULTIPOINT'
        THEN GeomFromWKB($1)
        ELSE NULL END
        $_$;
 
 
ALTER FUNCTION public.multipointfromwkb(bytea) OWNER TO postgres;
 
--
-- Name: multipointfromwkb(bytea, integer); Type: FUNCTION; Schema: public; Owner: postgres
--
 
CREATE FUNCTION multipointfromwkb(bytea, integer) RETURNS geometry
    LANGUAGE sql IMMUTABLE STRICT
    AS $_$
        SELECT CASE WHEN geometrytype(GeomFromWKB($1,$2)) = 'MULTIPOINT'
        THEN GeomFromWKB($1, $2)
        ELSE NULL END
        $_$;
 
 
ALTER FUNCTION public.multipointfromwkb(bytea, integer) OWNER TO postgres;
 
--
-- Name: multipolyfromwkb(bytea); Type: FUNCTION; Schema: public; Owner: postgres
--
 
CREATE FUNCTION multipolyfromwkb(bytea) RETURNS geometry
    LANGUAGE sql IMMUTABLE STRICT
    AS $_$
        SELECT CASE WHEN geometrytype(GeomFromWKB($1)) = 'MULTIPOLYGON'
        THEN GeomFromWKB($1)
        ELSE NULL END
        $_$;
 
 
ALTER FUNCTION public.multipolyfromwkb(bytea) OWNER TO postgres;
 
--
-- Name: multipolyfromwkb(bytea, integer); Type: FUNCTION; Schema: public; Owner: postgres
--
 
CREATE FUNCTION multipolyfromwkb(bytea, integer) RETURNS geometry
    LANGUAGE sql IMMUTABLE STRICT
    AS $_$
        SELECT CASE WHEN geometrytype(GeomFromWKB($1, $2)) = 'MULTIPOLYGON'
        THEN GeomFromWKB($1, $2)
        ELSE NULL END
        $_$;
 
 
ALTER FUNCTION public.multipolyfromwkb(bytea, integer) OWNER TO postgres;
 
--
-- Name: multipolygonfromtext(text); Type: FUNCTION; Schema: public; Owner: postgres
--
 
CREATE FUNCTION multipolygonfromtext(text) RETURNS geometry
    LANGUAGE sql IMMUTABLE STRICT
    AS $_$SELECT MPolyFromText($1)$_$;
 
 
ALTER FUNCTION public.multipolygonfromtext(text) OWNER TO postgres;
 
--
-- Name: multipolygonfromtext(text, integer); Type: FUNCTION; Schema: public; Owner: postgres
--
 
CREATE FUNCTION multipolygonfromtext(text, integer) RETURNS geometry
    LANGUAGE sql IMMUTABLE STRICT
    AS $_$SELECT MPolyFromText($1, $2)$_$;
 
 
ALTER FUNCTION public.multipolygonfromtext(text, integer) OWNER TO postgres;
 
--
-- Name: pointfromtext(text); Type: FUNCTION; Schema: public; Owner: postgres
--
 
CREATE FUNCTION pointfromtext(text) RETURNS geometry
    LANGUAGE sql IMMUTABLE STRICT
    AS $_$
        SELECT CASE WHEN geometrytype(GeomFromText($1)) = 'POINT'
        THEN GeomFromText($1)
        ELSE NULL END
        $_$;
 
 
ALTER FUNCTION public.pointfromtext(text) OWNER TO postgres;
 
--
-- Name: pointfromtext(text, integer); Type: FUNCTION; Schema: public; Owner: postgres
--
 
CREATE FUNCTION pointfromtext(text, integer) RETURNS geometry
    LANGUAGE sql IMMUTABLE STRICT
    AS $_$
        SELECT CASE WHEN geometrytype(GeomFromText($1, $2)) = 'POINT'
        THEN GeomFromText($1,$2)
        ELSE NULL END
        $_$;
 
 
ALTER FUNCTION public.pointfromtext(text, integer) OWNER TO postgres;
 
--
-- Name: pointfromwkb(bytea); Type: FUNCTION; Schema: public; Owner: postgres
--
 
CREATE FUNCTION pointfromwkb(bytea) RETURNS geometry
    LANGUAGE sql IMMUTABLE STRICT
    AS $_$
        SELECT CASE WHEN geometrytype(GeomFromWKB($1)) = 'POINT'
        THEN GeomFromWKB($1)
        ELSE NULL END
        $_$;
 
 
ALTER FUNCTION public.pointfromwkb(bytea) OWNER TO postgres;
 
--
-- Name: pointfromwkb(bytea, integer); Type: FUNCTION; Schema: public; Owner: postgres
--
 
CREATE FUNCTION pointfromwkb(bytea, integer) RETURNS geometry
    LANGUAGE sql IMMUTABLE STRICT
    AS $_$
        SELECT CASE WHEN geometrytype(GeomFromWKB($1, $2)) = 'POINT'
        THEN GeomFromWKB($1, $2)
        ELSE NULL END
        $_$;
 
 
ALTER FUNCTION public.pointfromwkb(bytea, integer) OWNER TO postgres;
 
--
-- Name: polyfromtext(text); Type: FUNCTION; Schema: public; Owner: postgres
--
 
CREATE FUNCTION polyfromtext(text) RETURNS geometry
    LANGUAGE sql IMMUTABLE STRICT
    AS $_$
        SELECT CASE WHEN geometrytype(GeomFromText($1)) = 'POLYGON'
        THEN GeomFromText($1)
        ELSE NULL END
        $_$;
 
 
ALTER FUNCTION public.polyfromtext(text) OWNER TO postgres;
 
--
-- Name: polyfromtext(text, integer); Type: FUNCTION; Schema: public; Owner: postgres
--
 
CREATE FUNCTION polyfromtext(text, integer) RETURNS geometry
    LANGUAGE sql IMMUTABLE STRICT
    AS $_$
        SELECT CASE WHEN geometrytype(GeomFromText($1, $2)) = 'POLYGON'
        THEN GeomFromText($1,$2)
        ELSE NULL END
        $_$;
 
 
ALTER FUNCTION public.polyfromtext(text, integer) OWNER TO postgres;
 
--
-- Name: polyfromwkb(bytea); Type: FUNCTION; Schema: public; Owner: postgres
--
 
CREATE FUNCTION polyfromwkb(bytea) RETURNS geometry
    LANGUAGE sql IMMUTABLE STRICT
    AS $_$
        SELECT CASE WHEN geometrytype(GeomFromWKB($1)) = 'POLYGON'
        THEN GeomFromWKB($1)
        ELSE NULL END
        $_$;
 
 
ALTER FUNCTION public.polyfromwkb(bytea) OWNER TO postgres;
 
--
-- Name: polyfromwkb(bytea, integer); Type: FUNCTION; Schema: public; Owner: postgres
--
 
CREATE FUNCTION polyfromwkb(bytea, integer) RETURNS geometry
    LANGUAGE sql IMMUTABLE STRICT
    AS $_$
        SELECT CASE WHEN geometrytype(GeomFromWKB($1, $2)) = 'POLYGON'
        THEN GeomFromWKB($1, $2)
        ELSE NULL END
        $_$;
 
 
ALTER FUNCTION public.polyfromwkb(bytea, integer) OWNER TO postgres;
 
--
-- Name: polygonfromtext(text); Type: FUNCTION; Schema: public; Owner: postgres
--
 
CREATE FUNCTION polygonfromtext(text) RETURNS geometry
    LANGUAGE sql IMMUTABLE STRICT
    AS $_$SELECT PolyFromText($1)$_$;
 
 
ALTER FUNCTION public.polygonfromtext(text) OWNER TO postgres;
 
--
-- Name: polygonfromtext(text, integer); Type: FUNCTION; Schema: public; Owner: postgres
--
 
CREATE FUNCTION polygonfromtext(text, integer) RETURNS geometry
    LANGUAGE sql IMMUTABLE STRICT
    AS $_$SELECT PolyFromText($1, $2)$_$;
 
 
ALTER FUNCTION public.polygonfromtext(text, integer) OWNER TO postgres;
 
--
-- Name: polygonfromwkb(bytea); Type: FUNCTION; Schema: public; Owner: postgres
--
 
CREATE FUNCTION polygonfromwkb(bytea) RETURNS geometry
    LANGUAGE sql IMMUTABLE STRICT
    AS $_$
        SELECT CASE WHEN geometrytype(GeomFromWKB($1)) = 'POLYGON'
        THEN GeomFromWKB($1)
        ELSE NULL END
        $_$;
 
 
ALTER FUNCTION public.polygonfromwkb(bytea) OWNER TO postgres;
 
--
-- Name: polygonfromwkb(bytea, integer); Type: FUNCTION; Schema: public; Owner: postgres
--
 
CREATE FUNCTION polygonfromwkb(bytea, integer) RETURNS geometry
    LANGUAGE sql IMMUTABLE STRICT
    AS $_$
        SELECT CASE WHEN geometrytype(GeomFromWKB($1,$2)) = 'POLYGON'
        THEN GeomFromWKB($1, $2)
        ELSE NULL END
        $_$;
 
 
ALTER FUNCTION public.polygonfromwkb(bytea, integer) OWNER TO postgres;
 
--
-- Name: st_askml(integer, geometry); Type: FUNCTION; Schema: public; Owner: postgres
--
 
CREATE FUNCTION st_askml(integer, geometry) RETURNS text
    LANGUAGE sql IMMUTABLE STRICT
    AS $_$SELECT _ST_AsKML($1, ST_Transform($2,4326), 15)$_$;
 
 
ALTER FUNCTION public.st_askml(integer, geometry) OWNER TO postgres;
 
--
-- Name: st_askml(integer, geography); Type: FUNCTION; Schema: public; Owner: postgres
--
 
CREATE FUNCTION st_askml(integer, geography) RETURNS text
    LANGUAGE sql IMMUTABLE STRICT
    AS $_$SELECT _ST_AsKML($1, $2, 15)$_$;
 
 
ALTER FUNCTION public.st_askml(integer, geography) OWNER TO postgres;
 
--
-- Name: memcollect(geometry); Type: AGGREGATE; Schema: public; Owner: postgres
--
 
CREATE AGGREGATE memcollect(geometry) (
    SFUNC = public.st_collect,
    STYPE = geometry
);
 
 
ALTER AGGREGATE public.memcollect(geometry) OWNER TO postgres;
 
--
-- Name: st_extent3d(geometry); Type: AGGREGATE; Schema: public; Owner: postgres
--
 
CREATE AGGREGATE st_extent3d(geometry) (
    SFUNC = public.st_combine_bbox,
    STYPE = box3d
);
 
 
ALTER AGGREGATE public.st_extent3d(geometry) OWNER TO postgres;
 
SET default_tablespace = '';
 
SET default_with_oids = false;
 
--
-- Name: agency; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--
 
CREATE TABLE agency (
    agency_name text NOT NULL,
    agency_url text,
    agency_timezone text,
    agency_lang text,
    agency_phone text,
    agency_fare_url text,
    agency_id integer
);
 
 
ALTER TABLE public.agency OWNER TO postgres;
 
--
-- Name: calendar; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--
 
CREATE TABLE calendar (
    service_id text NOT NULL,
    start_date text,
    end_date text,
    monday integer,
    tuesday integer,
    wednesday integer,
    thursday integer,
    friday integer,
    saturday integer,
    sunday integer
);
 
 
ALTER TABLE public.calendar OWNER TO postgres;
 
--
-- Name: calendar_dates; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--
 
CREATE TABLE calendar_dates (
    service_id text NOT NULL,
    date text NOT NULL,
    exception_type text
);
 
 
ALTER TABLE public.calendar_dates OWNER TO postgres;
 
--
-- Name: fare_attributes; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--
 
CREATE TABLE fare_attributes (
    fare_id text NOT NULL,
    price double precision,
    currency_type text,
    payment_method integer,
    transfers text,
    transfer_duration integer
);
 
 
ALTER TABLE public.fare_attributes OWNER TO postgres;
 
--
-- Name: feed_info; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--
 
CREATE TABLE feed_info (
    feed_publisher_name text NOT NULL,
    feed_publisher_url text,
    feed_lang text,
    feed_start_date text,
    feed_end_date text,
    feed_version text
);
 
 
ALTER TABLE public.feed_info OWNER TO postgres;
 
--
-- Name: myway_observations; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--
 
CREATE TABLE myway_observations (
    observation_id text NOT NULL,
    myway_stop text,
    "time" timestamp with time zone,
    myway_route text
);
 
 
ALTER TABLE public.myway_observations OWNER TO postgres;
 
--
-- Name: myway_routes; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--
 
CREATE TABLE myway_routes (
    myway_route text NOT NULL,
    route_short_name text,
    trip_headsign text
);
 
 
ALTER TABLE public.myway_routes OWNER TO postgres;
 
--
-- Name: myway_stops; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--
 
CREATE TABLE myway_stops (
    myway_stop text NOT NULL,
    stop_id text
);
 
 
ALTER TABLE public.myway_stops OWNER TO postgres;
 
--
-- Name: myway_timingdeltas; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--
 
CREATE TABLE myway_timingdeltas (
    observation_id text NOT NULL,
    route_id text,
    stop_id text,
    timing_delta integer,
    "time" time with time zone,
    date date,
    timing_period text,
    stop_sequence integer,
    myway_stop text,
    route_name text
);
 
 
ALTER TABLE public.myway_timingdeltas OWNER TO postgres;
 
--
-- Name: myway_timingdeltas_timing_period_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
 
CREATE SEQUENCE myway_timingdeltas_timing_period_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;
 
 
ALTER TABLE public.myway_timingdeltas_timing_period_seq OWNER TO postgres;
 
--
-- Name: myway_timingdeltas_timing_period_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
 
ALTER SEQUENCE myway_timingdeltas_timing_period_seq OWNED BY myway_timingdeltas.timing_period;
 
 
--
-- Name: routes; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--
 
CREATE TABLE routes (
    route_id text NOT NULL,
    route_short_name text,
    route_long_name text,
    route_desc text,
    route_type integer,
    route_url text,
    route_text_color text,
    route_color text,
    agency_id text
);
 
 
ALTER TABLE public.routes OWNER TO postgres;
 
--
-- Name: servicealerts_alerts; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--
 
CREATE TABLE servicealerts_alerts (
    id integer NOT NULL,
    url text,
    description text,
    start timestamp with time zone,
    "end" timestamp with time zone,
    cause text,
    effect text,
    header text
);
 
 
ALTER TABLE public.servicealerts_alerts OWNER TO postgres;
 
--
-- Name: servicealerts_alerts_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
 
CREATE SEQUENCE servicealerts_alerts_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;
 
 
ALTER TABLE public.servicealerts_alerts_id_seq OWNER TO postgres;
 
--
-- Name: servicealerts_alerts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
 
ALTER SEQUENCE servicealerts_alerts_id_seq OWNED BY servicealerts_alerts.id;
 
 
--
-- Name: servicealerts_informed; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--
 
CREATE TABLE servicealerts_informed (
    servicealert_id integer NOT NULL,
    informed_class text NOT NULL,
    informed_id text NOT NULL,
    informed_action text
);
 
 
ALTER TABLE public.servicealerts_informed OWNER TO postgres;
 
--
-- Name: shapes; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--
 
CREATE TABLE shapes (
    shape_id text NOT NULL,
    shape_pt_lat double precision,
    shape_pt_lon double precision,
    shape_pt_sequence integer NOT NULL,
    shape_dist_traveled integer,
    shape_pt geography
);
 
 
ALTER TABLE public.shapes OWNER TO postgres;
 
--
-- Name: stop_times; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--
 
CREATE TABLE stop_times (
    trip_id text NOT NULL,
    arrival_time time without time zone,
    departure_time time without time zone,
    stop_id text,
    stop_sequence integer NOT NULL,
    stop_headsign text,
    pickup_type text,
    drop_off_type text,
    shape_dist_traveled text
);
 
 
ALTER TABLE public.stop_times OWNER TO postgres;
 
--
-- Name: stops; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--
 
CREATE TABLE stops (
    stop_id text NOT NULL,
    stop_code text,
    stop_name text,
    stop_desc text,
    stop_lat double precision,
    stop_lon double precision,
    zone_id text,
    stop_url text,
    location_type integer,
    "position" geography
);
 
 
ALTER TABLE public.stops OWNER TO postgres;
 
--
-- Name: trips; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--
 
CREATE TABLE trips (
    route_id text,
    service_id text,
    trip_id text NOT NULL,
    trip_headsign text,
    direction_id text,
    block_id text,
    shape_id text
);
 
 
ALTER TABLE public.trips OWNER TO postgres;
 
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres
--
 
ALTER TABLE servicealerts_alerts ALTER COLUMN id SET DEFAULT nextval('servicealerts_alerts_id_seq'::regclass);
 
 
--
-- Name: agency_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--
 
ALTER TABLE ONLY agency
    ADD CONSTRAINT agency_pkey PRIMARY KEY (agency_name);
 
 
--
-- Name: calendar_dates_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--
 
ALTER TABLE ONLY calendar_dates
    ADD CONSTRAINT calendar_dates_pkey PRIMARY KEY (service_id, date);
 
 
--
-- Name: calendar_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--
 
ALTER TABLE ONLY calendar
    ADD CONSTRAINT calendar_pkey PRIMARY KEY (service_id);
 
 
--
-- Name: fare_attributes_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--
 
ALTER TABLE ONLY fare_attributes
    ADD CONSTRAINT fare_attributes_pkey PRIMARY KEY (fare_id);
 
 
--
-- Name: feed_info_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--
 
ALTER TABLE ONLY feed_info
    ADD CONSTRAINT feed_info_pkey PRIMARY KEY (feed_publisher_name);
 
 
--
-- Name: myway_observations_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--
 
ALTER TABLE ONLY myway_observations
    ADD CONSTRAINT myway_observations_pkey PRIMARY KEY (observation_id);
 
 
--
-- Name: myway_routes_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--
 
ALTER TABLE ONLY myway_routes
    ADD CONSTRAINT myway_routes_pkey PRIMARY KEY (myway_route);
 
 
--
-- Name: myway_timingdeltas_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--
 
ALTER TABLE ONLY myway_timingdeltas
    ADD CONSTRAINT myway_timingdeltas_pkey PRIMARY KEY (observation_id);
 
 
--
-- Name: mywaystops_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--
 
ALTER TABLE ONLY myway_stops
    ADD CONSTRAINT mywaystops_pkey PRIMARY KEY (myway_stop);
 
 
--
-- Name: routes_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--
 
ALTER TABLE ONLY routes
    ADD CONSTRAINT routes_pkey PRIMARY KEY (route_id);
 
 
--
-- Name: servicealerts_alerts_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--
 
ALTER TABLE ONLY servicealerts_alerts
    ADD CONSTRAINT servicealerts_alerts_pkey PRIMARY KEY (id);
 
 
--
-- Name: servicealerts_informed_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--
 
ALTER TABLE ONLY servicealerts_informed
    ADD CONSTRAINT servicealerts_informed_pkey PRIMARY KEY (servicealert_id, informed_class, informed_id);
 
 
--
-- Name: shapes_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--
 
ALTER TABLE ONLY shapes
    ADD CONSTRAINT shapes_pkey PRIMARY KEY (shape_id, shape_pt_sequence);
 
 
--
-- Name: stop_times_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--
 
ALTER TABLE ONLY stop_times
    ADD CONSTRAINT stop_times_pkey PRIMARY KEY (trip_id, stop_sequence);
 
 
--
-- Name: stops_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--
 
ALTER TABLE ONLY stops
    ADD CONSTRAINT stops_pkey PRIMARY KEY (stop_id);
 
 
--
-- Name: stops_stop_code_key; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--
 
ALTER TABLE ONLY stops
    ADD CONSTRAINT stops_stop_code_key UNIQUE (stop_code);
 
 
--
-- Name: trips_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--
 
ALTER TABLE ONLY trips
    ADD CONSTRAINT trips_pkey PRIMARY KEY (trip_id);
 
 
--
-- Name: routenumber; Type: INDEX; Schema: public; Owner: postgres; Tablespace: 
--
 
CREATE INDEX routenumber ON routes USING btree (route_short_name);
 
 
--
-- Name: routetrips; Type: INDEX; Schema: public; Owner: postgres; Tablespace: 
--
 
CREATE INDEX routetrips ON trips USING btree (route_id);
 
 
--
-- Name: starttime; Type: INDEX; Schema: public; Owner: postgres; Tablespace: 
--
 
CREATE UNIQUE INDEX starttime ON stop_times USING btree (trip_id, stop_id, stop_sequence);
 
 
--
-- Name: stops_position_idx; Type: INDEX; Schema: public; Owner: postgres; Tablespace: 
--
 
CREATE INDEX stops_position_idx ON stops USING gist ("position");
 
 
--
-- Name: stoptimes; Type: INDEX; Schema: public; Owner: postgres; Tablespace: 
--
 
CREATE INDEX stoptimes ON stop_times USING btree (arrival_time, stop_id);
 
 
--
-- Name: times; Type: INDEX; Schema: public; Owner: postgres; Tablespace: 
--
 
CREATE INDEX times ON stop_times USING btree (arrival_time);
 
 
--
-- Name: triptimes; Type: INDEX; Schema: public; Owner: postgres; Tablespace: 
--
 
CREATE INDEX triptimes ON stop_times USING btree (trip_id, arrival_time);
 
 
--
-- Name: servicealerts_alertid; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
 
ALTER TABLE ONLY servicealerts_informed
    ADD CONSTRAINT servicealerts_alertid FOREIGN KEY (servicealert_id) REFERENCES servicealerts_alerts(id);
 
 
--
-- Name: public; Type: ACL; Schema: -; Owner: postgres
--
 
REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM postgres;
GRANT ALL ON SCHEMA public TO postgres;
GRANT ALL ON SCHEMA public TO PUBLIC;
 
 
--
-- Name: myway_observations; Type: ACL; Schema: public; Owner: postgres
--
 
REVOKE ALL ON TABLE myway_observations FROM PUBLIC;
REVOKE ALL ON TABLE myway_observations FROM postgres;
GRANT ALL ON TABLE myway_observations TO postgres;
 
 
--
-- Name: stops; Type: ACL; Schema: public; Owner: postgres
--
 
REVOKE ALL ON TABLE stops FROM PUBLIC;
REVOKE ALL ON TABLE stops FROM postgres;
GRANT ALL ON TABLE stops TO postgres;
GRANT SELECT ON TABLE stops TO transitdata;
 
 
--
-- PostgreSQL database dump complete
--