github.com/iasthc/atlas/cmd/atlas@v0.0.0-20230523071841-73246df3f88d/internal/cmdapi/testdata/sqlitetx2/20220925094437_third.sql (about)

     1  -- disable the enforcement of foreign-keys constraints
     2  PRAGMA foreign_keys = off;
     3  -- create "new_users" table
     4  CREATE TABLE `new_users` (`id` integer NOT NULL, PRIMARY KEY (`id`));
     5  -- copy rows from old table "users" to new temporary table "new_users"
     6  INSERT INTO `new_users` (`id`) SELECT `id` FROM `users`;
     7  -- drop "users" table after copying rows
     8  DROP TABLE `users`;
     9  -- rename temporary table "new_users" to "users"
    10  ALTER TABLE `new_users` RENAME TO `users`;
    11  -- insert faulty data
    12  INSERT INTO `friendships` (`user_id`, `friend_id`) VALUES (3,2);
    13  -- enable back the enforcement of foreign-keys constraints
    14  PRAGMA foreign_keys = on;