From e7473563acc129af1cca2da40ba7022a58bd8a60 Mon Sep 17 00:00:00 2001 From: Tigor Hutasuhut Date: Sat, 4 May 2024 22:17:10 +0700 Subject: [PATCH] sqlite: fix columns like subreddit name to be case insensitive --- db/migrations/20240406220949_create_subreddits_table.sql | 2 +- db/migrations/20240409221254_create_table_device.sql | 4 ++-- db/migrations/20240409222145_create_images_table.sql | 4 ++-- db/migrations/20240503212313_create_table_schedule_status.sql | 2 +- .../20240503212902_create_table_schedule_history.sql | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/db/migrations/20240406220949_create_subreddits_table.sql b/db/migrations/20240406220949_create_subreddits_table.sql index c914bd9..1d2e429 100644 --- a/db/migrations/20240406220949_create_subreddits_table.sql +++ b/db/migrations/20240406220949_create_subreddits_table.sql @@ -1,7 +1,7 @@ -- +goose Up -- +goose StatementBegin CREATE TABLE subreddits ( - name VARCHAR(30) NOT NULL PRIMARY KEY, + name VARCHAR(30) NOT NULL PRIMARY KEY COLLATE NOCASE, enable_schedule INT NOT NULL DEFAULT 1, subtype INT NOT NULL DEFAULT 0, schedule VARCHAR(20) NOT NULL DEFAULT '@daily', diff --git a/db/migrations/20240409221254_create_table_device.sql b/db/migrations/20240409221254_create_table_device.sql index 40069cb..888c980 100644 --- a/db/migrations/20240409221254_create_table_device.sql +++ b/db/migrations/20240409221254_create_table_device.sql @@ -1,9 +1,9 @@ -- +goose Up -- +goose StatementBegin CREATE TABLE devices( - slug VARCHAR(255) NOT NULL PRIMARY KEY, + slug VARCHAR(255) NOT NULL PRIMARY KEY COLLATE NOCASE, enable INTEGER NOT NULL DEFAULT 1, - name VARCHAR(255) NOT NULL, + name VARCHAR(255) NOT NULL COLLATE NOCASE, resolution_x DOUBLE NOT NULL, resolution_y DOUBLE NOT NULL, aspect_ratio_tolerance DOUBLE NOT NULL default 0.2, diff --git a/db/migrations/20240409222145_create_images_table.sql b/db/migrations/20240409222145_create_images_table.sql index 3cebedf..3886e83 100644 --- a/db/migrations/20240409222145_create_images_table.sql +++ b/db/migrations/20240409222145_create_images_table.sql @@ -2,8 +2,8 @@ -- +goose StatementBegin CREATE TABLE images( id INTEGER PRIMARY KEY, - subreddit VARCHAR(255) NOT NULL, - device VARCHAR(250) NOT NULL, + subreddit VARCHAR(255) NOT NULL COLLATE NOCASE, + device VARCHAR(250) NOT NULL COLLATE NOCASE, post_title VARCHAR(255) NOT NULL, post_name VARCHAR(255) NOT NULL, post_url VARCHAR(255) NOT NULL, diff --git a/db/migrations/20240503212313_create_table_schedule_status.sql b/db/migrations/20240503212313_create_table_schedule_status.sql index f59b6f3..4fbe96d 100644 --- a/db/migrations/20240503212313_create_table_schedule_status.sql +++ b/db/migrations/20240503212313_create_table_schedule_status.sql @@ -2,7 +2,7 @@ -- +goose StatementBegin CREATE TABLE schedule_status( id INTEGER PRIMARY KEY, - subreddit VARCHAR(255) NOT NULL, + subreddit VARCHAR(255) NOT NULL COLLATE NOCASE, status TINYINT NOT NULL DEFAULT 0, error_message VARCHAR(255) NOT NULL DEFAULT '', created_at BIGINT DEFAULT 0 NOT NULL, diff --git a/db/migrations/20240503212902_create_table_schedule_history.sql b/db/migrations/20240503212902_create_table_schedule_history.sql index 1267785..5db3423 100644 --- a/db/migrations/20240503212902_create_table_schedule_history.sql +++ b/db/migrations/20240503212902_create_table_schedule_history.sql @@ -2,7 +2,7 @@ -- +goose StatementBegin CREATE TABLE schedule_histories( id INTEGER PRIMARY KEY AUTOINCREMENT, - subreddit VARCHAR(255) NOT NULL, + subreddit VARCHAR(255) NOT NULL COLLATE NOCASE, status TINYINT NOT NULL DEFAULT 0, error_message VARCHAR(255) NOT NULL DEFAULT '', created_at BIGINT DEFAULT 0 NOT NULL,