1+ /*
2+ Warnings:
3+
4+ - The `created_at` column on the `category_supplies` table would be dropped and recreated. This will lead to data loss if there is data in the column.
5+ - The `updated_at` column on the `category_supplies` table would be dropped and recreated. This will lead to data loss if there is data in the column.
6+ - The `created_at` column on the `sessions` table would be dropped and recreated. This will lead to data loss if there is data in the column.
7+ - The `updated_at` column on the `sessions` table would be dropped and recreated. This will lead to data loss if there is data in the column.
8+ - The `created_at` column on the `shelter_managers` table would be dropped and recreated. This will lead to data loss if there is data in the column.
9+ - The `updated_at` column on the `shelter_managers` table would be dropped and recreated. This will lead to data loss if there is data in the column.
10+ - The `created_at` column on the `shelter_supplies` table would be dropped and recreated. This will lead to data loss if there is data in the column.
11+ - The `updated_at` column on the `shelter_supplies` table would be dropped and recreated. This will lead to data loss if there is data in the column.
12+ - The `created_at` column on the `shelters` table would be dropped and recreated. This will lead to data loss if there is data in the column.
13+ - The `updated_at` column on the `shelters` table would be dropped and recreated. This will lead to data loss if there is data in the column.
14+ - The `created_at` column on the `supplies` table would be dropped and recreated. This will lead to data loss if there is data in the column.
15+ - The `updated_at` column on the `supplies` table would be dropped and recreated. This will lead to data loss if there is data in the column.
16+ - The `created_at` column on the `users` table would be dropped and recreated. This will lead to data loss if there is data in the column.
17+ - The `updated_at` column on the `users` table would be dropped and recreated. This will lead to data loss if there is data in the column.
18+
19+ */
20+ -- AlterTable
21+ ALTER TABLE " category_supplies" ADD COLUMN " created_at_tmp" TIMESTAMP (3 ) default null ;
22+ UPDATE " category_supplies"
23+ SET " created_at_tmp" = CASE
24+ WHEN " created_at" ~* ' ^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}$' THEN TO_TIMESTAMP(" created_at" , ' YYYY-MM-DD HH24:MI:SS' )
25+ ELSE NOW()
26+ END;
27+ ALTER TABLE " category_supplies" DROP COLUMN " created_at" ;
28+ ALTER TABLE " category_supplies" RENAME COLUMN " created_at_tmp" TO " created_at" ;
29+
30+ -- AlterTable
31+ ALTER TABLE " category_supplies" ADD COLUMN " updated_at_tmp" TIMESTAMP (3 ) default null ;
32+ UPDATE " category_supplies"
33+ SET " updated_at_tmp" = CASE
34+ WHEN " updated_at" ~* ' ^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}$' THEN TO_TIMESTAMP(" updated_at" , ' YYYY-MM-DD HH24:MI:SS' )
35+ ELSE null
36+ END;
37+ ALTER TABLE " category_supplies" DROP COLUMN " updated_at" ;
38+ ALTER TABLE " category_supplies" RENAME COLUMN " updated_at_tmp" TO " updated_at" ;
39+
40+ -- AlterTable
41+ ALTER TABLE " sessions" ADD COLUMN " created_at_tmp" TIMESTAMP (3 ) default null ;
42+ UPDATE " sessions"
43+ SET " created_at_tmp" = CASE
44+ WHEN " created_at" ~* ' ^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}$' THEN TO_TIMESTAMP(" created_at" , ' YYYY-MM-DD HH24:MI:SS' )
45+ ELSE NOW()
46+ END;
47+ ALTER TABLE " sessions" DROP COLUMN " created_at" ;
48+ ALTER TABLE " sessions" RENAME COLUMN " created_at_tmp" TO " created_at" ;
49+
50+ -- AlterTable
51+ ALTER TABLE " sessions" ADD COLUMN " updated_at_tmp" TIMESTAMP (3 ) default null ;
52+ UPDATE " sessions"
53+ SET " updated_at_tmp" = CASE
54+ WHEN " updated_at" ~* ' ^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}$' THEN TO_TIMESTAMP(" updated_at" , ' YYYY-MM-DD HH24:MI:SS' )
55+ ELSE null
56+ END;
57+ ALTER TABLE " sessions" DROP COLUMN " updated_at" ;
58+ ALTER TABLE " sessions" RENAME COLUMN " updated_at_tmp" TO " updated_at" ;
59+
60+ -- AlterTable
61+ ALTER TABLE " shelter_managers" ADD COLUMN " created_at_tmp" TIMESTAMP (3 ) default null ;
62+ UPDATE " shelter_managers"
63+ SET " created_at_tmp" = CASE
64+ WHEN " created_at" ~* ' ^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}$' THEN TO_TIMESTAMP(" created_at" , ' YYYY-MM-DD HH24:MI:SS' )
65+ ELSE NOW()
66+ END;
67+ ALTER TABLE " shelter_managers" DROP COLUMN " created_at" ;
68+ ALTER TABLE " shelter_managers" RENAME COLUMN " created_at_tmp" TO " created_at" ;
69+
70+ -- AlterTable
71+ ALTER TABLE " shelter_managers" ADD COLUMN " updated_at_tmp" TIMESTAMP (3 ) default null ;
72+ UPDATE " shelter_managers"
73+ SET " updated_at_tmp" = CASE
74+ WHEN " updated_at" ~* ' ^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}$' THEN TO_TIMESTAMP(" updated_at" , ' YYYY-MM-DD HH24:MI:SS' )
75+ ELSE null
76+ END;
77+ ALTER TABLE " shelter_managers" DROP COLUMN " updated_at" ;
78+ ALTER TABLE " shelter_managers" RENAME COLUMN " updated_at_tmp" TO " updated_at" ;
79+
80+ -- AlterTable
81+ ALTER TABLE " shelter_supplies" ADD COLUMN " created_at_tmp" TIMESTAMP (3 ) default null ;
82+ UPDATE " shelter_supplies"
83+ SET " created_at_tmp" = CASE
84+ WHEN " created_at" ~* ' ^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}$' THEN TO_TIMESTAMP(" created_at" , ' YYYY-MM-DD HH24:MI:SS' )
85+ ELSE NOW()
86+ END;
87+ ALTER TABLE " shelter_supplies" DROP COLUMN " created_at" ;
88+ ALTER TABLE " shelter_supplies" RENAME COLUMN " created_at_tmp" TO " created_at" ;
89+
90+
91+ ALTER TABLE " shelter_supplies" ADD COLUMN " updated_at_tmp" TIMESTAMP (3 ) default null ;
92+ UPDATE " shelter_supplies"
93+ SET " updated_at_tmp" = CASE
94+ WHEN " updated_at" ~* ' ^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}$' THEN TO_TIMESTAMP(" updated_at" , ' YYYY-MM-DD HH24:MI:SS' )
95+ ELSE null
96+ END;
97+ ALTER TABLE " shelter_supplies" DROP COLUMN " updated_at" ;
98+ ALTER TABLE " shelter_supplies" RENAME COLUMN " updated_at_tmp" TO " updated_at" ;
99+
100+ -- AlterTable
101+ ALTER TABLE " shelters" ADD COLUMN " created_at_tmp" TIMESTAMP (3 ) default null ;
102+ UPDATE " shelters"
103+ SET " created_at_tmp" = CASE
104+ WHEN " created_at" ~* ' ^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}$' THEN TO_TIMESTAMP(" created_at" , ' YYYY-MM-DD HH24:MI:SS' )
105+ ELSE NOW()
106+ END;
107+ ALTER TABLE " shelters" DROP COLUMN " created_at" ;
108+ ALTER TABLE " shelters" RENAME COLUMN " created_at_tmp" TO " created_at" ;
109+
110+ -- AlterTable
111+ ALTER TABLE " shelters" ADD COLUMN " updated_at_tmp" TIMESTAMP (3 ) default null ;
112+ UPDATE " shelters"
113+ SET " updated_at_tmp" = CASE
114+ WHEN " updated_at" ~* ' ^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}$' THEN TO_TIMESTAMP(" updated_at" , ' YYYY-MM-DD HH24:MI:SS' )
115+ ELSE null
116+ END;
117+ ALTER TABLE " shelters" DROP COLUMN " updated_at" ;
118+ ALTER TABLE " shelters" RENAME COLUMN " updated_at_tmp" TO " updated_at" ;
119+
120+ -- AlterTable
121+ ALTER TABLE " supplies" ADD COLUMN " created_at_tmp" TIMESTAMP (3 ) default null ;
122+ UPDATE " supplies"
123+ SET " created_at_tmp" = CASE
124+ WHEN " created_at" ~* ' ^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}$' THEN TO_TIMESTAMP(" created_at" , ' YYYY-MM-DD HH24:MI:SS' )
125+ ELSE NOW()
126+ END;
127+ ALTER TABLE " supplies" DROP COLUMN " created_at" ;
128+ ALTER TABLE " supplies" RENAME COLUMN " created_at_tmp" TO " created_at" ;
129+
130+ -- AlterTable
131+ ALTER TABLE " supplies" ADD COLUMN " updated_at_tmp" TIMESTAMP (3 ) default null ;
132+ UPDATE " supplies"
133+ SET " updated_at_tmp" = CASE
134+ WHEN " updated_at" ~* ' ^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}$' THEN TO_TIMESTAMP(" updated_at" , ' YYYY-MM-DD HH24:MI:SS' )
135+ ELSE null
136+ END;
137+ ALTER TABLE " supplies" DROP COLUMN " updated_at" ;
138+ ALTER TABLE " supplies" RENAME COLUMN " updated_at_tmp" TO " updated_at" ;
139+
140+ -- AlterTable
141+ ALTER TABLE " users" ADD COLUMN " created_at_tmp" TIMESTAMP (3 ) default null ;
142+ UPDATE " users"
143+ SET " created_at_tmp" = CASE
144+ WHEN " created_at" ~* ' ^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}$' THEN TO_TIMESTAMP(" created_at" , ' YYYY-MM-DD HH24:MI:SS' )
145+ ELSE NOW()
146+ END;
147+ ALTER TABLE " users" DROP COLUMN " created_at" ;
148+ ALTER TABLE " users" RENAME COLUMN " created_at_tmp" TO " created_at" ;
149+
150+ ALTER TABLE " users" ADD COLUMN " updated_at_tmp" TIMESTAMP (3 ) default null ;
151+ UPDATE " users"
152+ SET " updated_at_tmp" = CASE
153+ WHEN " updated_at" ~* ' ^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}$' THEN TO_TIMESTAMP(" updated_at" , ' YYYY-MM-DD HH24:MI:SS' )
154+ ELSE null
155+ END;
156+ ALTER TABLE " users" DROP COLUMN " updated_at" ;
157+ ALTER TABLE " users" RENAME COLUMN " updated_at_tmp" TO " updated_at" ;
0 commit comments