Created
July 13, 2014 03:48
-
-
Save matula/cdb8b7a9f9cc40461ba2 to your computer and use it in GitHub Desktop.
Truncate Table in Laravel for a table with foreign keys.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (DB::getName() == 'pgsql') { | |
DB::statement('TRUNCATE users CASCADE'); | |
DB::statement('ALTER SEQUENCE users_id_seq RESTART WITH 1'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment