Hi, is D1 globally replicated or its just in the region we select at start ?
Hi, is D1 globally replicated or its just in the region we select at start ?
Right now, deletes are treated as writes.
ON UPDATE RESTRICT, to prevent updates from happening if there's any foreign keys that relies on a field that's being changed?wrangler d1 execute --local --file=.sql approach. I thought I could just move the .wrangler/state/v3/d1 dir over to another dir and spin things up but that did not work. Is there some other approach I could use?database_id & database_name?.sqlite file and run .dump.sqlite file, unless you are referring to a remote D1 Database?.sqlite file. D1 in local development is just a wrapper around that .sqlite fileCREATE TABLE `experiences` (
`id` text PRIMARY KEY NOT NULL,
`name` text NOT NULL
);
CREATE TABLE `users` (
`id` text PRIMARY KEY NOT NULL,
`name` text NOT NULL
);
CREATE TABLE `experience_owners` (
`experience_id` text NOT NULL,
`user_id` text NOT NULL,
PRIMARY KEY(`experience_id`, `user_id`),
FOREIGN KEY (`experience_id`) REFERENCES `experiences`(`id`) ON UPDATE no action ON DELETE cascade
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action
);
insert into experiences (id, name) VALUES (1, 'owning a house');
insert into users (id, name) VALUES (1, 'some guy');
insert into experience_owners (experience_id, user_id) VALUES (1,1);