-
Notifications
You must be signed in to change notification settings - Fork 296
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change create_at and updated_at to TIMESTAMP WITH TIME ZONE.
- Loading branch information
1 parent
e4e9de2
commit 43f83ab
Showing
18 changed files
with
233 additions
and
45 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
/* | ||
Warnings: | ||
- 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. | ||
- 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. | ||
- 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. | ||
- 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. | ||
- 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. | ||
- 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. | ||
- 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. | ||
- 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. | ||
- 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. | ||
- 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. | ||
- 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. | ||
- 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. | ||
- 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. | ||
- 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. | ||
*/ | ||
-- AlterTable | ||
ALTER TABLE "category_supplies" ADD COLUMN "created_at_tmp" TIMESTAMP(3) default null; | ||
UPDATE "category_supplies" | ||
SET "created_at_tmp" = CASE | ||
WHEN "created_at" ~* '^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}$' THEN "created_at"::timestamp | ||
ELSE NOW() | ||
END; | ||
ALTER TABLE "category_supplies" DROP COLUMN "created_at"; | ||
ALTER TABLE "category_supplies" RENAME COLUMN "created_at_tmp" TO "created_at"; | ||
|
||
-- AlterTable | ||
ALTER TABLE "category_supplies" ADD COLUMN "updated_at_tmp" TIMESTAMP(3) default null; | ||
UPDATE "category_supplies" | ||
SET "updated_at_tmp" = CASE | ||
WHEN "updated_at" ~* '^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}$' THEN "updated_at"::timestamp | ||
ELSE null | ||
END; | ||
ALTER TABLE "category_supplies" DROP COLUMN "updated_at"; | ||
ALTER TABLE "category_supplies" RENAME COLUMN "updated_at_tmp" TO "updated_at"; | ||
|
||
-- AlterTable | ||
ALTER TABLE "sessions" ADD COLUMN "created_at_tmp" TIMESTAMP(3) default null; | ||
UPDATE "sessions" | ||
SET "created_at_tmp" = CASE | ||
WHEN "created_at" ~* '^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}$' THEN "created_at"::timestamp | ||
ELSE NOW() | ||
END; | ||
ALTER TABLE "sessions" DROP COLUMN "created_at"; | ||
ALTER TABLE "sessions" RENAME COLUMN "created_at_tmp" TO "created_at"; | ||
|
||
-- AlterTable | ||
ALTER TABLE "sessions" ADD COLUMN "updated_at_tmp" TIMESTAMP(3) default null; | ||
UPDATE "sessions" | ||
SET "updated_at_tmp" = CASE | ||
WHEN "updated_at" ~* '^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}$' THEN "updated_at"::timestamp | ||
ELSE null | ||
END; | ||
ALTER TABLE "sessions" DROP COLUMN "updated_at"; | ||
ALTER TABLE "sessions" RENAME COLUMN "updated_at_tmp" TO "updated_at"; | ||
|
||
-- AlterTable | ||
ALTER TABLE "shelter_managers" ADD COLUMN "created_at_tmp" TIMESTAMP(3) default null; | ||
UPDATE "shelter_managers" | ||
SET "created_at_tmp" = CASE | ||
WHEN "created_at" ~* '^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}$' THEN "created_at"::timestamp | ||
ELSE NOW() | ||
END; | ||
ALTER TABLE "shelter_managers" DROP COLUMN "created_at"; | ||
ALTER TABLE "shelter_managers" RENAME COLUMN "created_at_tmp" TO "created_at"; | ||
|
||
-- AlterTable | ||
ALTER TABLE "shelter_managers" ADD COLUMN "updated_at_tmp" TIMESTAMP(3) default null; | ||
UPDATE "shelter_managers" | ||
SET "updated_at_tmp" = CASE | ||
WHEN "updated_at" ~* '^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}$' THEN "updated_at"::timestamp | ||
ELSE null | ||
END; | ||
ALTER TABLE "shelter_managers" DROP COLUMN "updated_at"; | ||
ALTER TABLE "shelter_managers" RENAME COLUMN "updated_at_tmp" TO "updated_at"; | ||
|
||
-- AlterTable | ||
ALTER TABLE "shelter_supplies" ADD COLUMN "created_at_tmp" TIMESTAMP(3) default null; | ||
UPDATE "shelter_supplies" | ||
SET "created_at_tmp" = CASE | ||
WHEN "created_at" ~* '^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}$' THEN "created_at"::timestamp | ||
ELSE NOW() | ||
END; | ||
ALTER TABLE "shelter_supplies" DROP COLUMN "created_at"; | ||
ALTER TABLE "shelter_supplies" RENAME COLUMN "created_at_tmp" TO "created_at"; | ||
|
||
|
||
ALTER TABLE "shelter_supplies" ADD COLUMN "updated_at_tmp" TIMESTAMP(3) default null; | ||
UPDATE "shelter_supplies" | ||
SET "updated_at_tmp" = CASE | ||
WHEN "updated_at" ~* '^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}$' THEN "updated_at"::timestamp | ||
ELSE null | ||
END; | ||
ALTER TABLE "shelter_supplies" DROP COLUMN "updated_at"; | ||
ALTER TABLE "shelter_supplies" RENAME COLUMN "updated_at_tmp" TO "updated_at"; | ||
|
||
-- AlterTable | ||
ALTER TABLE "shelters" ADD COLUMN "created_at_tmp" TIMESTAMP(3) default null; | ||
UPDATE "shelters" | ||
SET "created_at_tmp" = CASE | ||
WHEN "created_at" ~* '^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}$' THEN "created_at"::timestamp | ||
ELSE NOW() | ||
END; | ||
ALTER TABLE "shelters" DROP COLUMN "created_at"; | ||
ALTER TABLE "shelters" RENAME COLUMN "created_at_tmp" TO "created_at"; | ||
|
||
-- AlterTable | ||
ALTER TABLE "shelters" ADD COLUMN "updated_at_tmp" TIMESTAMP(3) default null; | ||
UPDATE "shelters" | ||
SET "updated_at_tmp" = CASE | ||
WHEN "updated_at" ~* '^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}$' THEN "updated_at"::timestamp | ||
ELSE null | ||
END; | ||
ALTER TABLE "shelters" DROP COLUMN "updated_at"; | ||
ALTER TABLE "shelters" RENAME COLUMN "updated_at_tmp" TO "updated_at"; | ||
|
||
-- AlterTable | ||
ALTER TABLE "supplies" ADD COLUMN "created_at_tmp" TIMESTAMP(3) default null; | ||
UPDATE "supplies" | ||
SET "created_at_tmp" = CASE | ||
WHEN "created_at" ~* '^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}$' THEN "created_at"::timestamp | ||
ELSE NOW() | ||
END; | ||
ALTER TABLE "supplies" DROP COLUMN "created_at"; | ||
ALTER TABLE "supplies" RENAME COLUMN "created_at_tmp" TO "created_at"; | ||
|
||
-- AlterTable | ||
ALTER TABLE "supplies" ADD COLUMN "updated_at_tmp" TIMESTAMP(3) default null; | ||
UPDATE "supplies" | ||
SET "updated_at_tmp" = CASE | ||
WHEN "updated_at" ~* '^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}$' THEN "updated_at"::timestamp | ||
ELSE null | ||
END; | ||
ALTER TABLE "supplies" DROP COLUMN "updated_at"; | ||
ALTER TABLE "supplies" RENAME COLUMN "updated_at_tmp" TO "updated_at"; | ||
|
||
-- AlterTable | ||
ALTER TABLE "users" ADD COLUMN "created_at_tmp" TIMESTAMP(3) default null; | ||
UPDATE "users" | ||
SET "created_at_tmp" = CASE | ||
WHEN "created_at" ~* '^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}$' THEN "created_at"::timestamp | ||
ELSE NOW() | ||
END; | ||
ALTER TABLE "users" DROP COLUMN "created_at"; | ||
ALTER TABLE "users" RENAME COLUMN "created_at_tmp" TO "created_at"; | ||
|
||
ALTER TABLE "users" ADD COLUMN "updated_at_tmp" TIMESTAMP(3) default null; | ||
UPDATE "users" | ||
SET "updated_at_tmp" = CASE | ||
WHEN "updated_at" ~* '^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}$' THEN "updated_at"::timestamp | ||
ELSE null | ||
END; | ||
ALTER TABLE "users" DROP COLUMN "updated_at"; | ||
ALTER TABLE "users" RENAME COLUMN "updated_at_tmp" TO "updated_at"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
-- AlterTable | ||
ALTER TABLE "category_supplies" ALTER COLUMN "updated_at" DROP DEFAULT; | ||
|
||
-- AlterTable | ||
ALTER TABLE "sessions" ALTER COLUMN "updated_at" DROP DEFAULT; | ||
|
||
-- AlterTable | ||
ALTER TABLE "shelter_managers" ALTER COLUMN "updated_at" DROP DEFAULT; | ||
|
||
-- AlterTable | ||
ALTER TABLE "shelter_supplies" ALTER COLUMN "updated_at" DROP DEFAULT; | ||
|
||
-- AlterTable | ||
ALTER TABLE "shelters" ALTER COLUMN "updated_at" DROP DEFAULT; | ||
|
||
-- AlterTable | ||
ALTER TABLE "supplies" ALTER COLUMN "updated_at" DROP DEFAULT; | ||
|
||
-- AlterTable | ||
ALTER TABLE "users" ALTER COLUMN "updated_at" DROP DEFAULT; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.