-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convertir columna dia en tipo fecha (#79)
* Convertir columna dia en tipo fecha * Remove dayjs * Poner comentarios ene spañol * Poner columna dia como unica
- Loading branch information
1 parent
a07f6b4
commit 14d23d2
Showing
4 changed files
with
21 additions
and
23 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
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,17 @@ | ||
-- Paso 1: Agregar una nueva columna dia_temp con tipo de dato date | ||
ALTER TABLE tontos ADD COLUMN dia_temp DATE; | ||
|
||
-- Paso 2: Establecer los valores de dia_temp a partir de dia | ||
UPDATE tontos SET dia_temp = TO_DATE(dia, 'DD/MM/YYYY'); | ||
|
||
-- Paso 3: Eliminar la antigua columna dia | ||
ALTER TABLE tontos DROP COLUMN dia; | ||
|
||
-- Paso 4: Renombrar dia_temp a dia | ||
ALTER TABLE tontos RENAME COLUMN dia_temp TO dia; | ||
|
||
-- Paso 5: Establecer la nueva columna dia como no nula | ||
ALTER TABLE tontos ALTER COLUMN dia SET NOT NULL; | ||
|
||
-- Paso 6: Establecer la nueva columna dia como única | ||
ALTER TABLE tontos ADD UNIQUE (dia); |