Skip to content

Commit d32536c

Browse files
committed
Fix table schemas, use safer transaction mode
1 parent cfce15b commit d32536c

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

sql/2024-09-00-00_sync_v2.sql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CREATE TABLE serialized_components (
1+
CREATE TABLE share.serialized_components (
22
-- The user the term is sandboxed to.
33
user_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE,
44
component_hash_id INTEGER NOT NULL REFERENCES component_hashes(id) ON DELETE CASCADE,
@@ -11,7 +11,7 @@ CREATE TABLE serialized_components (
1111
PRIMARY KEY (user_id, component_hash_id) INCLUDE (bytes_id)
1212
);
1313

14-
CREATE TABLE serialized_namespaces (
14+
CREATE TABLE share.serialized_namespaces (
1515
namespace_hash_id INTEGER NOT NULL REFERENCES branch_hashes(id) ON DELETE CASCADE,
1616

1717
-- The serialized namespace
@@ -22,15 +22,15 @@ CREATE TABLE serialized_namespaces (
2222
PRIMARY KEY (namespace_hash_id) INCLUDE (bytes_id)
2323
);
2424

25-
CREATE TABLE serialized_patches (
25+
CREATE TABLE share.serialized_patches (
2626
patch_id INTEGER NOT NULL REFERENCES patches(id) ON DELETE CASCADE,
2727
bytes_id INTEGER NOT NULL REFERENCES bytes(id) ON DELETE NO ACTION,
2828
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
2929

3030
PRIMARY KEY (patch_id) INCLUDE (bytes_id)
3131
);
3232

33-
CREATE TABLE serialized_causals (
33+
CREATE TABLE share.serialized_causals (
3434
causal_id INTEGER NOT NULL REFERENCES causals(id) ON DELETE CASCADE,
3535
bytes_id INTEGER NOT NULL REFERENCES bytes(id) ON DELETE NO ACTION,
3636
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),

sql/2025-01-24_migrate-serialized-entities.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
-- Add the table for the migration queue. This can be deleted after the migration
2-
CREATE TABLE migrate_serialized_queue(
2+
CREATE TABLE share.migrate_serialized_queue (
33
hash text NOT NULL,
44
user_id uuid NOT NULL REFERENCES users(id),
55

src/Share/BackgroundJobs/SerializedEntitiesMigration/Worker.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ worker scope = do
2727

2828
processEntities :: AuthZ.AuthZReceipt -> Background Bool
2929
processEntities !_authZReceipt = do
30-
PG.runTransactionMode PG.ReadCommitted PG.ReadWrite $ do
30+
PG.runTransaction do
3131
Q.claimEntity >>= \case
3232
Nothing -> pure False
3333
Just (hash32, codebaseUserId) -> do

0 commit comments

Comments
 (0)