From b7443a2e5935a37da7d56cd6553c8a176fb3647c Mon Sep 17 00:00:00 2001 From: kylie auld Date: Mon, 3 Jun 2024 13:43:18 -0700 Subject: [PATCH 1/5] remove call to identity --- django_redshift_backend/base.py | 4 ++-- tests/test_redshift_backend.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/django_redshift_backend/base.py b/django_redshift_backend/base.py index c397ba6..69cb197 100644 --- a/django_redshift_backend/base.py +++ b/django_redshift_backend/base.py @@ -1057,8 +1057,8 @@ def _create_unique_sql( redshift_data_types = { - "AutoField": "integer identity(1, 1)", - "BigAutoField": "bigint identity(1, 1)", + "AutoField": "integer", + "BigAutoField": "bigint", "TextField": "varchar(max)", # text must be varchar(max) "UUIDField": "varchar(32)", # redshift doesn't support uuid fields } diff --git a/tests/test_redshift_backend.py b/tests/test_redshift_backend.py index 3b49adf..30874c4 100644 --- a/tests/test_redshift_backend.py +++ b/tests/test_redshift_backend.py @@ -22,7 +22,7 @@ def test_load_redshift_backend(self): expected_ddl_normal = norm_sql( u'''CREATE TABLE "testapp_testmodel" ( - "id" integer identity(1, 1) NOT NULL PRIMARY KEY, + "id" integer NOT NULL PRIMARY KEY, "ctime" timestamp with time zone NOT NULL, "text" varchar(max) NOT NULL, "uuid" varchar(32) NOT NULL @@ -31,7 +31,7 @@ def test_load_redshift_backend(self): expected_ddl_meta_keys = norm_sql( u'''CREATE TABLE "testapp_testmodelwithmetakeys" ( - "id" integer identity(1, 1) NOT NULL PRIMARY KEY, + "id" integer NOT NULL PRIMARY KEY, "name" varchar(100) NOT NULL, "age" integer NOT NULL, "created_at" timestamp with time zone NOT NULL, From 7621be6ff3c7065706a57ae72d7a425717346b35 Mon Sep 17 00:00:00 2001 From: kylie auld Date: Mon, 3 Jun 2024 14:06:10 -0700 Subject: [PATCH 2/5] add pre-commit file to enable workflows to run --- .pre-commit-config.yaml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..ecfba88 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,13 @@ +repos: +- "https://github.com/jazzband/django-redshift-backend" +ci: + autofix_commit_msg: | + [pre-commit.ci] auto fixes from pre-commit.com hooks + + for more information, see https://pre-commit.ci + autofix_prs: true + autoupdate_branch: '' + autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate' + autoupdate_schedule: weekly + skip: [] + submodules: false From 19b02c12ed47132da74b79c72179508a981abc49 Mon Sep 17 00:00:00 2001 From: kylie auld Date: Mon, 3 Jun 2024 14:07:33 -0700 Subject: [PATCH 3/5] pre-commit --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ecfba88..9af45c1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,5 +1,5 @@ repos: -- "https://github.com/jazzband/django-redshift-backend" +- repo: "https://github.com/jazzband/django-redshift-backend" ci: autofix_commit_msg: | [pre-commit.ci] auto fixes from pre-commit.com hooks From 0e4501147cfe042b495cc888ee28e468ec1aac0e Mon Sep 17 00:00:00 2001 From: kylie auld Date: Mon, 3 Jun 2024 14:13:48 -0700 Subject: [PATCH 4/5] remove pre-commit file --- .pre-commit-config.yaml | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml deleted file mode 100644 index 9af45c1..0000000 --- a/.pre-commit-config.yaml +++ /dev/null @@ -1,13 +0,0 @@ -repos: -- repo: "https://github.com/jazzband/django-redshift-backend" -ci: - autofix_commit_msg: | - [pre-commit.ci] auto fixes from pre-commit.com hooks - - for more information, see https://pre-commit.ci - autofix_prs: true - autoupdate_branch: '' - autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate' - autoupdate_schedule: weekly - skip: [] - submodules: false From 3cef0a1acd30ff1bc953e3a9820b93ffc510457d Mon Sep 17 00:00:00 2001 From: kylie auld Date: Thu, 20 Jun 2024 11:40:24 -0700 Subject: [PATCH 5/5] use correct length for uuid fields --- django_redshift_backend/base.py | 2 +- tests/test_redshift_backend.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/django_redshift_backend/base.py b/django_redshift_backend/base.py index 69cb197..4fa8b08 100644 --- a/django_redshift_backend/base.py +++ b/django_redshift_backend/base.py @@ -1060,7 +1060,7 @@ def _create_unique_sql( "AutoField": "integer", "BigAutoField": "bigint", "TextField": "varchar(max)", # text must be varchar(max) - "UUIDField": "varchar(32)", # redshift doesn't support uuid fields + "UUIDField": "varchar(36)", # redshift doesn't support uuid fields } diff --git a/tests/test_redshift_backend.py b/tests/test_redshift_backend.py index 30874c4..a6bd116 100644 --- a/tests/test_redshift_backend.py +++ b/tests/test_redshift_backend.py @@ -25,7 +25,7 @@ def test_load_redshift_backend(self): "id" integer NOT NULL PRIMARY KEY, "ctime" timestamp with time zone NOT NULL, "text" varchar(max) NOT NULL, - "uuid" varchar(32) NOT NULL + "uuid" varchar(36) NOT NULL ) ;''')