Files
upstream-ent/examples/migration/ent/migrate/migrations/20230101214930_default_values.sql
upstream-mirror 4b3ad0b611
Some checks failed
Atlas CI Public / lint (push) Failing after 13s
Atlas CI Public / sync (push) Has been skipped
snapshot of https://github.com/ent/ent.git (master, 2026-09-15; blobs > 131072B omitted)
2026-09-15 22:12:36 +05:00

5 lines
925 B
SQL

-- create "cards" table
CREATE TABLE `cards` (`id` bigint NOT NULL AUTO_INCREMENT, `owner_id` bigint NOT NULL DEFAULT 0, PRIMARY KEY (`id`), INDEX `cards_users_cards` (`owner_id`), CONSTRAINT `cards_users_cards` FOREIGN KEY (`owner_id`) REFERENCES `users` (`id`) ON UPDATE NO ACTION ON DELETE NO ACTION) CHARSET utf8mb4 COLLATE utf8mb4_bin;
-- create "pets" table
CREATE TABLE `pets` (`id` char(36) NOT NULL, `best_friend_id` char(36) NULL DEFAULT "00000000-0000-0000-0000-000000000000", `owner_id` bigint NOT NULL DEFAULT 0, PRIMARY KEY (`id`), UNIQUE INDEX `best_friend_id` (`best_friend_id`), INDEX `pets_users_owner` (`owner_id`), CONSTRAINT `pets_pets_best_friend` FOREIGN KEY (`best_friend_id`) REFERENCES `pets` (`id`) ON UPDATE NO ACTION ON DELETE SET NULL, CONSTRAINT `pets_users_owner` FOREIGN KEY (`owner_id`) REFERENCES `users` (`id`) ON UPDATE NO ACTION ON DELETE NO ACTION) CHARSET utf8mb4 COLLATE utf8mb4_bin;