Skip to content

Commit

Permalink
Merge pull request #52 from daichitakahashi/fixSchema
Browse files Browse the repository at this point in the history
Fix schema
  • Loading branch information
daichitakahashi authored Nov 28, 2024
2 parents 7b7ad98 + 7537b5f commit d8dac6e
Show file tree
Hide file tree
Showing 10 changed files with 404 additions and 92 deletions.
6 changes: 6 additions & 0 deletions cf-eventhub/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# cf-eventhub

## 0.0.7

### Patch Changes

- 9a96d47: Add indices and change index style

## 0.0.6

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion cf-eventhub/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "cf-eventhub",
"type": "module",
"version": "0.0.6",
"version": "0.0.7",
"keywords": [
"cloudflare"
],
Expand Down
3 changes: 3 additions & 0 deletions cf-eventhub/src/migration/postgres/0001_misty_black_cat.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CREATE INDEX IF NOT EXISTS "dispatch_executions_executed_at_index" ON "eventhub"."dispatch_executions" USING btree ("executed_at");--> statement-breakpoint
CREATE INDEX IF NOT EXISTS "dispatch_results_resulted_at_index" ON "eventhub"."dispatch_results" USING btree ("resulted_at");--> statement-breakpoint
CREATE INDEX IF NOT EXISTS "dispatches_created_at_index" ON "eventhub"."dispatches" USING btree ("created_at");
279 changes: 279 additions & 0 deletions cf-eventhub/src/migration/postgres/meta/0001_snapshot.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,279 @@
{
"id": "a4674776-1532-411b-94c3-fdcc66b19c21",
"prevId": "6106fd33-7215-41fa-888d-046fa1abe524",
"version": "7",
"dialect": "postgresql",
"tables": {
"eventhub.dispatch_executions": {
"name": "dispatch_executions",
"schema": "eventhub",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"dispatch_id": {
"name": "dispatch_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"result": {
"name": "result",
"type": "text",
"primaryKey": false,
"notNull": true
},
"executed_at": {
"name": "executed_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true
}
},
"indexes": {
"dispatch_executions_executed_at_index": {
"name": "dispatch_executions_executed_at_index",
"columns": [
{
"expression": "executed_at",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"dispatch_executions_dispatch_id_dispatches_id_fk": {
"name": "dispatch_executions_dispatch_id_dispatches_id_fk",
"tableFrom": "dispatch_executions",
"tableTo": "dispatches",
"schemaTo": "eventhub",
"columnsFrom": [
"dispatch_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"eventhub.dispatch_results": {
"name": "dispatch_results",
"schema": "eventhub",
"columns": {
"dispatch_id": {
"name": "dispatch_id",
"type": "uuid",
"primaryKey": true,
"notNull": true
},
"result": {
"name": "result",
"type": "text",
"primaryKey": false,
"notNull": true
},
"resulted_at": {
"name": "resulted_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true
}
},
"indexes": {
"dispatch_results_resulted_at_index": {
"name": "dispatch_results_resulted_at_index",
"columns": [
{
"expression": "resulted_at",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"dispatch_results_dispatch_id_dispatches_id_fk": {
"name": "dispatch_results_dispatch_id_dispatches_id_fk",
"tableFrom": "dispatch_results",
"tableTo": "dispatches",
"schemaTo": "eventhub",
"columnsFrom": [
"dispatch_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"eventhub.dispatches": {
"name": "dispatches",
"schema": "eventhub",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"event_id": {
"name": "event_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"destination": {
"name": "destination",
"type": "text",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true
},
"delay_seconds": {
"name": "delay_seconds",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"max_retries": {
"name": "max_retries",
"type": "integer",
"primaryKey": false,
"notNull": true
}
},
"indexes": {
"dispatches_created_at_index": {
"name": "dispatches_created_at_index",
"columns": [
{
"expression": "created_at",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"dispatches_event_id_events_id_fk": {
"name": "dispatches_event_id_events_id_fk",
"tableFrom": "dispatches",
"tableTo": "events",
"schemaTo": "eventhub",
"columnsFrom": [
"event_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"eventhub.events": {
"name": "events",
"schema": "eventhub",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"payload": {
"name": "payload",
"type": "jsonb",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true
}
},
"indexes": {
"events_created_at_index": {
"name": "events_created_at_index",
"columns": [
{
"expression": "created_at",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
}
},
"enums": {},
"schemas": {},
"sequences": {},
"roles": {},
"policies": {},
"views": {},
"_meta": {
"columns": {},
"schemas": {},
"tables": {}
}
}
7 changes: 7 additions & 0 deletions cf-eventhub/src/migration/postgres/meta/_journal.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@
"when": 1728054415580,
"tag": "0000_busy_pestilence",
"breakpoints": true
},
{
"idx": 1,
"version": "7",
"when": 1732801167132,
"tag": "0001_misty_black_cat",
"breakpoints": true
}
]
}
Loading

0 comments on commit d8dac6e

Please sign in to comment.