Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions migrations/20260719133244_initial_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ CREATE TABLE
clothing_id VARCHAR(36) NOT NULL,
user_id VARCHAR(36) NOT NULL,
name VARCHAR(50) NOT NULL,
description VARCHAR(255) NULL,
category VARCHAR(50) NOT NULL,
sub_category VARCHAR(50) NOT NULL,
image_id VARCHAR(36) NOT NULL,
Expand Down Expand Up @@ -110,7 +109,6 @@ CREATE TABLE
outfit_id VARCHAR(36) NOT NULL,
user_id VARCHAR(36) NOT NULL,
name VARCHAR(50) NOT NULL,
description VARCHAR(255) NULL,
is_favorite TINYINT(1) NOT NULL DEFAULT 0,
is_public TINYINT(1) NOT NULL DEFAULT 0,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
Expand Down
22 changes: 18 additions & 4 deletions migrations/20260719140952_drop_description_columns.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,27 @@
-- Author: David Riegel <40246197+davidriegel@users.noreply.github.com>

-- name: migrate-20260719140952-up
ALTER TABLE clothing
DROP COLUMN description;

ALTER TABLE outfits
DROP COLUMN description;
SET @drop_clothing_description := IF(
EXISTS(SELECT 1 FROM information_schema.columns
WHERE table_schema = DATABASE() AND table_name = 'clothing' AND column_name = 'description'),
'ALTER TABLE clothing DROP COLUMN description',
'DO 0');
PREPARE stmt FROM @drop_clothing_description;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;

SET @drop_outfits_description := IF(
EXISTS(SELECT 1 FROM information_schema.columns
WHERE table_schema = DATABASE() AND table_name = 'outfits' AND column_name = 'description'),
'ALTER TABLE outfits DROP COLUMN description',
'DO 0');
PREPARE stmt FROM @drop_outfits_description;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;

-- name: migrate-20260719140952-down

ALTER TABLE clothing
ADD description VARCHAR(255) NULL;

Expand Down
Loading