home / chat

worker_read_write_locks_mode

✎ View and edit SQL

This data as json

0 records

CREATE TABLE worker_read_write_locks_mode (
    lock_name TEXT NOT NULL,
    lock_key TEXT NOT NULL,
    -- Whether this lock is in read (false) or write (true) mode
    write_lock BOOLEAN NOT NULL,
    -- A token that has currently acquired the lock. We need this so that we can
    -- add a foreign constraint from this table to `worker_read_write_locks`.
    token TEXT NOT NULL,
    -- Add a foreign key constraint to ensure that if a lock is in
    -- `worker_read_write_locks_mode` then there must be a corresponding row in
    -- `worker_read_write_locks` (i.e. we don't accidentally end up with a row in
    -- `worker_read_write_locks_mode` when the lock is not currently acquired).
    FOREIGN KEY (lock_name, lock_key, token) REFERENCES worker_read_write_locks(lock_name, lock_key, token) DEFERRABLE INITIALLY DEFERRED
);
CREATE UNIQUE INDEX worker_read_write_locks_mode_key ON worker_read_write_locks_mode (lock_name, lock_key);
CREATE UNIQUE INDEX worker_read_write_locks_mode_type ON worker_read_write_locks_mode (lock_name, lock_key, write_lock);
Powered by Datasette · Queries took 9.874ms