diff --git a/migrations/0001_gifted_rafael_vega.sql b/migrations/0001_gifted_rafael_vega.sql new file mode 100644 index 0000000..8755355 --- /dev/null +++ b/migrations/0001_gifted_rafael_vega.sql @@ -0,0 +1,7 @@ +ALTER TABLE "telemetry_data" ALTER COLUMN "panel_id" SET DATA TYPE uuid;--> statement-breakpoint +ALTER TABLE "telemetry_data" ALTER COLUMN "data" SET DATA TYPE jsonb;--> statement-breakpoint +ALTER TABLE "telemetry_panels" ALTER COLUMN "id" SET DATA TYPE uuid;--> statement-breakpoint +ALTER TABLE "telemetry_data" ADD COLUMN "telemetry_version" smallint NOT NULL;--> statement-breakpoint +ALTER TABLE "telemetry_panels" ADD COLUMN "last_update" timestamp DEFAULT now() NOT NULL;--> statement-breakpoint +ALTER TABLE "telemetry_panels" DROP COLUMN IF EXISTS "version";--> statement-breakpoint +TRUNCATE "telemetry_data", "telemetry_panels" CASCADE; \ No newline at end of file diff --git a/migrations/meta/0001_snapshot.json b/migrations/meta/0001_snapshot.json new file mode 100644 index 0000000..4994aa4 --- /dev/null +++ b/migrations/meta/0001_snapshot.json @@ -0,0 +1,491 @@ +{ + "id": "25333ba6-d4c7-46d4-8584-eec1b98b1717", + "prevId": "10bf5104-d144-496b-91fc-d550ef0048d4", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.advent_calendar": { + "name": "advent_calendar", + "schema": "", + "columns": { + "extension_id": { + "name": "extension_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "day": { + "name": "day", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "year": { + "name": "year", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "message": { + "name": "message", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "advent_calendar_extension_id_extensions_id_fk": { + "name": "advent_calendar_extension_id_extensions_id_fk", + "tableFrom": "advent_calendar", + "tableTo": "extensions", + "columnsFrom": [ + "extension_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "advent_calendar_pk": { + "name": "advent_calendar_pk", + "columns": [ + "day", + "year" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.authors": { + "name": "authors", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "website": { + "name": "website", + "type": "varchar(63)", + "primaryKey": false, + "notNull": false + }, + "key": { + "name": "key", + "type": "char(32)", + "primaryKey": false, + "notNull": true, + "default": "md5(random()::text)" + }, + "created": { + "name": "created", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "authors_name_idx": { + "name": "authors_name_idx", + "columns": [ + { + "expression": "name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "authors_key_idx": { + "name": "authors_key_idx", + "columns": [ + { + "expression": "key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.extensions": { + "name": "extensions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "author_id": { + "name": "author_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "extension_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "hidden": { + "name": "hidden", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "pending": { + "name": "pending", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "identifier": { + "name": "identifier", + "type": "varchar(63)", + "primaryKey": false, + "notNull": true + }, + "summary": { + "name": "summary", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "platforms": { + "name": "platforms", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "banner": { + "name": "banner", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "created": { + "name": "created", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "extensions_name_idx": { + "name": "extensions_name_idx", + "columns": [ + { + "expression": "name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "extensions_identifier_idx": { + "name": "extensions_identifier_idx", + "columns": [ + { + "expression": "identifier", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "extensions_author_id_authors_id_fk": { + "name": "extensions_author_id_authors_id_fk", + "tableFrom": "extensions", + "tableTo": "authors", + "columnsFrom": [ + "author_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.telemetry_data": { + "name": "telemetry_data", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "panel_id": { + "name": "panel_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "telemetry_version": { + "name": "telemetry_version", + "type": "smallint", + "primaryKey": false, + "notNull": true + }, + "data": { + "name": "data", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "ip": { + "name": "ip", + "type": "char(64)", + "primaryKey": false, + "notNull": true + }, + "continent": { + "name": "continent", + "type": "char(2)", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "char(2)", + "primaryKey": false, + "notNull": false + }, + "created": { + "name": "created", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "telemetry_data_panel_id_idx": { + "name": "telemetry_data_panel_id_idx", + "columns": [ + { + "expression": "panel_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "telemetry_data_data_idx": { + "name": "telemetry_data_data_idx", + "columns": [ + { + "expression": "data", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "telemetry_data_ip_idx": { + "name": "telemetry_data_ip_idx", + "columns": [ + { + "expression": "ip", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "telemetry_data_continent_idx": { + "name": "telemetry_data_continent_idx", + "columns": [ + { + "expression": "continent", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "telemetry_data_country_idx": { + "name": "telemetry_data_country_idx", + "columns": [ + { + "expression": "country", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "telemetry_data_created_idx": { + "name": "telemetry_data_created_idx", + "columns": [ + { + "expression": "created", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "telemetry_data_panel_id_telemetry_panels_id_fk": { + "name": "telemetry_data_panel_id_telemetry_panels_id_fk", + "tableFrom": "telemetry_data", + "tableTo": "telemetry_panels", + "columnsFrom": [ + "panel_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.telemetry_panels": { + "name": "telemetry_panels", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "created": { + "name": "created", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "last_update": { + "name": "last_update", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": { + "public.extension_type": { + "name": "extension_type", + "schema": "public", + "values": [ + "THEME", + "EXTENSION" + ] + } + }, + "schemas": {}, + "sequences": {}, + "roles": {}, + "policies": {}, + "views": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/migrations/meta/_journal.json b/migrations/meta/_journal.json index 019ac0a..0e59210 100644 --- a/migrations/meta/_journal.json +++ b/migrations/meta/_journal.json @@ -8,6 +8,13 @@ "when": 1732967733846, "tag": "0000_brief_the_captain", "breakpoints": true + }, + { + "idx": 1, + "version": "7", + "when": 1734018063049, + "tag": "0001_gifted_rafael_vega", + "breakpoints": true } ] } \ No newline at end of file