From af73ab6bdd382065b133ffe316afc1e8bd8f9650 Mon Sep 17 00:00:00 2001 From: Gabriele Granello Date: Fri, 9 Aug 2024 11:42:22 +0200 Subject: [PATCH 1/2] first migration with prisma. Added clause not null --- package-lock.json | 56 +++++++-------- package.json | 2 +- prisma/migrations/0_init/migration.sql | 98 ++++++++++++++++++++++++++ 3 files changed, 127 insertions(+), 29 deletions(-) create mode 100644 prisma/migrations/0_init/migration.sql diff --git a/package-lock.json b/package-lock.json index e5df2d0..f781df6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -39,7 +39,7 @@ "lint-staged": "^15.2.8", "postcss": "^8", "prettier": "3.3.3", - "prisma": "^5.14.0", + "prisma": "^5.18.0", "tailwindcss": "^3.3.0", "ts-jest": "^29.1.4", "typescript": "^5" @@ -1568,48 +1568,48 @@ } }, "node_modules/@prisma/debug": { - "version": "5.14.0", - "resolved": "https://registry.npmjs.org/@prisma/debug/-/debug-5.14.0.tgz", - "integrity": "sha512-iq56qBZuFfX3fCxoxT8gBX33lQzomBU0qIUaEj1RebsKVz1ob/BVH1XSBwwwvRVtZEV1b7Fxx2eVu34Ge/mg3w==", + "version": "5.18.0", + "resolved": "https://registry.npmjs.org/@prisma/debug/-/debug-5.18.0.tgz", + "integrity": "sha512-f+ZvpTLidSo3LMJxQPVgAxdAjzv5OpzAo/eF8qZqbwvgi2F5cTOI9XCpdRzJYA0iGfajjwjOKKrVq64vkxEfUw==", "devOptional": true }, "node_modules/@prisma/engines": { - "version": "5.14.0", - "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-5.14.0.tgz", - "integrity": "sha512-lgxkKZ6IEygVcw6IZZUlPIfLQ9hjSYAtHjZ5r64sCLDgVzsPFCi2XBBJgzPMkOQ5RHzUD4E/dVdpn9+ez8tk1A==", + "version": "5.18.0", + "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-5.18.0.tgz", + "integrity": "sha512-ofmpGLeJ2q2P0wa/XaEgTnX/IsLnvSp/gZts0zjgLNdBhfuj2lowOOPmDcfKljLQUXMvAek3lw5T01kHmCG8rg==", "devOptional": true, "hasInstallScript": true, "dependencies": { - "@prisma/debug": "5.14.0", - "@prisma/engines-version": "5.14.0-25.e9771e62de70f79a5e1c604a2d7c8e2a0a874b48", - "@prisma/fetch-engine": "5.14.0", - "@prisma/get-platform": "5.14.0" + "@prisma/debug": "5.18.0", + "@prisma/engines-version": "5.18.0-25.4c784e32044a8a016d99474bd02a3b6123742169", + "@prisma/fetch-engine": "5.18.0", + "@prisma/get-platform": "5.18.0" } }, "node_modules/@prisma/engines-version": { - "version": "5.14.0-25.e9771e62de70f79a5e1c604a2d7c8e2a0a874b48", - "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-5.14.0-25.e9771e62de70f79a5e1c604a2d7c8e2a0a874b48.tgz", - "integrity": "sha512-ip6pNkRo1UxWv+6toxNcYvItNYaqQjXdFNGJ+Nuk2eYtRoEdoF13wxo7/jsClJFFenMPVNVqXQDV0oveXnR1cA==", + "version": "5.18.0-25.4c784e32044a8a016d99474bd02a3b6123742169", + "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-5.18.0-25.4c784e32044a8a016d99474bd02a3b6123742169.tgz", + "integrity": "sha512-a/+LpJj8vYU3nmtkg+N3X51ddbt35yYrRe8wqHTJtYQt7l1f8kjIBcCs6sHJvodW/EK5XGvboOiwm47fmNrbgg==", "devOptional": true }, "node_modules/@prisma/fetch-engine": { - "version": "5.14.0", - "resolved": "https://registry.npmjs.org/@prisma/fetch-engine/-/fetch-engine-5.14.0.tgz", - "integrity": "sha512-VrheA9y9DMURK5vu8OJoOgQpxOhas3qF0IBHJ8G/0X44k82kc8E0w98HCn2nhnbOOMwbWsJWXfLC2/F8n5u0gQ==", + "version": "5.18.0", + "resolved": "https://registry.npmjs.org/@prisma/fetch-engine/-/fetch-engine-5.18.0.tgz", + "integrity": "sha512-I/3u0x2n31rGaAuBRx2YK4eB7R/1zCuayo2DGwSpGyrJWsZesrV7QVw7ND0/Suxeo/vLkJ5OwuBqHoCxvTHpOg==", "devOptional": true, "dependencies": { - "@prisma/debug": "5.14.0", - "@prisma/engines-version": "5.14.0-25.e9771e62de70f79a5e1c604a2d7c8e2a0a874b48", - "@prisma/get-platform": "5.14.0" + "@prisma/debug": "5.18.0", + "@prisma/engines-version": "5.18.0-25.4c784e32044a8a016d99474bd02a3b6123742169", + "@prisma/get-platform": "5.18.0" } }, "node_modules/@prisma/get-platform": { - "version": "5.14.0", - "resolved": "https://registry.npmjs.org/@prisma/get-platform/-/get-platform-5.14.0.tgz", - "integrity": "sha512-/yAyBvcEjRv41ynZrhdrPtHgk47xLRRq/o5eWGcUpBJ1YrUZTYB8EoPiopnP7iQrMATK8stXQdPOoVlrzuTQZw==", + "version": "5.18.0", + "resolved": "https://registry.npmjs.org/@prisma/get-platform/-/get-platform-5.18.0.tgz", + "integrity": "sha512-Tk+m7+uhqcKDgnMnFN0lRiH7Ewea0OEsZZs9pqXa7i3+7svS3FSCqDBCaM9x5fmhhkufiG0BtunJVDka+46DlA==", "devOptional": true, "dependencies": { - "@prisma/debug": "5.14.0" + "@prisma/debug": "5.18.0" } }, "node_modules/@rushstack/eslint-patch": { @@ -8131,13 +8131,13 @@ "dev": true }, "node_modules/prisma": { - "version": "5.14.0", - "resolved": "https://registry.npmjs.org/prisma/-/prisma-5.14.0.tgz", - "integrity": "sha512-gCNZco7y5XtjrnQYeDJTiVZmT/ncqCr5RY1/Cf8X2wgLRmyh9ayPAGBNziI4qEE4S6SxCH5omQLVo9lmURaJ/Q==", + "version": "5.18.0", + "resolved": "https://registry.npmjs.org/prisma/-/prisma-5.18.0.tgz", + "integrity": "sha512-+TrSIxZsh64OPOmaSgVPH7ALL9dfU0jceYaMJXsNrTkFHO7/3RANi5K2ZiPB1De9+KDxCWn7jvRq8y8pvk+o9g==", "devOptional": true, "hasInstallScript": true, "dependencies": { - "@prisma/engines": "5.14.0" + "@prisma/engines": "5.18.0" }, "bin": { "prisma": "build/index.js" diff --git a/package.json b/package.json index 55d3388..ff030ae 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "lint-staged": "^15.2.8", "postcss": "^8", "prettier": "3.3.3", - "prisma": "^5.14.0", + "prisma": "^5.18.0", "tailwindcss": "^3.3.0", "ts-jest": "^29.1.4", "typescript": "^5" diff --git a/prisma/migrations/0_init/migration.sql b/prisma/migrations/0_init/migration.sql new file mode 100644 index 0000000..5695452 --- /dev/null +++ b/prisma/migrations/0_init/migration.sql @@ -0,0 +1,98 @@ +-- CreateTable +CREATE TABLE "buildprices" ( + "id" SERIAL NOT NULL, + "housetypedescription" VARCHAR(250) NOT NULL, + "housetype" VARCHAR(1) NOT NULL, + "pricerange" VARCHAR(50) NOT NULL, + "pricemid" DOUBLE PRECISION NOT NULL, + + CONSTRAINT "buildprices_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "gdhi" ( + "id" SERIAL NOT NULL, + "itllevel" VARCHAR(250) NOT NULL, + "itl3" VARCHAR(250) NOT NULL, + "region" VARCHAR(250) NOT NULL, + "gdhi_2020" DOUBLE PRECISION NOT NULL, + + CONSTRAINT "gdhi_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "hpi" ( + "id" SERIAL NOT NULL, + "region" VARCHAR(250) NOT NULL, + "itl3" VARCHAR(250) NOT NULL, + "ladcode" VARCHAR(250) NOT NULL, + "hpi_2020" DOUBLE PRECISION NOT NULL, + + CONSTRAINT "hpi_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "itl_lookup" ( + "postcode" TEXT NOT NULL, + "district" TEXT NOT NULL, + "areacode" TEXT NOT NULL, + "itl3" TEXT NOT NULL, + "id" SERIAL NOT NULL, + + CONSTRAINT "itl_lookup_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "pricespaid" ( + "id" SERIAL NOT NULL, + "transactionidentifier" VARCHAR(250) NOT NULL, + "price" DOUBLE PRECISION NOT NULL, + "postcode" VARCHAR(250) NOT NULL, + "propertytype" VARCHAR(250) NOT NULL, + "newbuild" VARCHAR(250) NOT NULL, + + CONSTRAINT "pricespaid_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "rent" ( + "id" SERIAL NOT NULL, + "itl3" VARCHAR(250) NOT NULL, + "ladcode" VARCHAR(250) NOT NULL, + "region" VARCHAR(250) NOT NULL, + "monthlymeanrent" DOUBLE PRECISION NOT NULL, + + CONSTRAINT "rent_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "soc_rent_adjustments" ( + "year" VARCHAR(10) NOT NULL, + "inflation" DOUBLE PRECISION, + "additional" DOUBLE PRECISION, + "total" DOUBLE PRECISION NOT NULL, + "id" SERIAL NOT NULL, + + CONSTRAINT "soc_rent_adjustments_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "socialrent" ( + "id" SERIAL NOT NULL, + "county" VARCHAR(250) NOT NULL, + "itl3" VARCHAR(250) NOT NULL, + "earningsperweek" DOUBLE PRECISION NOT NULL, + + CONSTRAINT "socialrent_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "gas_bills" ( + "id" INTEGER NOT NULL, + "Region" VARCHAR NOT NULL, + "itl" VARCHAR NOT NULL, + "bill" DOUBLE PRECISION NOT NULL, + + CONSTRAINT "gas_bills_pkey" PRIMARY KEY ("id") +); + From b2eac52ddf4ab68dc07e5493184dcf4943340a78 Mon Sep 17 00:00:00 2001 From: Gabriele Granello Date: Fri, 9 Aug 2024 11:42:22 +0200 Subject: [PATCH 2/2] first migration with prisma. Added clause not null --- package-lock.json | 54 +++++++------- prisma/migrations/0_init/migration.sql | 98 ++++++++++++++++++++++++++ 2 files changed, 125 insertions(+), 27 deletions(-) create mode 100644 prisma/migrations/0_init/migration.sql diff --git a/package-lock.json b/package-lock.json index 1cf515b..eb1800c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1568,48 +1568,48 @@ } }, "node_modules/@prisma/debug": { - "version": "5.14.0", - "resolved": "https://registry.npmjs.org/@prisma/debug/-/debug-5.14.0.tgz", - "integrity": "sha512-iq56qBZuFfX3fCxoxT8gBX33lQzomBU0qIUaEj1RebsKVz1ob/BVH1XSBwwwvRVtZEV1b7Fxx2eVu34Ge/mg3w==", + "version": "5.18.0", + "resolved": "https://registry.npmjs.org/@prisma/debug/-/debug-5.18.0.tgz", + "integrity": "sha512-f+ZvpTLidSo3LMJxQPVgAxdAjzv5OpzAo/eF8qZqbwvgi2F5cTOI9XCpdRzJYA0iGfajjwjOKKrVq64vkxEfUw==", "devOptional": true }, "node_modules/@prisma/engines": { - "version": "5.14.0", - "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-5.14.0.tgz", - "integrity": "sha512-lgxkKZ6IEygVcw6IZZUlPIfLQ9hjSYAtHjZ5r64sCLDgVzsPFCi2XBBJgzPMkOQ5RHzUD4E/dVdpn9+ez8tk1A==", + "version": "5.18.0", + "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-5.18.0.tgz", + "integrity": "sha512-ofmpGLeJ2q2P0wa/XaEgTnX/IsLnvSp/gZts0zjgLNdBhfuj2lowOOPmDcfKljLQUXMvAek3lw5T01kHmCG8rg==", "devOptional": true, "hasInstallScript": true, "dependencies": { - "@prisma/debug": "5.14.0", - "@prisma/engines-version": "5.14.0-25.e9771e62de70f79a5e1c604a2d7c8e2a0a874b48", - "@prisma/fetch-engine": "5.14.0", - "@prisma/get-platform": "5.14.0" + "@prisma/debug": "5.18.0", + "@prisma/engines-version": "5.18.0-25.4c784e32044a8a016d99474bd02a3b6123742169", + "@prisma/fetch-engine": "5.18.0", + "@prisma/get-platform": "5.18.0" } }, "node_modules/@prisma/engines-version": { - "version": "5.14.0-25.e9771e62de70f79a5e1c604a2d7c8e2a0a874b48", - "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-5.14.0-25.e9771e62de70f79a5e1c604a2d7c8e2a0a874b48.tgz", - "integrity": "sha512-ip6pNkRo1UxWv+6toxNcYvItNYaqQjXdFNGJ+Nuk2eYtRoEdoF13wxo7/jsClJFFenMPVNVqXQDV0oveXnR1cA==", + "version": "5.18.0-25.4c784e32044a8a016d99474bd02a3b6123742169", + "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-5.18.0-25.4c784e32044a8a016d99474bd02a3b6123742169.tgz", + "integrity": "sha512-a/+LpJj8vYU3nmtkg+N3X51ddbt35yYrRe8wqHTJtYQt7l1f8kjIBcCs6sHJvodW/EK5XGvboOiwm47fmNrbgg==", "devOptional": true }, "node_modules/@prisma/fetch-engine": { - "version": "5.14.0", - "resolved": "https://registry.npmjs.org/@prisma/fetch-engine/-/fetch-engine-5.14.0.tgz", - "integrity": "sha512-VrheA9y9DMURK5vu8OJoOgQpxOhas3qF0IBHJ8G/0X44k82kc8E0w98HCn2nhnbOOMwbWsJWXfLC2/F8n5u0gQ==", + "version": "5.18.0", + "resolved": "https://registry.npmjs.org/@prisma/fetch-engine/-/fetch-engine-5.18.0.tgz", + "integrity": "sha512-I/3u0x2n31rGaAuBRx2YK4eB7R/1zCuayo2DGwSpGyrJWsZesrV7QVw7ND0/Suxeo/vLkJ5OwuBqHoCxvTHpOg==", "devOptional": true, "dependencies": { - "@prisma/debug": "5.14.0", - "@prisma/engines-version": "5.14.0-25.e9771e62de70f79a5e1c604a2d7c8e2a0a874b48", - "@prisma/get-platform": "5.14.0" + "@prisma/debug": "5.18.0", + "@prisma/engines-version": "5.18.0-25.4c784e32044a8a016d99474bd02a3b6123742169", + "@prisma/get-platform": "5.18.0" } }, "node_modules/@prisma/get-platform": { - "version": "5.14.0", - "resolved": "https://registry.npmjs.org/@prisma/get-platform/-/get-platform-5.14.0.tgz", - "integrity": "sha512-/yAyBvcEjRv41ynZrhdrPtHgk47xLRRq/o5eWGcUpBJ1YrUZTYB8EoPiopnP7iQrMATK8stXQdPOoVlrzuTQZw==", + "version": "5.18.0", + "resolved": "https://registry.npmjs.org/@prisma/get-platform/-/get-platform-5.18.0.tgz", + "integrity": "sha512-Tk+m7+uhqcKDgnMnFN0lRiH7Ewea0OEsZZs9pqXa7i3+7svS3FSCqDBCaM9x5fmhhkufiG0BtunJVDka+46DlA==", "devOptional": true, "dependencies": { - "@prisma/debug": "5.14.0" + "@prisma/debug": "5.18.0" } }, "node_modules/@rushstack/eslint-patch": { @@ -8124,13 +8124,13 @@ "dev": true }, "node_modules/prisma": { - "version": "5.14.0", - "resolved": "https://registry.npmjs.org/prisma/-/prisma-5.14.0.tgz", - "integrity": "sha512-gCNZco7y5XtjrnQYeDJTiVZmT/ncqCr5RY1/Cf8X2wgLRmyh9ayPAGBNziI4qEE4S6SxCH5omQLVo9lmURaJ/Q==", + "version": "5.18.0", + "resolved": "https://registry.npmjs.org/prisma/-/prisma-5.18.0.tgz", + "integrity": "sha512-+TrSIxZsh64OPOmaSgVPH7ALL9dfU0jceYaMJXsNrTkFHO7/3RANi5K2ZiPB1De9+KDxCWn7jvRq8y8pvk+o9g==", "devOptional": true, "hasInstallScript": true, "dependencies": { - "@prisma/engines": "5.14.0" + "@prisma/engines": "5.18.0" }, "bin": { "prisma": "build/index.js" diff --git a/prisma/migrations/0_init/migration.sql b/prisma/migrations/0_init/migration.sql new file mode 100644 index 0000000..5695452 --- /dev/null +++ b/prisma/migrations/0_init/migration.sql @@ -0,0 +1,98 @@ +-- CreateTable +CREATE TABLE "buildprices" ( + "id" SERIAL NOT NULL, + "housetypedescription" VARCHAR(250) NOT NULL, + "housetype" VARCHAR(1) NOT NULL, + "pricerange" VARCHAR(50) NOT NULL, + "pricemid" DOUBLE PRECISION NOT NULL, + + CONSTRAINT "buildprices_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "gdhi" ( + "id" SERIAL NOT NULL, + "itllevel" VARCHAR(250) NOT NULL, + "itl3" VARCHAR(250) NOT NULL, + "region" VARCHAR(250) NOT NULL, + "gdhi_2020" DOUBLE PRECISION NOT NULL, + + CONSTRAINT "gdhi_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "hpi" ( + "id" SERIAL NOT NULL, + "region" VARCHAR(250) NOT NULL, + "itl3" VARCHAR(250) NOT NULL, + "ladcode" VARCHAR(250) NOT NULL, + "hpi_2020" DOUBLE PRECISION NOT NULL, + + CONSTRAINT "hpi_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "itl_lookup" ( + "postcode" TEXT NOT NULL, + "district" TEXT NOT NULL, + "areacode" TEXT NOT NULL, + "itl3" TEXT NOT NULL, + "id" SERIAL NOT NULL, + + CONSTRAINT "itl_lookup_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "pricespaid" ( + "id" SERIAL NOT NULL, + "transactionidentifier" VARCHAR(250) NOT NULL, + "price" DOUBLE PRECISION NOT NULL, + "postcode" VARCHAR(250) NOT NULL, + "propertytype" VARCHAR(250) NOT NULL, + "newbuild" VARCHAR(250) NOT NULL, + + CONSTRAINT "pricespaid_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "rent" ( + "id" SERIAL NOT NULL, + "itl3" VARCHAR(250) NOT NULL, + "ladcode" VARCHAR(250) NOT NULL, + "region" VARCHAR(250) NOT NULL, + "monthlymeanrent" DOUBLE PRECISION NOT NULL, + + CONSTRAINT "rent_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "soc_rent_adjustments" ( + "year" VARCHAR(10) NOT NULL, + "inflation" DOUBLE PRECISION, + "additional" DOUBLE PRECISION, + "total" DOUBLE PRECISION NOT NULL, + "id" SERIAL NOT NULL, + + CONSTRAINT "soc_rent_adjustments_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "socialrent" ( + "id" SERIAL NOT NULL, + "county" VARCHAR(250) NOT NULL, + "itl3" VARCHAR(250) NOT NULL, + "earningsperweek" DOUBLE PRECISION NOT NULL, + + CONSTRAINT "socialrent_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "gas_bills" ( + "id" INTEGER NOT NULL, + "Region" VARCHAR NOT NULL, + "itl" VARCHAR NOT NULL, + "bill" DOUBLE PRECISION NOT NULL, + + CONSTRAINT "gas_bills_pkey" PRIMARY KEY ("id") +); +